rename Hook and moved it into LibStatut method

This commit is contained in:
Antonin MARCHAL 2021-05-12 16:55:03 +02:00
parent 60671f1c78
commit 1bfcfc3a0c
2 changed files with 7 additions and 10 deletions

View File

@ -690,7 +690,7 @@ class CommandeFournisseur extends CommonOrder
public function LibStatut($status, $mode = 0, $billed = 0)
{
// phpcs:enable
global $conf, $langs;
global $conf, $langs, $hookmanager;
if (empty($this->statuts) || empty($this->statutshort)) {
$langs->load('orders');
@ -749,6 +749,11 @@ class CommandeFournisseur extends CommonOrder
$statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext;
$statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]);
$parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this);
$reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode);
}

View File

@ -1537,15 +1537,7 @@ if ($resql) {
}
// Status
if (!empty($arrayfields['cf.fk_statut']['checked'])) {
$parameters = array('obj' => $obj);
$morehtmlstatus = $objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed);
$reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$morehtmlstatus .= $hookmanager->resPrint;
} else {
$morehtmlstatus = $hookmanager->resPrint;
}
print '<td class="right nowrap">' . $morehtmlstatus . '</td>';
print '<td class="right nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}