Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/projet/tasks/time.php
This commit is contained in:
commit
8352f64474
@ -153,7 +153,7 @@ PlannedWorkload=Planned workload
|
|||||||
PlannedWorkloadShort=Workload
|
PlannedWorkloadShort=Workload
|
||||||
ProjectReferers=Related items
|
ProjectReferers=Related items
|
||||||
ProjectMustBeValidatedFirst=Project must be validated first
|
ProjectMustBeValidatedFirst=Project must be validated first
|
||||||
FirstAddRessourceToAllocateTime=Associate a resource to allocate time
|
FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
|
||||||
InputPerDay=Input per day
|
InputPerDay=Input per day
|
||||||
InputPerWeek=Input per week
|
InputPerWeek=Input per week
|
||||||
InputPerAction=Input per action
|
InputPerAction=Input per action
|
||||||
|
|||||||
@ -347,7 +347,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print dol_print_date($projectstatic->date_end,'day');
|
print dol_print_date($projectstatic->date_end,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (! $id && ! $ref) // Not a dedicated task
|
if ((! $id && ! $ref) || ! empty($projectidforalltimes)) // Not a dedicated task
|
||||||
{
|
{
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||||
@ -371,7 +371,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if (empty($id) && empty($ref))
|
|
||||||
|
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
@ -563,7 +564,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
$arrayfields=array();
|
$arrayfields=array();
|
||||||
$arrayfields['t.task_date']=array('label'=>$langs->trans("Date"), 'checked'=>1);
|
$arrayfields['t.task_date']=array('label'=>$langs->trans("Date"), 'checked'=>1);
|
||||||
if (! $id && ! $ref) // Not a dedicated task
|
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task
|
||||||
{
|
{
|
||||||
$arrayfields['t.task_ref']=array('label'=>$langs->trans("Task"), 'checked'=>1);
|
$arrayfields['t.task_ref']=array('label'=>$langs->trans("Task"), 'checked'=>1);
|
||||||
}
|
}
|
||||||
@ -591,8 +592,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||||
if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id;
|
if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id;
|
||||||
|
else $sql.= " AND pt.fk_projet IN (".$projectidforalltimes.")";
|
||||||
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
||||||
|
if ($search_note) $sql .= natural_search('t.note', $search_note);
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -640,7 +642,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
}*/
|
}*/
|
||||||
if ($projectstatic->id) $params.='&projectid='.$projectstatic->id;
|
if ($id) $params.='&id='.$id;
|
||||||
|
if ($projectid) $params.='&projectid='.$projectid;
|
||||||
if ($withproject) $params.='&withproject='.$withproject;
|
if ($withproject) $params.='&withproject='.$withproject;
|
||||||
|
|
||||||
|
|
||||||
@ -658,7 +661,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
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'].'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
if ($action == 'editline') print '<input type="hidden" name="action" value="updateline">';
|
||||||
|
else print '<input type="hidden" name="action" value="list">';
|
||||||
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.'">';
|
||||||
|
|
||||||
@ -687,7 +691,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
|
|
||||||
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 (! $id && ! $ref) // 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);
|
||||||
}
|
}
|
||||||
@ -719,7 +723,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
// LIST_OF_TD_TITLE_SEARCH
|
// LIST_OF_TD_TITLE_SEARCH
|
||||||
if (! empty($arrayfields['t.task_date']['checked'])) print '<td class="liste_titre"></td>';
|
if (! empty($arrayfields['t.task_date']['checked'])) print '<td class="liste_titre"></td>';
|
||||||
if (! $id && ! $ref) // Not a dedicated task
|
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields['t.task_ref']['checked'])) print '<td class="liste_titre"></td>';
|
if (! empty($arrayfields['t.task_ref']['checked'])) print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
@ -764,8 +768,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
|
|
||||||
$tasktmp = new Task($db);
|
$tasktmp = new Task($db);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$totalvalue = 0;
|
$totalvalue = 0;
|
||||||
|
$totalarray=array();
|
||||||
foreach ($tasks as $task_time)
|
foreach ($tasks as $task_time)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -787,12 +793,13 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print dol_print_date(($date2?$date2:$date1),($task_time->task_date_withhour?'dayhour':'day'));
|
print dol_print_date(($date2?$date2:$date1),($task_time->task_date_withhour?'dayhour':'day'));
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task
|
// Task
|
||||||
if (! empty($arrayfields['t.task_ref']['checked']))
|
if (! empty($arrayfields['t.task_ref']['checked']))
|
||||||
{
|
{
|
||||||
if (! $id && ! $ref) // Not a dedicated task
|
if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$tasktmp->id = $task_time->fk_task;
|
$tasktmp->id = $task_time->fk_task;
|
||||||
@ -800,6 +807,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
$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']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,6 +837,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print $userstatic->getNomUrl(1);
|
print $userstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
@ -844,6 +853,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print dol_nl2br($task_time->note);
|
print dol_nl2br($task_time->note);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time spent
|
// Time spent
|
||||||
@ -860,15 +870,22 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print convertSecondToTime($task_time->task_duration,'allhourmin');
|
print convertSecondToTime($task_time->task_duration,'allhourmin');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
|
||||||
|
$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">';
|
||||||
print price(price2num($task_time->thm * $task_time->task_duration / 3600), 1, $langs, 1, -1, -1, $conf->currency);
|
$value = price2num($task_time->thm * $task_time->task_duration / 3600);
|
||||||
|
print price($value, 1, $langs, 1, -1, -1, $conf->currency);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalvaluefield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totalvalue'] += $value;
|
||||||
|
}
|
||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
@ -896,20 +913,34 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$total += $task_time->task_duration;
|
|
||||||
$totalvalue += price2num($task_time->thm * $task_time->task_duration / 3600);
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
// Show total line
|
||||||
print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total,'allhourmin').'</td>';
|
if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield']))
|
||||||
if ($conf->salaries->enabled)
|
|
||||||
{
|
{
|
||||||
print '<td align="right">'.price($totalvalue, 1, $langs, 1, -1, -1, $conf->currency).'</td>';
|
print '<tr class="liste_total">';
|
||||||
|
$i=0;
|
||||||
|
while ($i < $totalarray['nbfield'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
elseif ($totalarray['totaldurationfield'] == $i) print '<td align="right">'.convertSecondToTime($totalarray['totalduration'],'allhourmin').'</td>';
|
||||||
|
elseif ($totalarray['totalvaluefield'] == $i) print '<td align="right">'.price($totalarray['totalvalue']).'</td>';
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user