From 5ebd5a401c79046613443750c44d32e1e15538d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Nov 2019 13:08:30 +0100 Subject: [PATCH] Fix avoid error on lang not defined when calling trigger --- htdocs/core/class/commonobject.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c6965fd384a..da5461bae67 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4806,6 +4806,11 @@ abstract class CommonObject // phpcs:enable global $langs,$conf; + if (! is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. + include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; + $langs = new Translate('', $conf); + } + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name, $this, $user, $langs, $conf);