Fix avoid error on lang not defined when calling trigger

This commit is contained in:
Laurent Destailleur 2019-11-09 13:08:30 +01:00
parent fcf983ee23
commit 5ebd5a401c

View File

@ -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);