diff --git a/ChangeLog b/ChangeLog index 4ae175c119f..2a5fdc83f7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -238,6 +238,7 @@ The following changes may create regressions for some external modules, but were * The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id. * The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id. * The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id. +* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. * The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed (use instead user_creation, date_creation, date_validation). * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog() diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fbd57d7afc3..868b03304e5 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -179,11 +179,6 @@ class DolibarrApi unset($object->alreadypaid); unset($object->openid); - unset($object->statuts); - unset($object->statuts_short); - unset($object->statuts_logo); - unset($object->statuts_long); - //unset($object->labelStatus); //unset($object->labelStatusShort); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index f8d51b74787..bb9c16db08e 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -188,9 +188,9 @@ class Mailing extends CommonObject public $statut_dest = array(); /** - * @var array statuts + * @var array labelStatus */ - public $statuts = array(); + public $labelStatus = array(); /** * @var array substitutionarray @@ -220,10 +220,10 @@ class Mailing extends CommonObject $this->db = $db; // List of language codes for status - $this->statuts[0] = 'MailingStatusDraft'; - $this->statuts[1] = 'MailingStatusValidated'; - $this->statuts[2] = 'MailingStatusSentPartialy'; - $this->statuts[3] = 'MailingStatusSentCompletely'; + $this->labelStatus[0] = 'MailingStatusDraft'; + $this->labelStatus[1] = 'MailingStatusValidated'; + $this->labelStatus[2] = 'MailingStatusSentPartialy'; + $this->labelStatus[3] = 'MailingStatusSentCompletely'; $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[1] = 'MailingStatusSent'; @@ -893,8 +893,8 @@ class Mailing extends CommonObject global $langs; $langs->load("mailing"); - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatus[$status]); $statusType = 'status'.$status; if ($status == 2) { diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 36758d310c2..8b65dd77537 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -66,7 +66,7 @@ class LignePrelevement */ public $db; - public $statuts = array(); + public $labelStatus = array(); const STATUS_DRAFT = 0; const STATUS_NOT_USED = 1; @@ -89,9 +89,9 @@ class LignePrelevement // List of language codes for status $langs->load("withdrawals"); - $this->statuts[0] = $langs->trans("StatusWaiting"); - $this->statuts[2] = $langs->trans("StatusPaid"); - $this->statuts[3] = $langs->trans("StatusRefused"); + $this->labelStatus[0] = $langs->trans("StatusWaiting"); + $this->labelStatus[2] = $langs->trans("StatusPaid"); + $this->labelStatus[3] = $langs->trans("StatusRefused"); } /** @@ -165,30 +165,30 @@ class LignePrelevement global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 1) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Waiting + return img_picto($langs->trans($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Waiting } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Credited + return img_picto($langs->trans($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Credited } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Refused + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Refused } } elseif ($mode == 2) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"'); } } elseif ($mode == 3) { if ($status == 0) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"'); } } //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 8bb1907cd3b..dba7c6a4d2e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -34,6 +34,11 @@ abstract class CommonInvoice extends CommonObject { use CommonIncoterm; + /** + * @var string Label used as ref for template invoices + */ + public $title; + /** * @var int Type of invoice (See TYPE_XXX constants) */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1ef60a21f49..68344c03756 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -682,25 +682,17 @@ abstract class CommonObject /** * @var array Array with label of status */ - public $labelStatus; - - /** - * @var array array of status string - * @deprecated Use instead labelStatus - */ - public $statuts = array(); + public $labelStatus = array(); /** * @var array Array with short label of status */ - protected $labelStatusShort; + public $labelStatusShort = array(); /** - * @var array array of short status string - * @deprecated Use instead labelStatusShort + * @var array Array to store list of tpl */ - public $statuts_short = array(); - + public $tpl; /** @@ -3837,7 +3829,7 @@ abstract class CommonObject // Situations totals if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - if ($this->type != Facture::TYPE_CREDIT_NOTE) { + if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line $prev_sits = $this->get_prev_sits(); foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch. @@ -4597,7 +4589,7 @@ abstract class CommonObject if ($fieldstatus == 'tosell') { $this->status = $status; } elseif ($fieldstatus == 'tobuy') { - $this->status_buy = $status; + $this->status_buy = $status; // @phpstan-ignore-line } else { $this->statut = $status; $this->status = $status; @@ -4991,8 +4983,7 @@ abstract class CommonObject */ public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') { - global $conf, $user, $langs, $object, $hookmanager, $extrafields; - global $form; + global $conf, $user, $langs, $object, $hookmanager, $extrafields, $form; // Line extrafield if (!is_object($extrafields)) { @@ -10295,8 +10286,7 @@ abstract class CommonObject ); foreach ($fields as $key => $value) { if (array_key_exists($key, $this->fields)) { - // @phpstan-ignore-next-line - $this->{$key} = $value; + $this->{$key} = $value; // @phpstan-ignore-line } } diff --git a/htdocs/core/class/html.formexpensereport.class.php b/htdocs/core/class/html.formexpensereport.class.php index c08431b534e..bcb80a780dd 100644 --- a/htdocs/core/class/html.formexpensereport.class.php +++ b/htdocs/core/class/html.formexpensereport.class.php @@ -69,9 +69,9 @@ class FormExpenseReport if ($useempty) { $html.=''; } - $arrayoflabels = $tmpep->statuts; + $arrayoflabels = $tmpep->labelStatus; if ($useshortlabel) { - $arrayoflabels = $tmpep->statuts_short; + $arrayoflabels = $tmpep->labelStatusShort; } foreach ($arrayoflabels as $key => $val) { if ($selected != '' && $selected == $key) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8416df31b72..101d6e97d95 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2519,7 +2519,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $title = $langs->trans("Projects"); if (strcmp($status, '') && $status >= 0) { - $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]); + $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]); } print ''; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index a7066ad41fb..6194835eed4 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -717,7 +717,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($posx, $posy); $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetTextColor(111, 81, 124); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities($object->statuts_short[$object->status]), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities($object->labelStatusShort[$object->status]), '', 'R'); if ($showaddress) { // Sender properties diff --git a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php index 7c16599f039..2b6208c025d 100644 --- a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php @@ -470,10 +470,8 @@ function cleanObjectDatas($toclean) unset($toclean->timespent_fk_user); unset($toclean->timespent_note); - unset($toclean->statuts); - unset($toclean->statuts_short); - unset($toclean->statuts_logo); - unset($toclean->statuts_long); + unset($toclean->labelStatus); + unset($toclean->labelStatusShort); unset($toclean->element); unset($toclean->fk_element); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 025c61a2ef1..b890746e2a4 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -110,9 +110,9 @@ class Delivery extends CommonObject public $commande_id; /** - * @var array statuts labels + * @var array Status labels */ - public $statuts; + public $labelStatus; /** * @var DeliveryLine[] lines @@ -135,9 +135,9 @@ class Delivery extends CommonObject $this->db = $db; // List of short language codes for status - $this->statuts[-1] = 'StatusDeliveryCanceled'; - $this->statuts[0] = 'StatusDeliveryDraft'; - $this->statuts[1] = 'StatusDeliveryValidated'; + $this->labelStatus[-1] = 'StatusDeliveryCanceled'; + $this->labelStatus[0] = 'StatusDeliveryDraft'; + $this->labelStatus[1] = 'StatusDeliveryValidated'; } /** diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d667cd795dd..ca5315994d1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -267,18 +267,18 @@ class Expedition extends CommonObject $this->db = $db; // List of long language codes for status - $this->statuts = array(); - $this->statuts[-1] = 'StatusSendingCanceled'; - $this->statuts[0] = 'StatusSendingDraft'; - $this->statuts[1] = 'StatusSendingValidated'; - $this->statuts[2] = 'StatusSendingProcessed'; + $this->labelStatus = array(); + $this->labelStatus[-1] = 'StatusSendingCanceled'; + $this->labelStatus[0] = 'StatusSendingDraft'; + $this->labelStatus[1] = 'StatusSendingValidated'; + $this->labelStatus[2] = 'StatusSendingProcessed'; // List of short language codes for status - $this->statuts_short = array(); - $this->statuts_short[-1] = 'StatusSendingCanceledShort'; - $this->statuts_short[0] = 'StatusSendingDraftShort'; - $this->statuts_short[1] = 'StatusSendingValidatedShort'; - $this->statuts_short[2] = 'StatusSendingProcessedShort'; + $this->labelStatusShort = array(); + $this->labelStatusShort[-1] = 'StatusSendingCanceledShort'; + $this->labelStatusShort[0] = 'StatusSendingDraftShort'; + $this->labelStatusShort[1] = 'StatusSendingValidatedShort'; + $this->labelStatusShort[2] = 'StatusSendingProcessedShort'; } /** @@ -1928,8 +1928,8 @@ class Expedition extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 011d1fb2f7f..3a2df95dda6 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -179,9 +179,8 @@ class ExpenseReport extends CommonObject public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) - public $statuts = array(); - public $statuts_short = array(); - public $statuts_logo; + public $labelStatus = array(); + public $labelStatusShort = array(); // Multicurrency /** @@ -293,9 +292,8 @@ class ExpenseReport extends CommonObject $this->modepaymentid = 0; // List of language codes for status - $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + $this->labelStatusShort = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); + $this->labelStatus = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); } /** @@ -811,10 +809,12 @@ class ExpenseReport extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); - $statusType = $this->statuts_logo[$status]; + $statuslogo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + + $statusType = $statuslogo[$status]; return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 04ce5d5d648..4ad6caa7a69 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -239,7 +239,7 @@ print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, print ''; // Status print '