Skip to content
Snippets Groups Projects
Commit d20a9503 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: bad conversion if records is a float number

parent 68ffff7c
No related branches found
No related tags found
No related merge requests found
...@@ -2670,9 +2670,16 @@ function migrate_project_task_time($db,$langs,$conf) ...@@ -2670,9 +2670,16 @@ function migrate_project_task_time($db,$langs,$conf)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->task_duration > 0 && strlen($obj->task_duration) < 3) if ($obj->task_duration > 0)
{ {
$newtime = $obj->task_duration*60*60; // convert to second
// only for int time and float time ex: 1,75 for 1h45
$time = str_replace(',','.',$obj->task_duration);
$time = floatval($time);
list($hour,$min) = explode('.',$time);
$hour = $hour*60*60;
$min = ($min/100)*60*60;
$newtime = $hour+$min;
$sql2 = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; $sql2 = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
$sql2.= " task_duration = ".$newtime; $sql2.= " task_duration = ".$newtime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment