From dffd371ca466a04d09520e87d96b97e7b6e045ab Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Sun, 7 Nov 2010 07:28:23 +0000
Subject: [PATCH] Fix: only one records in database

---
 htdocs/projet/activity/list.php | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php
index a968258f375..f785a3225c2 100644
--- a/htdocs/projet/activity/list.php
+++ b/htdocs/projet/activity/list.php
@@ -89,15 +89,20 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
 				if($matches[2]=='min') $timespent_duration += $time*60;
 			}
  		}
-
-		if(intval($time)<0) $mesg='<div class="error">'.$langs->trans("ErrorBadValue").'</div>';
 	}
 	
-	$task->fetch($id);
-	$task->timespent_duration = $timespent_duration;
-	$task->timespent_fk_user = $user->id;
-	$task->timespent_date = dol_mktime(12,0,0,$_POST["{$id}month"],$_POST["{$id}day"],$_POST["{$id}year"]);	
-	$task->addTimeSpent($user);
+	if ($timespent_duration > O)
+	{
+		$task->fetch($id);
+		$task->timespent_duration = $timespent_duration;
+		$task->timespent_fk_user = $user->id;
+		$task->timespent_date = dol_mktime(12,0,0,$_POST["{$id}month"],$_POST["{$id}day"],$_POST["{$id}year"]);
+		$task->addTimeSpent($user);
+	}
+	else
+	{
+		$mesg='<div class="error">'.$langs->trans("ErrorBadValue").'</div>';
+	}
  }
 
 /*
-- 
GitLab