From d2dbbca945981f2e8b955b17f6797f6923c5f5f0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 24 Feb 2010 09:53:16 +0000 Subject: [PATCH] Fix: management of time spent in task card --- htdocs/projet/tasks/time.php | 84 +++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f0417e3ae4a..8512b306499 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -60,6 +60,9 @@ if ($_GET["id"] > 0) { $result=$projectstatic->fetch($task->fk_project); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + + // To verify role of users + $userAccess = $projectstatic->restrictedProjectArea($user); $head=task_prepare_head($task); @@ -67,9 +70,6 @@ if ($_GET["id"] > 0) if ($mesg) print $mesg.'
'; - print '
'; - print ''; - print ''; print ''; // Ref @@ -93,11 +93,34 @@ if ($_GET["id"] > 0) else print ' '; print ''; + print '
'; + print ''; + + + /* + * Actions + */ + print '
'; + + // Add time spent + if ($user->rights->projet->creer && $userAccess) + { + print ''.$langs->trans('NewTimeSpent').''; + } + else + { + print ''.$langs->trans('Modify').''; + } + + print '
'; + + print '
'; + /* * List of time spent */ - $sql = "SELECT t.task_date, t.task_duration, t.fk_user"; - $sql.= ", u.rowid, u.name, u.firstname"; + $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user"; + $sql.= ", u.rowid as userid, u.name, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE t.fk_task =".$task->id; @@ -123,38 +146,25 @@ if ($_GET["id"] > 0) { dol_print_error($db); } - - print '
'; - print ''; - - - /* - * Actions - */ - print '
'; - - /* - if ($user->rights->projet->creer) - { - print ''.$langs->trans('Delete').''; - } - */ - - print '
'; - - print '
'; - print ''; + print ''; print ''; + print ''; print ''; print ''; - print ''; + print ''; print "\n"; foreach ($tasks as $task_time) { $var=!$var; print ""; + + // User + $user->id = $task_time->userid; + $user->nom = $task_time->name; + $user->prenom = $task_time->firstname; + print ''; // Date print ''; @@ -164,13 +174,19 @@ if ($_GET["id"] > 0) $minutes = round((($task_time->task_duration - $heure) * 60),0); $minutes = substr("00"."$minutes", -2); print '\n"; - - // User - $user->id = $task_time->rowid; - $user->nom = $task_time->name; - $user->prenom = $task_time->firstname; - print ''; - print "\n"; + + // Icon update et delete + print ''; + + print "\n"; } print "
'.$langs->trans("By").''.$langs->trans("Date").''.$langs->trans("TimeSpent").''.$langs->trans("By").' 
'.$user->getNomUrl(1).''.dol_print_date($db->jdate($task_time->task_date),'%A').' '.dol_print_date($db->jdate($task_time->task_date),'daytext').''.$heure." h ".$minutes."'.$user->getNomUrl(1).'
'; + if ($user->rights->projet->creer && $userAccess) + { + print ' '; + print 'rowid.'">'; + print img_delete(); + print ''; + } + print '
";