diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 4c089ba97b4..df0563383c0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -116,7 +116,7 @@ ConfirmCloseAProject=Are you sure you want to close this project? AlsoCloseAProject=Also close project (keep it open if you still need to follow production tasks on it) ReOpenAProject=Open project ConfirmReOpenAProject=Are you sure you want to re-open this project? -ProjectContact=Project contacts +ProjectContact=Contacts of project TaskContact=Task contacts ActionsOnProject=Events on project YouAreNotContactOfProject=You are not a contact of this private project @@ -125,7 +125,7 @@ DeleteATimeSpent=Delete time spent ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent? DoNotShowMyTasksOnly=See also tasks not assigned to me ShowMyTasksOnly=View only tasks assigned to me -TaskRessourceLinks=Contacts task +TaskRessourceLinks=Contacts of task ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4f0567c51f3..7c632f1fb63 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -44,6 +44,7 @@ $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'alpha'); $id = GETPOST('id', 'int'); $projectid = GETPOST('projectid', 'int'); @@ -571,36 +572,46 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; } - // Link to create time - //if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) - //{ - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($projectstatic->public || $userWrite > 0) - { - if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - //} + // Link to create time + if ($user->rights->projet->all->creer || $user->rights->projet->creer) + { + if ($projectstatic->public || $userWrite > 0) + { + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } } + $massactionbutton = ''; + if ($projectstatic->bill_time) + { + $arrayofmassactions = array( + 'generateinvoice'=>$langs->trans("GenerateBill"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + } + + // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. if (empty($projectidforalltimes)) { $head=task_prepare_head($object); @@ -645,7 +656,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Date start - Date end print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; @@ -671,7 +682,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Progress declared print '
'.$langs->trans("ProgressDeclared").''; @@ -700,93 +711,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; dol_fiche_end(); - - print ''."\n"; - - $title=$langs->trans("ListTaskTimeForTask"); - //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktocreatetime, 'title_generic.png'); - - /* - * Form to add time spent on task - */ - - if ($action == 'createtime' && $object->id > 0 && $user->rights->projet->lire) - { - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - // Date - print ''; - - // Contributor - print ''; - - // Note - print ''; - - // Duration - Time spent - print ''; - - // Progress declared - print ''; - - print ''; - - print '
'.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("NewTimeSpent").''.$langs->trans("ProgressDeclared").'
'; - //$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); - $newdate=''; - print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0); - print ''; - print img_object('', 'user', 'class="hideonsmartphone"'); - $contactsoftask=$object->getListContactId('internal'); - if (count($contactsoftask)>0) - { - if(in_array($user->id, $contactsoftask)) $userid = $user->id; - else $userid=$contactsoftask[0]; - print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTheTask"), 'maxwidth200'); - } - else - { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - print ''; - print ''; - print ''; - print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); - print ''; - print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); - print ''; - print ''; - print '   '; - print ''; - print '
'; - print '
'; - - print '
'; - - print '
'; - } } + if ($projectstatic->id > 0) { if ($action == 'deleteline' && ! empty($projectidforalltimes)) @@ -820,17 +747,6 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } } - if (! empty($withproject) && $projectstatic->bill_time) - { - $arrayofmassactions = array( - 'generateinvoice'=>$langs->trans("GenerateBill"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - } - $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); @@ -856,8 +772,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; if ($action == 'editline') print ''; elseif ($action == 'splitline') print ''; - elseif ($action == 'createtime' && empty($id) && $user->rights->projet->lire) print ''; - elseif ($massaction == 'generateinvoice' && empty($id) && $user->rights->facture->lire) print ''; + elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; + elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; else print ''; print ''; print ''; @@ -869,8 +785,6 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($massaction == 'generateinvoice') { - $langs->load("bills"); - //var_dump($_REQUEST); print ''; @@ -1001,6 +915,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit); } + else + { + print ''."\n"; + + $title=$langs->trans("ListTaskTimeForTask"); + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit); + } $i = 0; while ($i < $num) @@ -1019,15 +941,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* * Form to add time spent */ - if ($action == 'createtime' && empty($id) && $user->rights->projet->lire) + if ($action == 'createtime' && $user->rights->projet->lire) { print ''."\n"; + if (! empty($id)) print ''; print ''; print ''; print ''; - print ''; + if (empty($id)) print ''; print ''; print ''; print ''; @@ -1049,9 +972,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Task - print ''; + if (empty($id)) + { + print ''; + } // Contributor print '
'.$langs->trans("Date").''.$langs->trans("Task").''.$langs->trans("Task").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("NewTimeSpent").''; - $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); - print ''; + $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + print '';