Fix restore of last_search_value ko

This commit is contained in:
Laurent Destailleur 2017-06-07 10:55:39 +02:00
parent 0486a18972
commit 0805c693ae
6 changed files with 242 additions and 237 deletions

View File

@ -36,7 +36,7 @@ class Task extends CommonObject
public $fk_element='fk_task'; public $fk_element='fk_task';
public $picto = 'task'; public $picto = 'task';
protected $childtables=array('projet_task_time'); // To test if we can delete object protected $childtables=array('projet_task_time'); // To test if we can delete object
var $fk_task_parent; var $fk_task_parent;
var $label; var $label;
var $description; var $description;
@ -59,7 +59,7 @@ class Task extends CommonObject
var $timespent_nblinesnull; var $timespent_nblinesnull;
var $timespent_nblines; var $timespent_nblines;
// For detail of lines of timespent record, there is the property ->lines in common // For detail of lines of timespent record, there is the property ->lines in common
// Var used to call method addTimeSpent(). Bad practice. // Var used to call method addTimeSpent(). Bad practice.
var $timespent_id; var $timespent_id;
var $timespent_duration; var $timespent_duration;
@ -100,7 +100,7 @@ class Task extends CommonObject
// Clean parameters // Clean parameters
$this->label = trim($this->label); $this->label = trim($this->label);
$this->description = trim($this->description); $this->description = trim($this->description);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -226,7 +226,7 @@ class Task extends CommonObject
if ($resql) if ($resql)
{ {
$num_rows = $this->db->num_rows($resql); $num_rows = $this->db->num_rows($resql);
if ($num_rows) if ($num_rows)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -409,7 +409,7 @@ class Task extends CommonObject
$this->db->rollback(); $this->db->rollback();
return 0; return 0;
} }
if (! $error) if (! $error)
{ {
// Delete linked contacts // Delete linked contacts
@ -534,7 +534,7 @@ class Task extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Return nb of time spent * 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 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 string $sep Separator between ref and label if option addlabel is set
* @param int $notooltip 1=Disable tooltip * @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 * @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; global $conf, $langs, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowTask") . '</u>'; $label = '<u>' . $langs->trans("ShowTask") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
@ -597,8 +598,12 @@ class Task extends CommonObject
{ {
$label .= "<br>".get_date_range($this->date_start,$this->date_end,'',$langs,0); $label .= "<br>".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':''); $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 = ''; $linkclose = '';
if (empty($notooltip)) if (empty($notooltip))
@ -611,11 +616,11 @@ class Task extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"'; $linkclose.=' class="classfortooltip"';
} }
$linkstart = '<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
$picto='projecttask'; $picto='projecttask';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); 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."element_contact as ec2";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; $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"; $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_start = $this->db->jdate($obj->date_start);
$tasks[$i]->date_end = $this->db->jdate($obj->date_end); $tasks[$i]->date_end = $this->db->jdate($obj->date_end);
$tasks[$i]->rang = $obj->rang; $tasks[$i]->rang = $obj->rang;
$tasks[$i]->thirdparty_id = $obj->thirdparty_id; $tasks[$i]->thirdparty_id = $obj->thirdparty_id;
$tasks[$i]->thirdparty_name = $obj->thirdparty_name; $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"); $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
$ret = $tasktime_id; $ret = $tasktime_id;
$this->timespent_id = $ret; $this->timespent_id = $ret;
if (! $notrigger) if (! $notrigger)
{ {
// Call trigger // Call trigger
@ -1027,10 +1032,10 @@ class Task extends CommonObject
global $langs; global $langs;
$id=$this->id; $id=$this->id;
if (empty($id)) if (empty($id))
{ {
dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR); dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR);
return -1; return -1;
} }
$result=array(); $result=array();
@ -1045,7 +1050,7 @@ class Task extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.fk_task = ".$id; $sql.= " WHERE t.fk_task = ".$id;
if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; if ($userid > 0) $sql.=" AND t.fk_user = ".$userid;
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -1055,14 +1060,14 @@ class Task extends CommonObject
$result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead $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['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead
$result['total_duration'] = $obj->total_duration; // 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_min_date=$this->db->jdate($obj->min_date);
$this->timespent_max_date=$this->db->jdate($obj->max_date); $this->timespent_max_date=$this->db->jdate($obj->max_date);
$this->timespent_total_duration=$obj->total_duration; $this->timespent_total_duration=$obj->total_duration;
$this->timespent_total_amount=$obj->total_amount; $this->timespent_total_amount=$obj->total_amount;
$this->timespent_nblinesnull=($obj->nblinesnull?$obj->nblinesnull:0); $this->timespent_nblinesnull=($obj->nblinesnull?$obj->nblinesnull:0);
$this->timespent_nblines=($obj->nblines?$obj->nblines:0); $this->timespent_nblines=($obj->nblines?$obj->nblines:0);
$this->db->free($resql); $this->db->free($resql);
} }
else else
@ -1357,7 +1362,7 @@ class Task extends CommonObject
$clone_task->fetch($fromid); $clone_task->fetch($fromid);
$clone_task->fetch_optionals(); $clone_task->fetch_optionals();
//var_dump($clone_task->array_options);exit; //var_dump($clone_task->array_options);exit;
$origin_task->fetch($fromid); $origin_task->fetch($fromid);
$defaultref=''; $defaultref='';
@ -1680,7 +1685,7 @@ class Task extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
@ -1690,12 +1695,12 @@ class Task extends CommonObject
function load_board($user) function load_board($user)
{ {
global $conf, $langs; global $conf, $langs;
$mine=0; $socid=$user->societe_id; $mine=0; $socid=$user->societe_id;
$projectstatic = new Project($this->db); $projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// List of tasks (does not care about permissions. Filtering will be done later) // 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 = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
@ -1718,29 +1723,29 @@ class Task extends CommonObject
if ($resql) if ($resql)
{ {
$task_static = new Task($this->db); $task_static = new Task($this->db);
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24; $response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
$response->label = $langs->trans("OpenedTasks"); $response->label = $langs->trans("OpenedTasks");
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project'; 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&amp;mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&amp;mainmenu=project';
$response->img = img_object('',"task"); $response->img = img_object('',"task");
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
$task_static->projectstatus = $obj->projectstatus; $task_static->projectstatus = $obj->projectstatus;
$task_static->progress = $obj->progress; $task_static->progress = $obj->progress;
$task_static->fk_statut = $obj->status; $task_static->fk_statut = $obj->status;
$task_static->date_end = $this->db->jdate($obj->datee); $task_static->date_end = $this->db->jdate($obj->datee);
if ($task_static->hasDelay()) { if ($task_static->hasDelay()) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
return $response; return $response;
} }
else else
@ -1749,7 +1754,7 @@ class Task extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Is the task delayed? * Is the task delayed?
* *
@ -1758,7 +1763,7 @@ class Task extends CommonObject
public function hasDelay() public function hasDelay()
{ {
global $conf; global $conf;
if (! ($this->progress >= 0 && $this->progress < 100)) { if (! ($this->progress >= 0 && $this->progress < 100)) {
return false; return false;
} }
@ -1768,5 +1773,5 @@ class Task extends CommonObject
$datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0); $datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0);
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
} }
} }

View File

@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id, $ref) > 0) if ($object->fetch($id, $ref) > 0)
{ {
$id = $object->id; // So when doing a search from ref, id is also set correctly. $id = $object->id; // So when doing a search from ref, id is also set correctly.
$result=$projectstatic->fetch($object->fk_project); $result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
@ -192,83 +192,83 @@ if ($id > 0 || ! empty($ref))
$param=($mode=='mine'?'&mode=mine':''); $param=($mode=='mine'?'&mode=mine':'');
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
$morehtmlref.=$projectstatic->title; $morehtmlref.=$projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) if ($projectstatic->thirdparty->id > 0)
{ {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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); dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject'); if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Date start - end // Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day'); print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day'); $end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end; if ($end) print ' - '.$end;
print '</td></tr>'; print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1); print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
@ -284,16 +284,16 @@ if ($id > 0 || ! empty($ref))
$param=(GETPOST('withproject')?'&withproject=1':''); $param=(GETPOST('withproject')?'&withproject=1':'');
$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':''; $linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
if (! GETPOST('withproject') || empty($projectstatic->id)) if (! GETPOST('withproject') || empty($projectstatic->id))
{ {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref=''; $morehtmlref='';
// Project // Project
if (empty($withproject)) if (empty($withproject))
{ {
@ -301,13 +301,13 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1);
dol_fiche_end(); dol_fiche_end();
@ -385,7 +385,7 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'; print '<td class="nowrap">';

View File

@ -136,84 +136,84 @@ if ($object->id > 0)
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
$morehtmlref.=$projectstatic->title; $morehtmlref.=$projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) if ($projectstatic->thirdparty->id > 0)
{ {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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); dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject'); if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Date start - end // Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day'); print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day'); $end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end; if ($end) print ' - '.$end;
print '</td></tr>'; print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1); print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
} }
@ -227,7 +227,7 @@ if ($object->id > 0)
{ {
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
$param=(GETPOST('withproject')?'&withproject=1':''); $param=(GETPOST('withproject')?'&withproject=1':'');
$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':''; $linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
@ -237,9 +237,9 @@ if ($object->id > 0)
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref=''; $morehtmlref='';
// Project // Project
if (empty($withproject)) if (empty($withproject))
{ {
@ -247,17 +247,17 @@ if ($object->id > 0)
$morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -268,7 +268,7 @@ if ($object->id > 0)
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<br>'; print '<br>';

View File

@ -114,9 +114,9 @@ if ($object->id > 0)
$param=($mode=='mine'?'&mode=mine':''); $param=($mode=='mine'?'&mode=mine':'');
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
$morehtmlref.=$projectstatic->title; $morehtmlref.=$projectstatic->title;
@ -126,92 +126,92 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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); dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject'); if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Date start - end // Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day'); print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day'); $end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end; if ($end) print ' - '.$end;
print '</td></tr>'; print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1); print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
} }
$head = task_prepare_head($object); $head = task_prepare_head($object);
dol_fiche_head($head, 'task_notes', $langs->trans('Task'), -1, 'projecttask'); dol_fiche_head($head, 'task_notes', $langs->trans('Task'), -1, 'projecttask');
$param=(GETPOST('withproject')?'&withproject=1':''); $param=(GETPOST('withproject')?'&withproject=1':'');
$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':''; $linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
if (! GETPOST('withproject') || empty($projectstatic->id)) if (! GETPOST('withproject') || empty($projectstatic->id))
{ {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref=''; $morehtmlref='';
// Project // Project
if (empty($withproject)) if (empty($withproject))
{ {
@ -219,17 +219,17 @@ if ($object->id > 0)
$morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
$cssclass='titlefield'; $cssclass='titlefield';
@ -237,7 +237,7 @@ if ($object->id > 0)
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
} }

View File

@ -226,85 +226,85 @@ if ($id > 0 || ! empty($ref))
$param=($mode=='mine'?'&mode=mine':''); $param=($mode=='mine'?'&mode=mine':'');
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
$morehtmlref.=$projectstatic->title; $morehtmlref.=$projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) if ($projectstatic->thirdparty->id > 0)
{ {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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); dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject'); if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Date start - end // Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day'); print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day'); $end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end; if ($end) print ' - '.$end;
print '</td></tr>'; print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1); print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
print '<br>'; print '<br>';
@ -430,7 +430,7 @@ if ($id > 0 || ! empty($ref))
* Fiche tache en mode visu * Fiche tache en mode visu
*/ */
$param=($withproject?'&withproject=1':''); $param=($withproject?'&withproject=1':'');
$linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':''; $linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>':'';
dol_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask'); 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.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref=''; $morehtmlref='';
// Project // Project
if (empty($withproject)) if (empty($withproject))
{ {
@ -455,18 +455,18 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Date start - Date end // Date start - Date end
@ -520,9 +520,9 @@ if ($id > 0 || ! empty($ref))
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
} }
@ -532,7 +532,7 @@ if ($id > 0 || ! empty($ref))
/* /*
* Actions * Actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
$parameters = array(); $parameters = array();
@ -549,7 +549,7 @@ if ($id > 0 || ! empty($ref))
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>'; print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
} }
// Delete // Delete
if ($user->rights->projet->supprimer) if ($user->rights->projet->supprimer)
{ {
@ -566,13 +566,13 @@ if ($id > 0 || ! empty($ref))
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
} }
print '</div>'; print '</div>';
} }
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
/* /*
* Documents generes * Documents generes
*/ */
@ -587,7 +587,7 @@ if ($id > 0 || ! empty($ref))
print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div></div></div>'; print '</div></div></div>';
} }
} }

View File

@ -190,7 +190,7 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->lire
{ {
$object->fetch($id, $ref); $object->fetch($id, $ref);
// TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$object->timespent_id = $_POST["lineid"]; $object->timespent_id = $_POST["lineid"];
$object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_note = $_POST["timespent_note_line"];
$object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_old_duration = $_POST["old_duration"];
@ -262,10 +262,10 @@ $projectidforalltimes=0;
if (GETPOST('projectid')) if (GETPOST('projectid'))
{ {
$projectidforalltimes=GETPOST('projectid','int'); $projectidforalltimes=GETPOST('projectid','int');
} }
/* /*
* View * View
*/ */
@ -292,10 +292,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$result=$projectstatic->fetch($object->fk_project); $result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
$res=$projectstatic->fetch_optionals($object->id,$extralabels_projet); $res=$projectstatic->fetch_optionals($object->id,$extralabels_projet);
$object->project = clone $projectstatic; $object->project = clone $projectstatic;
} }
$userWrite = $projectstatic->restrictedProjectArea($user,'write'); $userWrite = $projectstatic->restrictedProjectArea($user,'write');
if ($projectstatic->id > 0) if ($projectstatic->id > 0)
@ -310,88 +310,88 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$param=($mode=='mine'?'&mode=mine':''); $param=($mode=='mine'?'&mode=mine':'');
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
$morehtmlref.=$projectstatic->title; $morehtmlref.=$projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) if ($projectstatic->thirdparty->id > 0)
{ {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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); dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject'); if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Date start - end // Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($projectstatic->date_start,'day'); print dol_print_date($projectstatic->date_start,'day');
$end=dol_print_date($projectstatic->date_end,'day'); $end=dol_print_date($projectstatic->date_end,'day');
if ($end) print ' - '.$end; if ($end) print ' - '.$end;
print '</td></tr>'; print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id,'project',1); print $form->showCategories($projectstatic->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
/* /*
* Actions * Actions
*/ */
@ -399,7 +399,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->projet->all->creer || $user->rights->projet->creer) if ($user->rights->projet->all->creer || $user->rights->projet->creer)
{ {
if ($object->public || $userWrite > 0) if ($object->public || $userWrite > 0)
@ -415,12 +415,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>'; print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
} }
print '</div>'; print '</div>';
} }
} }
} }
if (empty($projectidforalltimes)) if (empty($projectidforalltimes))
{ {
$head=task_prepare_head($object); $head=task_prepare_head($object);
@ -440,9 +440,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref=''; $morehtmlref='';
// Project // Project
if (empty($withproject)) if (empty($withproject))
{ {
@ -450,18 +450,18 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$morehtmlref.=$langs->trans("Project").': '; $morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1); $morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -482,12 +482,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">'; print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Progress declared // Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>'; print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
print $object->progress.' %'; print $object->progress.' %';
@ -508,10 +508,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
@ -583,18 +583,18 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '</td></tr>'; print '</td></tr>';
print '</table></form>'; print '</table></form>';
print '<br>'; print '<br>';
} }
} }
if ($projectstatic->id > 0) if ($projectstatic->id > 0)
{ {
if ($action == 'deleteline') 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); 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 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('tasktimelist')); $hookmanager->initHooks(array('tasktimelist'));
$extrafields = new ExtraFields($db); $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]); $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 * List of time spent
*/ */
$tasks = array(); $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 = "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 .= " pt.ref, pt.label,";
$sql .= " u.lastname, u.firstname, u.login, u.photo"; $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_task_label) $sql .= natural_search('pt.label', $search_task_label);
if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user);
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$var=true; $var=true;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -668,9 +668,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
dol_print_error($db); dol_print_error($db);
} }
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$params=''; $params='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@ -687,8 +687,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if ($id) $params.='&amp;id='.$id; if ($id) $params.='&amp;id='.$id;
if ($projectid) $params.='&amp;projectid='.$projectid; if ($projectid) $params.='&amp;projectid='.$projectid;
if ($withproject) $params.='&amp;withproject='.$withproject; if ($withproject) $params.='&amp;withproject='.$withproject;
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'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 ($user->rights->projet->creer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -708,31 +708,31 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">'; print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">'; print '<input type="hidden" name="withproject" value="'.$withproject.'">';
$moreforfilter = ''; $moreforfilter = '';
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter; print $moreforfilter;
print '</div>'; print '</div>';
} }
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Fields title search // Fields title search
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Date // Date
@ -783,14 +783,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
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($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($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_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_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['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); 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)) 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); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); 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 "</tr>\n"; print "</tr>\n";
$tasktmp = new Task($db); $tasktmp = new Task($db);
$i = 0; $i = 0;
$childids = $user->getAllChildIds(); $childids = $user->getAllChildIds();
$total = 0; $total = 0;
$totalvalue = 0; $totalvalue = 0;
$totalarray=array(); $totalarray=array();
foreach ($tasks as $task_time) foreach ($tasks as $task_time)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$date1=$db->jdate($task_time->task_date); $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->id = $task_time->fk_task;
$tasktmp->ref = $task_time->ref; $tasktmp->ref = $task_time->ref;
$tasktmp->label = $task_time->label; $tasktmp->label = $task_time->label;
print $tasktmp->getNomUrl(1, 'withproject', 'time'); print $tasktmp->getNomUrl(1, 'withproject', 'time');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
} }
// Task label // Task label
if (! empty($arrayfields['t.task_label']['checked'])) if (! empty($arrayfields['t.task_label']['checked']))
{ {
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print $task_time->label; print $task_time->label;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
} }
// User // User
if (! empty($arrayfields['author']['checked'])) if (! empty($arrayfields['author']['checked']))
{ {
print '<td>'; print '<td>';
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
@ -907,7 +907,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
} }
// Note // Note
if (! empty($arrayfields['t.note']['checked'])) if (! empty($arrayfields['t.note']['checked']))
{ {
print '<td align="left">'; print '<td align="left">';
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
@ -921,7 +921,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Time spent // Time spent
if (! empty($arrayfields['t.task_duration']['checked'])) if (! empty($arrayfields['t.task_duration']['checked']))
{ {
@ -940,9 +940,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration'] += $task_time->task_duration; $totalarray['totalduration'] += $task_time->task_duration;
} }
// Value spent // Value spent
if (! empty($arrayfields['value']['checked'])) if (! empty($arrayfields['value']['checked']))
{ {
print '<td align="right">'; print '<td align="right">';
$value = price2num($task_time->thm * $task_time->task_duration / 3600); $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); $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="center"">'; print '<td class="center"">';
if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid)
@ -975,7 +975,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&amp;':'').'id='.$task_time->fk_task.'&amp;action=editline&amp;lineid='.$task_time->rowid.($withproject?'&amp;withproject=1':'').'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&amp;':'').'id='.$task_time->fk_task.'&amp;action=editline&amp;lineid='.$task_time->rowid.($withproject?'&amp;withproject=1':'').'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&amp;':'').'id='.$task_time->fk_task.'&amp;action=deleteline&amp;lineid='.$task_time->rowid.($withproject?'&amp;withproject=1':'').'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&amp;':'').'id='.$task_time->fk_task.'&amp;action=deleteline&amp;lineid='.$task_time->rowid.($withproject?'&amp;withproject=1':'').'">';
print img_delete(); print img_delete();
@ -984,12 +984,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// Show total line // Show total line
if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield'])) if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield']))
{ {