From 0157a18f8f9db07444ceebeace77138584f99037 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 6 Nov 2010 18:27:38 +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 02329537905..d31084f799e 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2697,9 +2697,16 @@ function migrate_project_task_time($db,$langs,$conf) { $obj = $db->fetch_object($resql); - if ($obj->task_duration > 0 && dol_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;