diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index a1b93cb0280..eb71bf3a049 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -457,6 +457,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$taskstatic->progress = $lines[$i]->progress;
$taskstatic->fk_statut = $lines[$i]->status;
$taskstatic->datee = $lines[$i]->date_end;
+ $taskstatic->planned_workload= $lines[$i]->planned_workload;
+ $taskstatic->duration_effective= $lines[$i]->duration;
+
if ($showproject)
{
@@ -556,10 +559,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '
';
if ($lines[$i]->progress != '')
{
- print $lines[$i]->progress.' %';
+ print getTaskProgressBadge($taskstatic);
}
print ' | ';
+ // resume
+ print '';
+ print getTaskProgressView($taskstatic, false, false);
+ print ' | ';
+
if ($showbilltime)
{
// Time not billed
@@ -1943,3 +1951,141 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '';
}
}
+
+/**
+ * @param $task Task
+ * @param $label string|bool true = auto, false = dont display, string = replace output
+ * @param $progressNumber string|bool true = auto, false = dont display, string = replace output
+ * @return string
+ */
+function getTaskProgressView($task, $label = true, $progressNumber = true)
+{
+ global $langs, $conf;
+
+ $out = '';
+
+ $plannedworkloadoutputformat='allhourmin';
+ $timespentoutputformat='allhourmin';
+ if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
+ if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT;
+
+
+
+ if ($task->progress != '')
+ {
+
+ // define progress color according to time spend vs workload
+ $progressBarClass = 'progress-bar-info';
+ if ($task->planned_workload){
+ $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 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;
+
+ if($progressCalculated > doubleval($task->progress)){
+ $progressBarClass = 'progress-bar-danger';
+ }
+ elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
+ $progressBarClass = 'progress-bar-warning';
+ }
+ else{
+ $progressBarClass = 'progress-bar-success';
+ }
+ }
+
+ $out.= '';
+
+ if($label !== false)
+ {
+ $out.= '
';
+ if ($task->hasDelay()) $out.= img_warning($langs->trans("Late")).' ';
+ if($label!==true){
+ $out.= $label; // replace label by param
+ }
+ else{
+ $out.= $task->label;
+ }
+ $out.= ' ';
+ }
+
+
+ if($progressNumber !== false)
+ {
+ $out.= '
';
+
+ if($progressNumber!==true){
+ $out.= $progressNumber; // replace label by param
+ }
+ else{
+ $out.= '';
+ if ($task->duration_effective) $out.= convertSecondToTime($task->duration_effective, $timespentoutputformat);
+ else $out.= '--:--';
+ $out.= '';
+
+ $out.= '/';
+
+ $out.= '';
+ if ($task->planned_workload) $out.= convertSecondToTime($task->planned_workload, $plannedworkloadoutputformat);
+ else $out.= '--:--';
+ }
+
+ $out.= ' ';
+ }
+
+
+
+ $out.= '';
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+
+ }
+
+ return $out;
+}
+/**
+ * @param $task Task
+ * @param $label string empty = auto (progress), string = replace output
+ * @param $tooltip string empty = auto , string = replace output
+ * @return string
+ */
+function getTaskProgressBadge($task, $label = '', $tooltip = '')
+{
+ global $conf;
+
+ $out = '';
+
+ $badgeColorClass = '';
+ if ($task->progress != '')
+ {
+ // define color according to time spend vs workload
+ $badgeColorClass = 'badge ';
+ if ($task->planned_workload){
+ $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 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;
+
+ if($progressCalculated > doubleval($task->progress)){
+ $badgeColorClass.= 'badge-danger';
+ }
+ elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
+ $badgeColorClass.= 'badge-warning';
+ }
+ else{
+ $badgeColorClass.= 'badge-success';
+ }
+ }
+ }
+
+ if(empty($label)){
+ $label = $task->progress.' %';
+ }
+
+ if(!empty($label)){
+ $out = ''.$label.'';
+ }
+
+ return $out;
+}
\ No newline at end of file
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index ca9a1e2452f..0a33da9a5f0 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -76,6 +76,7 @@ MyProjects=My projects
MyProjectsArea=My projects Area
DurationEffective=Effective duration
ProgressDeclared=Declared progress
+TaskProgressSummary=Task progress
ProgressCalculated=Calculated progress
Time=Time
ListOfTasks=List of tasks
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index b8ac9fb7e02..b1b802ee25c 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -746,9 +746,12 @@ elseif ($id > 0 || ! empty($ref))
print '';
print '';
- print '';
- print '';
- print ' | ';
+ print '';
+ print '';
+ print ' | ';
+
+ // progress resume not searchable
+ print ' | ';
if ($object->bill_time)
{
@@ -778,6 +781,7 @@ elseif ($id > 0 || ! empty($ref))
print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
if ($object->bill_time)
{
print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index d0a0c5958ef..77ea51237d0 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -405,6 +405,16 @@ textarea.centpercent {
.small, small {
font-size: 85%;
}
+
+.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small {
+ font-size: 65%;
+}
+.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small {
+ font-weight: 400;
+ line-height: 1;
+ color: #777;
+}
+
.center {
text-align: center;
margin: 0px auto;
@@ -5750,3 +5760,5 @@ div.tabsElem a.tab {
+/*