From 0805c693aeea312e7e3a11aece83a592541aa10c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Jun 2017 10:55:39 +0200 Subject: [PATCH] Fix restore of last_search_value ko --- htdocs/projet/class/task.class.php | 69 ++++++------ htdocs/projet/tasks/contact.php | 54 +++++----- htdocs/projet/tasks/document.php | 56 +++++----- htdocs/projet/tasks/note.php | 58 +++++----- htdocs/projet/tasks/task.php | 74 ++++++------- htdocs/projet/tasks/time.php | 168 ++++++++++++++--------------- 6 files changed, 242 insertions(+), 237 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e1025241115..8124f500bd6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -36,7 +36,7 @@ class Task extends CommonObject public $fk_element='fk_task'; public $picto = 'task'; protected $childtables=array('projet_task_time'); // To test if we can delete object - + var $fk_task_parent; var $label; var $description; @@ -59,7 +59,7 @@ class Task extends CommonObject var $timespent_nblinesnull; var $timespent_nblines; // For detail of lines of timespent record, there is the property ->lines in common - + // Var used to call method addTimeSpent(). Bad practice. var $timespent_id; var $timespent_duration; @@ -100,7 +100,7 @@ class Task extends CommonObject // Clean parameters $this->label = trim($this->label); $this->description = trim($this->description); - + // Check parameters // Put here code to add control on parameters values @@ -226,7 +226,7 @@ class Task extends CommonObject if ($resql) { $num_rows = $this->db->num_rows($resql); - + if ($num_rows) { $obj = $this->db->fetch_object($resql); @@ -409,7 +409,7 @@ class Task extends CommonObject $this->db->rollback(); return 0; } - + if (! $error) { // Delete linked contacts @@ -534,7 +534,7 @@ class Task extends CommonObject return -1; } } - + /** * Return nb of time spent * @@ -579,14 +579,15 @@ class Task extends CommonObject * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param string $sep Separator between ref and label if option addlabel is set * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0) + function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0, $save_lastsearch_value=-1) { global $conf, $langs, $user; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - + $result=''; $label = '' . $langs->trans("ShowTask") . ''; if (! empty($this->ref)) @@ -597,8 +598,12 @@ class Task extends CommonObject { $label .= "
".get_date_range($this->date_start,$this->date_end,'',$langs,0); } - + $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':''); + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; $linkclose = ''; if (empty($notooltip)) @@ -611,11 +616,11 @@ class Task extends CommonObject $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; } - + $linkstart = ''; $linkend=''; - + $picto='projecttask'; if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); @@ -706,7 +711,7 @@ class Task extends CommonObject $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; } - else + else { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; } @@ -790,7 +795,7 @@ class Task extends CommonObject $tasks[$i]->date_start = $this->db->jdate($obj->date_start); $tasks[$i]->date_end = $this->db->jdate($obj->date_end); $tasks[$i]->rang = $obj->rang; - + $tasks[$i]->thirdparty_id = $obj->thirdparty_id; $tasks[$i]->thirdparty_name = $obj->thirdparty_name; } @@ -963,7 +968,7 @@ class Task extends CommonObject $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); $ret = $tasktime_id; $this->timespent_id = $ret; - + if (! $notrigger) { // Call trigger @@ -1027,10 +1032,10 @@ class Task extends CommonObject global $langs; $id=$this->id; - if (empty($id)) + if (empty($id)) { dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR); - return -1; + return -1; } $result=array(); @@ -1045,7 +1050,7 @@ class Task extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; - + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1055,14 +1060,14 @@ class Task extends CommonObject $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead - + $this->timespent_min_date=$this->db->jdate($obj->min_date); $this->timespent_max_date=$this->db->jdate($obj->max_date); $this->timespent_total_duration=$obj->total_duration; $this->timespent_total_amount=$obj->total_amount; $this->timespent_nblinesnull=($obj->nblinesnull?$obj->nblinesnull:0); $this->timespent_nblines=($obj->nblines?$obj->nblines:0); - + $this->db->free($resql); } else @@ -1357,7 +1362,7 @@ class Task extends CommonObject $clone_task->fetch($fromid); $clone_task->fetch_optionals(); //var_dump($clone_task->array_options);exit; - + $origin_task->fetch($fromid); $defaultref=''; @@ -1680,7 +1685,7 @@ class Task extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } - + /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1690,12 +1695,12 @@ class Task extends CommonObject function load_board($user) { global $conf, $langs; - + $mine=0; $socid=$user->societe_id; - + $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); - + // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; @@ -1718,29 +1723,29 @@ class Task extends CommonObject if ($resql) { $task_static = new Task($this->db); - + $response = new WorkboardResponse(); $response->warning_delay = $conf->projet->task->warning_delay/60/60/24; $response->label = $langs->trans("OpenedTasks"); if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project'; $response->img = img_object('',"task"); - + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $response->nbtodo++; - + $task_static->projectstatus = $obj->projectstatus; $task_static->progress = $obj->progress; $task_static->fk_statut = $obj->status; $task_static->date_end = $this->db->jdate($obj->datee); - + if ($task_static->hasDelay()) { $response->nbtodolate++; } } - + return $response; } else @@ -1749,7 +1754,7 @@ class Task extends CommonObject return -1; } } - + /** * Is the task delayed? * @@ -1758,7 +1763,7 @@ class Task extends CommonObject public function hasDelay() { global $conf; - + if (! ($this->progress >= 0 && $this->progress < 100)) { return false; } @@ -1768,5 +1773,5 @@ class Task extends CommonObject $datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0); return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); - } + } } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 9160f2b3795..d4029847534 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref) > 0) { $id = $object->id; // So when doing a search from ref, id is also set correctly. - + $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); @@ -192,83 +192,83 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); // Project card - - $linkback = ''.$langs->trans("BackToList").''; - + + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; // Title $morehtmlref.=$projectstatic->title; // Thirdparty - if ($projectstatic->thirdparty->id > 0) + if ($projectstatic->thirdparty->id > 0) { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; - + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
'; print '
'; print '
'; - + print ''; - + // Visibility print ''; - + // Date start - end print ''; - + // Budget print ''; - + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); $end=dol_print_date($projectstatic->date_end,'day'); if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + // Description print ''; - + // Categories if($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print "
'; - + print '
'; print '
'; print '
'; - + print '
'; dol_fiche_end(); @@ -284,16 +284,16 @@ if ($id > 0 || ! empty($ref)) $param=(GETPOST('withproject')?'&withproject=1':''); $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; - + if (! GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - + $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -301,13 +301,13 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=''; } - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1); dol_fiche_end(); @@ -385,7 +385,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($withproject) print ''; - + print ''; print ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 661776b9b4d..649e1efd575 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -136,84 +136,84 @@ if ($object->id > 0) // Project card - $linkback = ''.$langs->trans("BackToList").''; - + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; // Title $morehtmlref.=$projectstatic->title; // Thirdparty - if ($projectstatic->thirdparty->id > 0) + if ($projectstatic->thirdparty->id > 0) { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; - + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
'; print '
'; print '
'; - + print ''; - + // Visibility print ''; - + // Date start - end print ''; - + // Budget print ''; - + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); $end=dol_print_date($projectstatic->date_end,'day'); if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + // Description print ''; - + // Categories if($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print "
'; - + print '
'; print '
'; print '
'; - + print '
'; - + dol_fiche_end(); } @@ -227,7 +227,7 @@ if ($object->id > 0) { $totalsize+=$file['size']; } - + $param=(GETPOST('withproject')?'&withproject=1':''); $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; @@ -237,9 +237,9 @@ if ($object->id > 0) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - + $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -247,17 +247,17 @@ if ($object->id > 0) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=''; } - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - + print '
'; - + print '
'; print ''; @@ -268,7 +268,7 @@ if ($object->id > 0) print "
\n"; print '
'; - + dol_fiche_end(); print '
'; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 0d6df7d85fd..13a8979ae91 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -114,9 +114,9 @@ if ($object->id > 0) $param=($mode=='mine'?'&mode=mine':''); // Project card - - $linkback = ''.$langs->trans("BackToList").''; - + + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; // Title $morehtmlref.=$projectstatic->title; @@ -126,92 +126,92 @@ if ($object->id > 0) $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; - + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
'; print '
'; print '
'; - + print ''; - + // Visibility print ''; - + // Date start - end print ''; - + // Budget print ''; - + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); $end=dol_print_date($projectstatic->date_end,'day'); if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + // Description print ''; - + // Categories if($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print "
'; - + print '
'; print '
'; print '
'; - + print '
'; - + dol_fiche_end(); } $head = task_prepare_head($object); dol_fiche_head($head, 'task_notes', $langs->trans('Task'), -1, 'projecttask'); - + $param=(GETPOST('withproject')?'&withproject=1':''); $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; - + if (! GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - + $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -219,17 +219,17 @@ if ($object->id > 0) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=''; } - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - + print '
'; - + print '
'; $cssclass='titlefield'; @@ -237,7 +237,7 @@ if ($object->id > 0) include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; - + dol_fiche_end(); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 5f493167fd8..9211d75f499 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -226,85 +226,85 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); // Project card - - $linkback = ''.$langs->trans("BackToList").''; - + + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; // Title $morehtmlref.=$projectstatic->title; // Thirdparty - if ($projectstatic->thirdparty->id > 0) + if ($projectstatic->thirdparty->id > 0) { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; - + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
'; print '
'; print '
'; - + print ''; - + // Visibility print ''; - + // Date start - end print ''; - + // Budget print ''; - + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); $end=dol_print_date($projectstatic->date_end,'day'); if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + // Description print ''; - + // Categories if($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print "
'; - + print '
'; print '
'; print '
'; - + print '
'; - + dol_fiche_end(); print '
'; @@ -430,7 +430,7 @@ if ($id > 0 || ! empty($ref)) * Fiche tache en mode visu */ $param=($withproject?'&withproject=1':''); - $linkback=$withproject?''.$langs->trans("BackToList").'':''; + $linkback=$withproject?''.$langs->trans("BackToList").'':''; dol_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask'); @@ -445,9 +445,9 @@ if ($id > 0 || ! empty($ref)) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - + $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -455,18 +455,18 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=''; } - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - + print '
'; - - print '
'; + + print '
'; print ''; // Date start - Date end @@ -520,9 +520,9 @@ if ($id > 0 || ! empty($ref)) } print '
'; - + print '
'; - + dol_fiche_end(); } @@ -532,7 +532,7 @@ if ($id > 0 || ! empty($ref)) /* * Actions */ - + print '
'; $parameters = array(); @@ -549,7 +549,7 @@ if ($id > 0 || ! empty($ref)) { print ''.$langs->trans('Modify').''; } - + // Delete if ($user->rights->projet->supprimer) { @@ -566,13 +566,13 @@ if ($id > 0 || ! empty($ref)) { print ''.$langs->trans('Delete').''; } - + print '
'; } - + print '
'; print ''; // ancre - + /* * Documents generes */ @@ -587,7 +587,7 @@ if ($id > 0 || ! empty($ref)) print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print '
'; - + print '
'; } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index b4ed0ab2928..ecd15a8aa3b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -190,7 +190,7 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->lire { $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - + $object->timespent_id = $_POST["lineid"]; $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_old_duration = $_POST["old_duration"]; @@ -262,10 +262,10 @@ $projectidforalltimes=0; if (GETPOST('projectid')) { $projectidforalltimes=GETPOST('projectid','int'); - + } - + /* * View */ @@ -292,10 +292,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $res=$projectstatic->fetch_optionals($object->id,$extralabels_projet); - + $object->project = clone $projectstatic; } - + $userWrite = $projectstatic->restrictedProjectArea($user,'write'); if ($projectstatic->id > 0) @@ -310,88 +310,88 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $param=($mode=='mine'?'&mode=mine':''); // Project card - - $linkback = ''.$langs->trans("BackToList").''; - + + $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; // Title $morehtmlref.=$projectstatic->title; // Thirdparty - if ($projectstatic->thirdparty->id > 0) + if ($projectstatic->thirdparty->id > 0) { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; - + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
'; print '
'; print '
'; - + print ''; - + // Visibility print ''; - + // Date start - end print ''; - + // Budget print ''; - + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); $end=dol_print_date($projectstatic->date_end,'day'); if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + // Description print ''; - + // Categories if($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print "
'; - + print '
'; print '
'; print '
'; - + print '
'; dol_fiche_end(); - - + + /* * Actions */ @@ -399,7 +399,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) { print '
'; - + if ($user->rights->projet->all->creer || $user->rights->projet->creer) { if ($object->public || $userWrite > 0) @@ -415,12 +415,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) { print ''.$langs->trans('AddTask').''; } - + print '
'; } } } - + if (empty($projectidforalltimes)) { $head=task_prepare_head($object); @@ -440,9 +440,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - + $morehtmlref=''; - + // Project if (empty($withproject)) { @@ -450,18 +450,18 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.='
'; - + // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=''; } - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); - + print '
'; print '
'; - + print '
'; print ''; @@ -482,12 +482,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - + print '
'; - + print '
'; print ''; - + // Progress declared print ''; print '
'.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; @@ -508,10 +508,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; print ''; - + print ''; print '
'; - + dol_fiche_end(); @@ -583,18 +583,18 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; - + print '
'; } } - + if ($projectstatic->id > 0) - { + { if ($action == 'deleteline') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); } - + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('tasktimelist')); $extrafields = new ExtraFields($db); @@ -619,12 +619,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); } } - + /* * List of time spent */ $tasks = array(); - + $sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,"; $sql .= " pt.ref, pt.label,"; $sql .= " u.lastname, u.firstname, u.login, u.photo"; @@ -638,7 +638,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label); if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); $sql .= $db->order($sortfield, $sortorder); - + $var=true; $resql = $db->query($sql); if ($resql) @@ -668,9 +668,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) dol_print_error($db); } - + $arrayofselected=is_array($toselect)?$toselect:array(); - + $params=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -687,8 +687,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($id) $params.='&id='.$id; if ($projectid) $params.='&projectid='.$projectid; if ($withproject) $params.='&withproject='.$withproject; - - + + $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), @@ -696,9 +696,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) //if ($user->rights->projet->creer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - - + + + print '
'; if ($optioncss != '') print ''; print ''; @@ -708,31 +708,31 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; print ''; print ''; - + print ''; print ''; print ''; $moreforfilter = ''; - + $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; - + if (! empty($moreforfilter)) { print '
'; print $moreforfilter; print '
'; } - + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
'; print ''."\n"; - + // Fields title search print ''; // Date @@ -783,14 +783,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; - print ''."\n"; - + print ''."\n"; + print ''; if (! empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'],$_SERVER['PHP_SELF'],'t.task_date,t.task_datehour,t.rowid','',$params,'',$sortfield,$sortorder); if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task { - if (! empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'],$_SERVER['PHP_SELF'],'pt.ref','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'],$_SERVER['PHP_SELF'],'pt.label','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'],$_SERVER['PHP_SELF'],'pt.ref','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'],$_SERVER['PHP_SELF'],'pt.label','',$params,'',$sortfield,$sortorder); } if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'],$_SERVER['PHP_SELF'],'','',$params,'',$sortfield,$sortorder); if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'],$_SERVER['PHP_SELF'],'t.note','',$params,'',$sortfield,$sortorder); @@ -800,9 +800,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -817,17 +817,17 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print "\n"; $tasktmp = new Task($db); - + $i = 0; $childids = $user->getAllChildIds(); - + $total = 0; $totalvalue = 0; $totalarray=array(); foreach ($tasks as $task_time) { - + print ''; $date1=$db->jdate($task_time->task_date); @@ -858,26 +858,26 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $tasktmp->id = $task_time->fk_task; $tasktmp->ref = $task_time->ref; $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print $tasktmp->getNomUrl(1, 'withproject', 'time'); print ''; if (! $i) $totalarray['nbfield']++; } } - + // Task label if (! empty($arrayfields['t.task_label']['checked'])) { if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task { print ''; if (! $i) $totalarray['nbfield']++; } } - + // User - if (! empty($arrayfields['author']['checked'])) + if (! empty($arrayfields['author']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } - + // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { @@ -940,9 +940,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; $totalarray['totalduration'] += $task_time->task_duration; } - + // Value spent - if (! empty($arrayfields['value']['checked'])) + if (! empty($arrayfields['value']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; - + print "\n"; - + $i++; } - + // Show total line if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield'])) {
'; - print $task_time->label; + print $task_time->label; print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) @@ -907,7 +907,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } // Note - if (! empty($arrayfields['t.note']['checked'])) + if (! empty($arrayfields['t.note']['checked'])) { print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) @@ -921,7 +921,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); @@ -957,7 +957,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + // Action column print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) @@ -975,7 +975,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print 'rowid.($withproject?'&withproject=1':'').'">'; print img_edit(); print ''; - + print ' '; print 'rowid.($withproject?'&withproject=1':'').'">'; print img_delete(); @@ -984,12 +984,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } print '