diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 04a3a13cc91..91b2e27eeeb 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1953,12 +1953,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } /** - * @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 - * @param $hideOnProgressNull bool - * @param $showPercent bool - * @param $spaced bool + * @param task $task Task the task object + * @param label $label bool|string true = auto, false = dont display, string = replace output + * @param progressNumber $progressNumber bool|string true = auto, false = dont display, string = replace output + * @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null + * @param spaced $spaced bool used to add space at bottom (made by css) * @return string */ function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false) @@ -2062,9 +2061,9 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide return $out; } /** - * @param $task Task - * @param $label string empty = auto (progress), string = replace output - * @param $tooltip string empty = auto , string = replace output + * @param task $task Task the task object + * @param label $label string empty = auto (progress), string = replace output + * @param tooltip $tooltip string empty = auto , string = replace output * @return string */ function getTaskProgressBadge($task, $label = '', $tooltip = '') @@ -2072,14 +2071,13 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '') global $conf; $out = ''; - $label = ''; - $badgeColorClass = ''; + $badgeClass = ''; if ($task->progress != '') { // TODO : manage 100% // define color according to time spend vs workload - $badgeColorClass = 'badge '; + $badgeClass = 'badge '; if ($task->planned_workload){ $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2); @@ -2087,24 +2085,30 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '') $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'; + $badgeClass.= 'badge-danger'; } elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1% - $badgeColorClass.= 'badge-warning'; + $badgeClass.= 'badge-warning'; } else{ - $badgeColorClass.= 'badge-success'; + $badgeClass.= 'badge-success'; } } } + $title = ''; + if(!empty($tooltip)){ + $badgeClass.= ' classfortooltip'; + $title = 'title="'.dol_htmlentities($tooltip).'"'; + } + if(empty($label)){ $label = $task->progress.' %'; } if(!empty($label)){ - $out = ''.$label.''; + $out = ''.$label.''; } return $out; -} \ No newline at end of file +} diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index d98b1e16443..bf47e1a2807 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -86,4 +86,3 @@ $badgeStatus6='#cad2d2'; $badgeStatus7='#baa32b'; $badgeStatus8='#be3013'; $badgeStatus9='#e7f0f0'; -