From 1c1334effedc7d923cf69de04216ac58c83d2989 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Oct 2019 16:10:00 +0200 Subject: [PATCH] Use dolGetStatus --- htdocs/fichinter/class/fichinter.class.php | 49 ++++++++-------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 24a42a034a9..429341cb490 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -701,51 +701,36 @@ class Fichinter extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns the label of a statut + * Returns the label of a status * - * @param int $statut id statut + * @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 // Init/load array of translation of status - if (empty($this->statuts) || empty($this->statuts_short)) + if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo)) { global $langs; $langs->load("fichinter"); - $this->statuts[0]=$langs->trans('Draft'); - $this->statuts[1]=$langs->trans('Validated'); - $this->statuts[2]=$langs->trans('StatusInterInvoiced'); - $this->statuts[3]=$langs->trans('Done'); - $this->statuts_short[0]=$langs->trans('Draft'); - $this->statuts_short[1]=$langs->trans('Validated'); - $this->statuts_short[2]=$langs->trans('StatusInterInvoiced'); - $this->statuts_short[3]=$langs->trans('Done'); - $this->statuts_logo[0]='statut0'; - $this->statuts_logo[1]='statut1'; - $this->statuts_logo[2]='statut6'; - $this->statuts_logo[3]='statut6'; + $this->statuts[self::STATUS_DRAFT]=$langs->trans('Draft'); + $this->statuts[self::STATUS_VALIDATED]=$langs->trans('Validated'); + $this->statuts[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced'); + $this->statuts[self::STATUS_CLOSED]=$langs->trans('Done'); + $this->statuts_short[self::STATUS_DRAFT]=$langs->trans('Draft'); + $this->statuts_short[self::STATUS_VALIDATED]=$langs->trans('Validated'); + $this->statuts_short[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced'); + $this->statuts_short[self::STATUS_CLOSED]=$langs->trans('Done'); + $this->statuts_logo[self::STATUS_DRAFT]='status0'; + $this->statuts_logo[self::STATUS_VALIDATED]='status1'; + $this->statuts_logo[self::STATUS_BILLED]='status6'; + $this->statuts_logo[self::STATUS_CLOSED]='status6'; } - if ($mode == 0) - return $this->statuts[$statut]; - elseif ($mode == 1) - return $this->statuts_short[$statut]; - elseif ($mode == 2) - return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts_short[$statut]; - elseif ($mode == 3) - return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]); - elseif ($mode == 4) - return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts[$statut]; - elseif ($mode == 5) - return ''.$this->statuts_short[$statut].' '.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]); - elseif ($mode == 6) - return ''.$this->statuts[$statut].' '.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]); - - return ''; + return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode); } /**