standardize code
This commit is contained in:
parent
3c7092a114
commit
8c1ce7873f
@ -749,25 +749,25 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
// phpcs:enable
|
||||
// Init/load array of translation of status
|
||||
if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo)) {
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
global $langs;
|
||||
$langs->load("fichinter");
|
||||
|
||||
$this->statuts[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->statuts[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
|
||||
$this->statuts[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
|
||||
$this->statuts[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done');
|
||||
$this->statuts_short[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->statuts_short[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
|
||||
$this->statuts_short[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
|
||||
$this->statuts_short[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('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';
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
|
||||
$this->labelStatus[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
|
||||
$this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
|
||||
$this->labelStatusShort[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
|
||||
$this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done');
|
||||
}
|
||||
|
||||
return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode);
|
||||
$statuscode = 'status'.$status;
|
||||
if ($status == self::STATUS_BILLED || $status == self::STATUS_CLOSED) {
|
||||
$statuscode = 'status6';
|
||||
}
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statuscode, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -140,27 +140,6 @@ class Reception extends CommonObject
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// List of long language codes for status
|
||||
$this->statuts = array();
|
||||
$this->statuts[-1] = 'StatusReceptionCanceled';
|
||||
$this->statuts[0] = 'StatusReceptionDraft';
|
||||
// product to receive if stock increase is on close or already received if stock increase is on validation
|
||||
$this->statuts[1] = 'StatusReceptionValidated';
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
|
||||
$this->statuts[1] = 'StatusReceptionValidatedReceived';
|
||||
}
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
|
||||
$this->statuts[1] = 'StatusReceptionValidatedToReceive';
|
||||
}
|
||||
$this->statuts[2] = 'StatusReceptionProcessed';
|
||||
|
||||
// List of short language codes for status
|
||||
$this->statuts_short = array();
|
||||
$this->statuts_short[-1] = 'StatusReceptionCanceledShort';
|
||||
$this->statuts_short[0] = 'StatusReceptionDraftShort';
|
||||
$this->statuts_short[1] = 'StatusReceptionValidatedShort';
|
||||
$this->statuts_short[2] = 'StatusReceptionProcessedShort';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1317,8 +1296,27 @@ class Reception extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]);
|
||||
// List of long language codes for status
|
||||
$this->labelStatus[-1] = 'StatusReceptionCanceled';
|
||||
$this->labelStatus[0] = 'StatusReceptionDraft';
|
||||
// product to receive if stock increase is on close or already received if stock increase is on validation
|
||||
$this->labelStatus[1] = 'StatusReceptionValidated';
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
|
||||
$this->labelStatus[1] = 'StatusReceptionValidatedReceived';
|
||||
}
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
|
||||
$this->labelStatus[1] = 'StatusReceptionValidatedToReceive';
|
||||
}
|
||||
$this->labelStatus[2] = 'StatusReceptionProcessed';
|
||||
|
||||
// List of short language codes for status
|
||||
$this->labelStatusShort[-1] = 'StatusReceptionCanceledShort';
|
||||
$this->labelStatusShort[0] = 'StatusReceptionDraftShort';
|
||||
$this->labelStatusShort[1] = 'StatusReceptionValidatedShort';
|
||||
$this->labelStatusShort[2] = 'StatusReceptionProcessedShort';
|
||||
|
||||
$labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]);
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]);
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user