diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b1dd5efc77c..afb86b05a66 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6797,7 +6797,7 @@ abstract class CommonObject */ public function updateExtraField($key, $trigger = null, $userused = null) { - global $conf, $langs, $user; + global $conf, $langs, $user, $hookmanager; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; @@ -7063,6 +7063,14 @@ abstract class CommonObject } } + if (!$error) { + $parameters = array('key'=>$key); + $reshook = $hookmanager->executeHooks('updateExtraFieldBeforeCommit', $parameters, $this, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + } + if (!$error && $trigger) { // Call trigger $this->context = array('extrafieldupdate'=>1);