Bonjour,

Vous trouverez ci-joint un patch pour Dolibarr 3.0.0 stable qui ajoute la 
possibilité de choisir le nombre d'heure par jour. (Fichier /lib/date.lib.php)
Il faut ajouter la variable de configuration HOURS_BY_DAY avec pour valeur le 
nombre d'heures de travail par jour. Si la variable n'existe pas on laisse à 24 
heures par défaut.

Dans la partie Temps consommés d'une tâche (fichier /projet/tasks/time.php), ce 
patch ajoute un récapitulatif des temps consommés pour chaque personne sur la 
tâche.

Le fichier de traduction (/langs/fr_FR/projects.lang) à été modifié pour cette 
nouvelle partie.

Cordialement,
Mouillard Dimitri

--------------------------------------------
Dimitri Mouilllard
Développeur
Teclib' -  5, rue Jean Perrin, 28600 Luisant
Mail : [email protected]
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents langs/fr_FR/projects.lang langs/fr_FR/projects.lang
--- langs/fr_FR/projects.lang	2011-01-17 02:46:07.000000000 +0100
+++ langs/fr_FR/projects.lang	2011-04-15 11:30:40.000000000 +0200
@@ -93,3 +93,7 @@
 TypeContact_project_task_external_CONTRIBUTOR=Intervenant
 # Documents models
 DocumentModelBaleine=Modèle de rapport de projet complet (logo...)
+
+#TIME GROUP BY PEOPLE
+TIME_GROUP_BY_USER=Temps consommés par personne
+TIME_LIST_BY_USER=Listing des temps consommés
\ No newline at end of file
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents lib/date.lib.php lib/date.lib.php
--- lib/date.lib.php	2011-01-17 02:46:36.000000000 +0100
+++ lib/date.lib.php	2011-04-15 11:30:24.000000000 +0200
@@ -66,9 +66,13 @@
  */
 function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
 {
-	global $langs;
-
-	if (empty($lengthOfDay)) $lengthOfDay = 86400;
+	global $langs,$conf;
+   
+   if(isset($conf->global->HOURS_BY_DAY)) {
+      $lengthOfDay = $conf->global->HOURS_BY_DAY*60*60;
+   } else {
+	   if (empty($lengthOfDay)) $lengthOfDay = 86400;
+   }
 
 	if ($format == 'all')
 	{
diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents projet/tasks/time.php projet/tasks/time.php
--- projet/tasks/time.php	2010-08-04 01:24:39.000000000 +0200
+++ projet/tasks/time.php	2011-04-15 11:30:35.000000000 +0200
@@ -294,6 +294,38 @@
 			dol_print_error($db);
 		}
 
+		$users_time = array();
+		foreach($tasks as $taskk):
+			$user_id = $taskk->fk_user;
+			$users_time[$user_id] += $taskk->task_duration;
+		endforeach;
+      
+		print '<div class="menu_titre_box">'.$langs->trans("TIME_GROUP_BY_USER").'</div>';
+			print '<table class="border" width="50%">';
+			print '<tr class="liste_titre">';
+				print '<td align="left">'.$langs->trans("By").'</td>';
+				print '<td align="left">'.$langs->trans("TimeSpent").'</td>';
+			print '</tr>';
+				foreach($users_time as $key => $user_time):
+					// User infos from Dolibarr core
+					$userfee=new User($db);
+					$userfee->fetch($key);
+                  
+					$var=!$var;
+		  		    print "<tr ".$bc[$var].">";
+						print '<td width="50%">';
+							print $userfee->getNomUrl(1);
+						print '</td>';
+						print '<td width="50%">';
+							print ConvertSecondToTime($user_time,'all');
+						print '</td>';
+					print '</tr>';
+				endforeach;
+			print '</table>';
+
+         print '<br />';
+         print '<div class="menu_titre_box">'.$langs->trans("TIME_LIST_BY_USER").'</div>';
+
 		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
 		print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 		print '<input type="hidden" name="action" value="updateline">';
_______________________________________________
Dolibarr-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à