Fix status of task

This commit is contained in:
Laurent Destailleur 2018-03-06 21:51:43 +01:00
parent 0dfc9af72a
commit 23a4a60970
8 changed files with 56 additions and 35 deletions

View File

@ -1077,11 +1077,12 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
* @param string $morecss More Css
* @return void
*/
function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
{
print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright);
print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright, $morecss);
}
/**
@ -1094,9 +1095,10 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
* @param string $morecss More Css
* @return string
*/
function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
{
global $conf, $langs, $hookmanager;
@ -1161,7 +1163,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
{
if (!empty($links[$i][0]))
{
$out.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$out.='<a class="tabimage'.($morecss?' '.$morecss:'').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
}
else
{
@ -1173,13 +1175,13 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
//print "x $i $active ".$links[$i][2]." z";
if ($isactive)
{
$out.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabactive tab inline-block" href="'.$links[$i][0].'">';
$out.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabactive tab inline-block'.($morecss?' '.$morecss:'').'" href="'.$links[$i][0].'">';
$out.=$links[$i][1];
$out.='</a>'."\n";
}
else
{
$out.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabunactive tab inline-block" href="'.$links[$i][0].'">';
$out.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabunactive tab inline-block'.($morecss?' '.$morecss:'').'" href="'.$links[$i][0].'">';
$out.=$links[$i][1];
$out.='</a>'."\n";
}
@ -1198,14 +1200,14 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
if (isset($links[$i][2]) && $links[$i][2] == 'image')
{
if (!empty($links[$i][0]))
$outmore.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$outmore.='<a class="tabimage'.($morecss?' '.$morecss:'').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
else
$outmore.='<span class="tabspan">'.$links[$i][1].'</span>'."\n";
}
else if (! empty($links[$i][1]))
{
$outmore.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="wordwrap inline-block" href="'.$links[$i][0].'">';
$outmore.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="wordwrap inline-block'.($morecss?' '.$morecss:'').'" href="'.$links[$i][0].'">';
$outmore.=preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts.
$outmore.='</a>'."\n";
}
@ -1489,6 +1491,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->frequency == 0) $morehtmlstatus.=$object->getLibStatut(2);
else $morehtmlstatus.=$object->getLibStatut(5);
}
elseif ($object->element == 'project_task')
{
$object->fk_statut = 1;
if ($object->progress > 0) $object->fk_statut = 2;
if ($object->progress >= 100) $object->fk_statut = 3;
$tmptxt=$object->getLibStatut(5);
$morehtmlstatus.=$tmptxt; // No status on task
}
else { // Generic case
$tmptxt=$object->getLibStatut(6);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);

View File

@ -429,6 +429,9 @@ ActionsOnCompany=Events about this third party
ActionsOnMember=Events about this member
ActionsOnProduct=Events about this product
NActionsLate=%s late
ToDo=To do
Completed=Completed
Running=In progress
RequestAlreadyDone=Request already recorded
Filter=Filter
FilterOnInto=Search criteria '<strong>%s</strong>' into fields %s

View File

@ -1695,7 +1695,7 @@ class Task extends CommonObject
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->fk_statut,$mode);
return $this->LibStatut($this->fk_statut, $mode);
}
/**
@ -1705,18 +1705,18 @@ class Task extends CommonObject
* @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
function LibStatut($statut,$mode=0)
function LibStatut($statut, $mode=0)
{
// list of Statut of the task
$this->statuts[0]='Draft';
$this->statuts[1]='Validated';
$this->statuts[1]='ToDo';
$this->statuts[2]='Running';
$this->statuts[3]='Finish';
$this->statuts[4]='Transfered';
$this->statuts_short[0]='Draft';
$this->statuts_short[1]='Validated';
$this->statuts_short[1]='ToDo';
$this->statuts_short[2]='Running';
$this->statuts_short[3]='Finish';
$this->statuts_short[3]='Completed';
$this->statuts_short[4]='Transfered';
global $langs;
@ -1734,7 +1734,7 @@ class Task extends CommonObject
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts_short[$statut]);
}
@ -1743,7 +1743,7 @@ class Task extends CommonObject
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
}
@ -1752,27 +1752,31 @@ class Task extends CommonObject
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
if ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
}
if ($mode == 6)
{
/*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
if ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');*/
if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
*/
//return $this->progress.' %';
return '&nbsp;';
}
if ($mode == 6)
{
/*if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
if ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
*/
//return $this->progress.' %';
return '&nbsp;';
}

View File

@ -285,7 +285,7 @@ if ($id > 0 || ! empty($ref))
//$arrayofuseridoftask=$object->getListContactId('internal');
$head = task_prepare_head($object);
dol_fiche_head($head, 'task_contact', $langs->trans("Task"), -1, 'projecttask');
dol_fiche_head($head, 'task_contact', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
$param=(GETPOST('withproject')?'&withproject=1':'');

View File

@ -224,7 +224,7 @@ if ($object->id > 0)
}
$head = task_prepare_head($object);
dol_fiche_head($head, 'task_document', $langs->trans("Task"), -1, 'projecttask');
dol_fiche_head($head, 'task_document', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
// Files list constructor
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);

View File

@ -202,7 +202,7 @@ if ($object->id > 0)
}
$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', 0, '', 'reposition');
$param=(GETPOST('withproject')?'&withproject=1':'');

View File

@ -221,7 +221,7 @@ if ($id > 0 || ! empty($ref))
// Tabs for project
$tab='tasks';
$head=project_prepare_head($projectstatic);
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'));
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'), 0, '', '');
$param=($mode=='mine'?'&mode=mine':'');
@ -352,7 +352,7 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
dol_fiche_head($head, 'task_task', $langs->trans("Task"),0,'projecttask');
dol_fiche_head($head, 'task_task', $langs->trans("Task"), 0, 'projecttask', 0, '', '');
print '<table class="border" width="100%">';
@ -437,7 +437,7 @@ if ($id > 0 || ! empty($ref))
$param=($withproject?'&withproject=1':'');
$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', 0, '', 'reposition');
if ($action == 'delete')
{

View File

@ -434,7 +434,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if (empty($projectidforalltimes))
{
$head=task_prepare_head($object);
dol_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask');
dol_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
if ($action == 'deleteline')
{
@ -541,6 +541,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
@ -595,7 +596,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></tr>';
print '</table></form>';
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}