Merge pull request #22792 from noec764/14_FIX_Add_Missing_LibStatut_Hooks

FIX: Add Missing "LibStatut" hooks in propal, commande, facture
This commit is contained in:
Laurent Destailleur 2022-11-09 15:39:43 +01:00 committed by GitHub
commit 08985fbe62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 4 deletions

View File

@ -3347,7 +3347,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)) {
@ -3378,6 +3378,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

@ -3626,7 +3626,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)) {
@ -3674,6 +3674,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

@ -128,7 +128,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id); $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
$sql .= ' WHERE a.code <> "AC_OTH_AUTO"'; $sql .= ' WHERE a.code <> "AC_OTH_AUTO"';
$sql .= ' AND ('; $sql .= ' AND (';
$sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; $sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
$sql .= ' )'; $sql .= ' )';
} else { } else {
$sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id); $sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);

View File

@ -584,7 +584,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) {
@ -634,6 +634,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);
} }