From fa5cda2e883cff38134726c13c6176a7c721d3af Mon Sep 17 00:00:00 2001 From: ATM john Date: Sun, 8 Sep 2019 18:03:14 +0200 Subject: [PATCH 1/2] Fix missing total progress column --- htdocs/core/lib/project.lib.php | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 19d89c6799b..5e9d05057be 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -664,12 +664,48 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); if ($projectidfortotallink > 0) print ''; print ''; + + 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 ''; - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; + if ($total_projectlinesa_planned) print $totalCalculatedProgress.' %'; print ''; print ''; - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2).' %'; + if ($total_projectlinesa_planned) print ''.$totalAverageDeclaredProgress.' %'; print ''; + + + // resume + print ''; + if ($total_projectlinesa_planned){ + print ''; + print '
'; + print '
'; + print '
'; + print ''; + } + print ''; + if ($showbilltime) { print ''; From a639724b923cdb13f2b07c4579dd64823696d37d Mon Sep 17 00:00:00 2001 From: ATM john Date: Sun, 8 Sep 2019 18:13:15 +0200 Subject: [PATCH 2/2] Fix follow tasks and time spent --- htdocs/core/boxes/box_task.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 3a0b2c67af9..cf1d5241753 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -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);