From 966fedc5014d3e26f8a3c246498939cd37ab24c9 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 25 Apr 2020 10:19:09 +0200 Subject: [PATCH] ADD: New hook updateTotalPrice in commonObject update_price --- htdocs/core/class/commonobject.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7804f7a304f..494bbad03d1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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')