From 421d7f4dcefdd178b50a4308c8d578abc6692572 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 22 Mar 2012 19:51:27 +0100 Subject: [PATCH] LSldapObject : fix onModify triggers execution --- .../includes/class/class.LSldapObject.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/public_html/includes/class/class.LSldapObject.php b/public_html/includes/class/class.LSldapObject.php index d6f6e933..d5ee557d 100644 --- a/public_html/includes/class/class.LSldapObject.php +++ b/public_html/includes/class/class.LSldapObject.php @@ -341,13 +341,24 @@ class LSldapObject { // $this -> attrs[ {inNewData} ] -> fireEvent('before_modify') foreach($new_data as $attr_name => $attr_val) { - if (!$this -> attrs[$attr_name] -> fireEvent('before_modify')) { + if ($this -> attrs[$attr_name] -> isUpdate() && !$this -> attrs[$attr_name] -> fireEvent('before_modify')) { return; } } if ($this -> submitChange($idForm)) { LSdebug('Les modifications sont submitées'); + // Event After Modify + if(!$this -> submitError) { + $this -> fireEvent('after_modify'); + } + + // $this -> attrs[*] => After Modify + foreach($new_data as $attr_name => $attr_val) { + if ($this -> attrs[$attr_name] -> isUpdate()) { + $this -> attrs[$attr_name] -> fireEvent('after_modify'); + } + } $this -> submitError = false; $this -> reloadData(); $this -> refreshForm($idForm); @@ -355,16 +366,7 @@ class LSldapObject { else { return; } - - // Event After Modify - if(!$this -> submitError) { - $this -> fireEvent('after_modify'); - } - - // $this -> attrs[*] => After Modify - foreach($new_data as $attr_name => $attr_val) { - $this -> attrs[$attr_name] -> fireEvent('after_modify'); - } + return true; } else {