Tested in version 3.3 and 7:
Importing tracker items through CSV does not properly process the date field.
My exported CSV contains e.g. "24/12/2010 19:55"
The imported data only contains "24/12/2010" The time has been left out.
# Version 3.3 Line 1697 } elseif ($field['type'] == 'f' || $field['type'] == 'j') { if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = split('/', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = split('/', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } }
Replaced by following code :
elseif ($field['type'] == 'f' || $field['type'] == 'j') { $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(0, 0, 0, $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]); if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = explode('/', $fd); list($hh, $mm) = explode(':', $ft); $data[$i] = $tikilib->make_time($hh, $mm, 0, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = explode('/', $fd); list($hh, $mm) = explode(':', $ft); $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]); if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = explode('/', $fd); list($hh, $mm) = explode(':', $ft); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = explode('/', $fd); list($hh, $mm) = explode(':', $ft); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } break; } }
The same for the latest version 8.3
case 'f': case 'j': if ($dateFormat == 'mm/dd/yyyy') { list($m, $d, $y) = preg_split('#/#', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } elseif ($dateFormat == 'dd/mm/yyyy') { list($d, $m, $y) = preg_split('#/#', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } elseif ($dateFormat == 'yyyy-mm-dd') { list($y, $m, $d) = preg_split('#-#', $data[$i]); $data[$i] = $tikilib->make_time(0, 0, 0, $m, $d, $y); } break; }
# Line 1730 case 'f': case 'j': $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(0, 0, 0, $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); } elseif ($dateFormat == 'yyyy-mm-dd') { list($y, $m, $d) = 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); } elseif ($dateFormat == 'yyyy-mm-dd') { list($y, $m, $d) = 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); } elseif ($dateFormat == 'yyyy-mm-dd') { list($y, $m, $d) = explode('-', $fd); $data[$i] = $tikilib->make_time($hh, $mm, $ss, $m, $d, $y); } break; } break;
Correct code for v3.3 is posted in the description.
Still working on the solution for v7.... Will be available later today (22/02/2012)
Edit :
Checked for the problem on latest stable version: Problem still exists in v 8.3
I Added the proper code into the description.
ATTENTION :
- I have no PHP skills whatsoever.
- Only tested the solution for version 3.3
- Solution for version 8.3 has not been tested and needs to be revised!!!
Edit 2 :
- replaced split and preg_split functions with the explode() function, as split() is EOL and preg_split() is not as fast as explode and regular expressions are not needed.
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.
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.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |