diff --git a/ChangeLog b/ChangeLog index 989c34bd305..42b145f47cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ For users: - Fix: [ bug #1498, #1499 ] Shipment/Delivery triggers problem - Fix: [ bug #1465, #1466 ] Product triggers problem - Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message +- Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action For translators: diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 942ceb912c8..0f17c543b9d 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -126,15 +126,15 @@ class Deplacement extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement"); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('DEPLACEMENT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - + // Call trigger + $result=$this->call_trigger('DEPLACEMENT_CREATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + $result=$this->update($user); if ($result > 0) {