diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d8f760330b8..0b2d9022b58 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -625,18 +625,17 @@ class CommandeFournisseur extends CommonOrder /** * Return label of a status * - * @param int $statut Id statut + * @param int $status 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 $billed 1=Billed * @return string Label of status */ - public function LibStatut($statut, $mode = 0, $billed = 0) + public function LibStatut($status, $mode = 0, $billed = 0) { // phpcs:enable global $conf, $langs; - if (empty($this->statuts) || empty($this->statutshort)) - { + if (empty($this->statuts) || empty($this->statutshort)){ $langs->load('orders'); $this->statuts[0] = 'StatusSupplierOrderDraft'; @@ -662,55 +661,33 @@ class CommandeFournisseur extends CommonOrder $this->statutshort[9] = 'StatusSupplierOrderRefusedShort'; } - $billedtext=''; - //if ($statut==5 && $this->billed == 1) $statut = 8; - if ($billed == 1) $billedtext=$langs->trans("Billed"); + $statustrans = array( + 0 => 'status0', + 1 => 'status1', + 2 => 'status3', + 3 => 'status3', + 4 => 'status3', + 5 => 'status6', + 6 => 'status5', + 7 => 'status5', - if ($mode == 0) - { - return $langs->trans($this->statuts[$statut]); + 9 => 'status5', + ); + + $statusClass = 'status0'; + if(!empty($statustrans[$status])){ + $statusClass = $statustrans[$status]; } - elseif ($mode == 1) - { - return $langs->trans($this->statutshort[$statut]); - } - elseif ($mode == 2) - { - return $langs->trans($this->statuts[$statut]); - } - elseif ($mode == 3) - { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==4) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==5) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - elseif ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]), 'statut5'); - elseif ($statut==9) return img_picto($langs->trans($this->statuts[$statut]), 'statut5'); - } - elseif ($mode == 4) - { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==4) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==5) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]), 'statut5').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - elseif ($statut==9) return img_picto($langs->trans($this->statuts[$statut]), 'statut5').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:''); - } - elseif ($mode == 5) - { - if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==3) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==4) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut==5) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - elseif ($statut==6 || $statut==7) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut5'); - elseif ($statut==9) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut5'); + + $billedtext = ''; + if($mode == 4 && $billed){ + $billedtext = ' - '.$langs->trans("Billed"); } + + $statusLong = $langs->trans($this->statuts_long[$status]).$billedtext; + $statusShort = $langs->trans($this->statutshort[$status]); + + return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); }