diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index badb8acc5f8..d5d2cc191e2 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -103,10 +103,6 @@ class Deplacement extends CommonObject public $statut; public $extraparams = array(); - public $statuts = array(); - public $statuts_short = array(); - public $statuts_logo = array(); - /** * Draft status @@ -131,10 +127,6 @@ class Deplacement extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; - - $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded'); - $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded'); - $this->statuts_logo = array(0 => 'status0', 1=>'status4', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); } /** @@ -222,8 +214,6 @@ class Deplacement extends CommonObject */ public function update($user) { - global $langs; - // Clean parameters $this->km = price2num($this->km); @@ -366,12 +356,21 @@ class Deplacement extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + global $langs; + //$langs->load("mymodule@mymodule"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatus[self::STATUS_REFUNDED] = $langs->transnoentitiesnoconv('Refunded'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatusShort[self::STATUS_REFUNDED] = $langs->transnoentitiesnoconv('Refunded'); + } - $statusType = $this->statuts_logo[$status]; + $status_logo = array(0 => 'status0', 1=>'status4', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + $statusType = $status_logo[$status]; - return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9769fe903e2..78a98f77c6e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -659,10 +659,30 @@ abstract class CommonObject */ public $alreadypaid; + /** + * @var array Array with label of status + */ public $labelStatus; + /** + * @var array array of status string + * @deprecated Use instead labelStatus + */ + public $statuts = array(); + + /** + * @var array Array with short label of status + */ protected $labelStatusShort; + /** + * @var array array of short status string + * @deprecated Use instead labelStatusShort + */ + public $statuts_short = array(); + + + /** * @var int show photo on popup */ @@ -673,15 +693,6 @@ abstract class CommonObject */ public $nb = array(); - /** - * @var array array of status string - */ - public $statuts = array(); - - /** - * @var array array of short status string - */ - public $statuts_short = array(); /** * @var string output