FIX: Add Missing "LibStatut" hook in propal, commande, facture

This commit is contained in:
Noé Courtier 2022-11-08 16:21:32 +01:00
parent 026404657d
commit 73b857c1b3
3 changed files with 40 additions and 3 deletions

View File

@ -3243,7 +3243,7 @@ class Propal extends CommonObject
public function LibStatut($status, $mode = 1) public function LibStatut($status, $mode = 1)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf, $hookmanager;
// Init/load array of translation of status // Init/load array of translation of status
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
@ -3274,6 +3274,14 @@ class Propal extends CommonObject
$statusType = 'status6'; $statusType = 'status6';
} }
$parameters = array('status' => $status, 'mode' => $mode);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }

View File

@ -3591,7 +3591,7 @@ class Commande extends CommonOrder
public function LibStatut($status, $billed, $mode, $donotshowbilled = 0) public function LibStatut($status, $billed, $mode, $donotshowbilled = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf, $hookmanager;
$billedtext = ''; $billedtext = '';
if (empty($donotshowbilled)) { if (empty($donotshowbilled)) {
@ -3636,6 +3636,19 @@ class Commande extends CommonOrder
$mode = 0; $mode = 0;
} }
$parameters = array(
'status' => $status,
'mode' => $mode,
'billed' => $billed,
'donotshowbilled' => $donotshowbilled
);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip));
} }

View File

@ -532,7 +532,7 @@ abstract class CommonInvoice extends CommonObject
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1) public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs, $hookmanager;
$langs->load('bills'); $langs->load('bills');
if ($type == -1) { if ($type == -1) {
@ -577,6 +577,22 @@ abstract class CommonInvoice extends CommonObject
} }
} }
$parameters = array(
'status' => $status,
'mode' => $mode,
'paye' => $paye,
'alreadypaid' => $alreadypaid,
'type' => $type
);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
} }