From edc4dc3727dd0fed9e04e17287fe54ca6bae67e1 Mon Sep 17 00:00:00 2001 From: ATM john Date: Thu, 3 Oct 2019 21:20:07 +0200 Subject: [PATCH] Fix project libStatus to use new dolGetStatus --- htdocs/projet/class/project.class.php | 51 ++++++++------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 027fe6503b2..2382f93c17a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -942,48 +942,27 @@ class Project extends CommonObject /** * Renvoi status label for a status * - * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $status id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable - global $langs; - if ($mode == 0) { - return $langs->trans($this->statuts_long[$statut]); - } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); - } elseif ($mode == 2) { - if ($statut == 0) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); - elseif ($statut == 1) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]); - elseif ($statut == 2) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); - } elseif ($mode == 3) { - if ($statut == 0) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); - elseif ($statut == 1) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); - elseif ($statut == 2) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); - } elseif ($mode == 4) { - if ($statut == 0) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_long[$statut]); - elseif ($statut == 1) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_long[$statut]); - if ($statut == 2) - return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_long[$statut]); - } elseif ($mode == 5) { - if ($statut == 0) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); - elseif ($statut == 1) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); - elseif ($statut == 2) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); + $statustrans = array( + 0 => 'status0', + 1 => 'status4', + 2 => 'status6', + ); + + $statusClass = 'status0'; + if(!empty($statustrans[$status])){ + $statusClass = $statustrans[$status]; } + + return dolGetStatus($this->statuts_long[$status], $this->statuts_short[$status], '', $statusClass, $mode); + } /**