Loading...
 

Tracker Import from csv does not set created and lastModif properly

Status
Closed
Subject
Tracker Import from csv does not set created and lastModif properly
Version
3.x
4.x
5.x
6.x
7.x
8.x
9.x
Category
  • Usability
Feature
Trackers
Import-Export
Resolution status
Fix on the Way
Submitted by
Beestje
Lastmod by
Uwe Altmann
Rating
(0)
Description

Importing tracker items through CSV only sets the created and lastModif value properly if the dates from the CSV file are in the numerical php date format.

When you import a csv file where the created and lastModif dates are written as proper dates, the imported tracker items have a created and lastModif date/timestamp of the date & time of the import action.

example csv :

"itemId","status","created","lastModif","VRID — 265"
"849","o","07/12/2009 13:24","07/12/2009 13:24","4"

Whenever I export a csv file, it contains the dates as shown above, so you can't just export data and import data on the fly without modifying all the values...

c.f. bug 3500

Workaround

in lib/trackers/trackerlib.php starting at line 1627

replace the following code

incorrect code
Copy to clipboard
for ($i = 0; $i < $max; $i++) { if ($encoding == 'ISO-8859-1') { $data[$i] = utf8_encode($data[$i]); } if ($header[$i] == 'status') { if ($data[$i] == 'o' || $data[$i] =='p' || $data[$i] == 'c') $status = $data[$i]; } elseif ($header[$i] == 'itemId') { $itemId = $data[$i]; } elseif ($header[$i] == 'created' && is_numeric($data[$i])) { $created = $data[$i]; } elseif ($header[$i] == 'lastModif' && is_numeric($data[$i])) { $lastModif = $data[$i]; } elseif ($header[$i] == 'categs') { // for old compatibility $cats = split(',',trim($data[$i])); } }


With the following code :

Correct Code
Copy to clipboard
for ($i = 0; $i < $max; $i++) { if ($encoding == 'ISO-8859-1') { $data[$i] = utf8_encode($data[$i]); } if ($header[$i] == 'status') { if ($data[$i] == 'o' || $data[$i] =='p' || $data[$i] == 'c') $status = $data[$i]; } elseif ($header[$i] == 'itemId') { $itemId = $data[$i]; } elseif ($header[$i] == 'created') || ($header[$i] == 'lastModif') { if (is_numeric($data[$i]) { // If created is numeric, datetime is in php format if ($header[$i] == 'created') { $created = $data[$i]; } else { $lastModif = $data[$i]; } } else { // date time needs to be converted to php format $l = strlen($data[$i]); switch ($l) { case ($l == 10): # Field does not contain the time if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = explode('/', $data[$i]); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = explode('/', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } break; case ($l == 16): # Field contains HH:MM list($fd, $ft) = explode(' ', $data[$i]); list($hh, $mm) = explode(':', $ft); if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = explode('/', $fd); $data[$i] = $tikilib->make_time($hh, $mm, 0, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = explode('/', $fd); $data[$i] = $tikilib->make_time($hh, $mm, 0, $m, $d, $y); } break; case ($l == 19): # Field contains HH:MM:SS list($fd, $ft) = explode(' ', $data[$i]); list($hh, $mm, $ss) = explode(':', $ft); if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = explode('/', $fd); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = explode('/', $fd); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } break; } if ($header[$i] == 'created') { $created = $data[$i]; } else { $lastModif = $data[$i]; } } } elseif ($header[$i] == 'categs') { // for old compatibility $cats = split(',',trim($data[$i])); } }
Importance
7
Priority
35
Demonstrate Bug (Tiki 19+)
Please demonstrate your bug on show2.tiki.org
 About show2.tiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.

Version: Create show2.tiki.org instance
Demonstrate Bug (older Tiki versions)
Please demonstrate your bug on show.tikiwiki.org
 About show.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show.tikiwiki.org.

Version: Create show.tikiwiki.org instance
Ticket ID
4176
Created
Wednesday 29 February, 2012 15:06:53 GMT-0000
by Beestje
LastModif
Saturday 12 January, 2013 19:10:37 GMT-0000

Attachments

 filenamecreatedhitscommentversionfiletype 
No attachments for this item


Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Kanban
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Federated Timesheets
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools