From d20a950349b2c38d4a69fcf372046cf2780da43f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 6 Nov 2010 18:27:35 +0000 Subject: [PATCH] Fix: bad conversion if records is a float number --- htdocs/install/upgrade2.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 3e46947a9d2..850d6ef9f50 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2670,9 +2670,16 @@ function migrate_project_task_time($db,$langs,$conf) { $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.= " task_duration = ".$newtime;