Merge pull request #13740 from simicar29/develop-hook-updateTotalPrice

ADD: New hook updateTotalPrice in commonObject update_price
This commit is contained in:
Laurent Destailleur 2020-04-27 13:43:13 +02:00 committed by GitHub
commit a7de160290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2974,6 +2974,14 @@ abstract class CommonObject
// phpcs:enable
global $conf, $hookmanager, $action;
$parameters = array('exclspec' => $exclspec, 'roundingadjust' => $roundingadjust, 'nodatabaseupdate' => $nodatabaseupdate, 'seller' => $seller);
$reshook = $hookmanager->executeHooks('updateTotalPrice', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
return 1; // replacement code
} elseif ($reshook < 0) {
return -1; // failure
} // reshook = 0 => execute normal code
// Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield)
$MODULE = "";
if ($this->element == 'propal')