Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0466ee1941
@ -156,6 +156,8 @@ class box_task extends ModeleBoxes
|
||||
$sql.= " pt.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
|
||||
$sql.= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
|
||||
$sql.= " AND p.usage_task = 1 ";
|
||||
|
||||
|
||||
$sql.= " ORDER BY pt.datee ASC, pt.dateo ASC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -565,7 +565,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
// resume
|
||||
print '<td class="right">';
|
||||
print getTaskProgressView($taskstatic, false, false);
|
||||
if ($lines[$i]->progress != '' && $lines[$i]->duration) {
|
||||
print getTaskProgressView($taskstatic, false, false);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($showbilltime)
|
||||
@ -664,12 +666,48 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
||||
if ($projectidfortotallink > 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
if ($total_projectlinesa_planned) {
|
||||
$totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
|
||||
$totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
|
||||
// define progress color according to time spend vs workload
|
||||
$progressBarClass = 'progress-bar-info';
|
||||
$badgeClass = 'badge ';
|
||||
|
||||
if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
|
||||
$progressBarClass = 'progress-bar-danger';
|
||||
$badgeClass.= 'badge-danger';
|
||||
} elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) { // warning if close at 1%
|
||||
$progressBarClass = 'progress-bar-warning';
|
||||
$badgeClass.= 'badge-warning';
|
||||
} else {
|
||||
$progressBarClass = 'progress-bar-success';
|
||||
$badgeClass.= 'badge-success';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="nowrap liste_total right">';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %';
|
||||
if ($total_projectlinesa_planned) print $totalCalculatedProgress.' %';
|
||||
print '</td>';
|
||||
print '<td class="nowrap liste_total right">';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2).' %';
|
||||
if ($total_projectlinesa_planned) print '<span class="'.$badgeClass.'" >'.$totalAverageDeclaredProgress.' %</span>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// resume
|
||||
print '<td class="right">';
|
||||
if ($total_projectlinesa_planned){
|
||||
print '</span>';
|
||||
print ' <div class="progress sm" title="'.$totalAverageDeclaredProgress.'%" >';
|
||||
print ' <div class="progress-bar '.$progressBarClass.'" style="width: '.$totalAverageDeclaredProgress.'%"></div>';
|
||||
print ' </div>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($showbilltime)
|
||||
{
|
||||
print '<td class="nowrap liste_total right">';
|
||||
|
||||
@ -121,6 +121,7 @@ $arrayfields=array(
|
||||
't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103),
|
||||
't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104),
|
||||
't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105),
|
||||
't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>106),
|
||||
't.tobill'=>array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>110),
|
||||
't.billed'=>array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>111),
|
||||
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
@ -570,6 +571,7 @@ if (! empty($arrayfields['t.planned_workload']['checked'])) print '<td class="li
|
||||
if (! empty($arrayfields['t.duration_effective']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['t.progress']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['t.progress_summary']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['t.tobill']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['t.billed']['checked'])) print '<td class="liste_titre"></td>';
|
||||
// Extra fields
|
||||
@ -610,6 +612,7 @@ if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_
|
||||
if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
|
||||
if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.progress_summary']['checked'])) print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.billed']['checked'])) print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
@ -642,6 +645,9 @@ while ($i < min($num, $limit))
|
||||
$object->progress = $obj->progress;
|
||||
$object->datee = $db->jdate($obj->date_end); // deprecated
|
||||
$object->date_end = $db->jdate($obj->date_end);
|
||||
$object->planned_workload= $obj->planned_workload;
|
||||
$object->duration_effective= $obj->duration_effective;
|
||||
|
||||
|
||||
$projectstatic->id = $obj->projectid;
|
||||
$projectstatic->ref = $obj->projectref;
|
||||
@ -784,12 +790,23 @@ while ($i < min($num, $limit))
|
||||
print '<td class="center">';
|
||||
if ($obj->progress != '')
|
||||
{
|
||||
print $obj->progress.' %';
|
||||
print getTaskProgressBadge($object);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalprogress_declaredfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
|
||||
}
|
||||
// Progress summary
|
||||
if (! empty($arrayfields['t.progress_summary']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if($obj->progress != '' && $obj->duration_effective){
|
||||
print getTaskProgressView($object, false, false);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalprogress_summary']=$totalarray['nbfield'];
|
||||
}
|
||||
// Time not billed
|
||||
if (! empty($arrayfields['t.tobill']['checked']))
|
||||
@ -891,7 +908,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
|
||||
elseif ($totalarray['totalprogress_declaredfield'] == $i) print '<td class="center">'.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationdeclared'] / $totalarray['totalplannedworkload'], 2).' %' : '').'</td>';
|
||||
elseif ($totalarray['totaltobillfield'] == $i) print '<td class="center">'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).'</td>';
|
||||
elseif ($totalarray['totalbilledfield'] == $i) print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
|
||||
else print '<td></td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user