From 538cf90f5e8f550e0a9bd43568a34ec60291434f Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 15:39:40 +0200 Subject: [PATCH] FIX : [ bug #1496 ] ACTION_DELETE trigger does not show trigger error -Add ACTION_* trigger in interface_90_all --- ChangeLog | 2 ++ htdocs/comm/action/class/actioncomm.class.php | 36 +++++++------------ htdocs/comm/action/fiche.php | 3 +- .../interface_90_all_Demo.class.php-NORUN | 16 +++++++++ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81ec4b5c1e5..02f58dedd5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ For users: - Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1492, #1493 ] Member trigger problem - Fix: [ bug #1474, #1475 ] Contract trigger problem +- Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error + For translators: - Update language files. diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9e4c032ee..139ab2d048a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -227,14 +227,10 @@ class ActionComm extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -390,14 +386,10 @@ class ActionComm extends CommonObject { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -500,14 +492,10 @@ class ActionComm extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 450d7475947..ca17c261680 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -283,8 +283,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') } else { - $mesg=$object->error; - setEventMessage($mesg,'errors'); + setEventMessage($object->error,'errors'); } } } diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index f0f96961b86..f3811afc45b 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -119,6 +119,8 @@ class InterfaceDemo } elseif ($action == 'USER_CREATE') { + $object->error=$action; + return -1; dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } elseif ($action == 'USER_CREATE_FROM_CONTACT') @@ -154,6 +156,20 @@ class InterfaceDemo dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + // Action + elseif ($action == 'ACTION_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ACTION_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ACTION_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + // Groups elseif ($action == 'GROUP_CREATE') {