From 4b634e408d5440d39b73b8637db4499ea703d514 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 21 May 2021 11:28:38 +0200 Subject: [PATCH] LSldapObject: fix triggering after_modify event on create --- src/includes/class/class.LSldapObject.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/includes/class/class.LSldapObject.php b/src/includes/class/class.LSldapObject.php index 21a3c106..ab52600c 100644 --- a/src/includes/class/class.LSldapObject.php +++ b/src/includes/class/class.LSldapObject.php @@ -372,15 +372,18 @@ class LSldapObject extends LSlog_staticLoggerClass { } } + $new = $this -> isNew(); if ($this -> submitChange($idForm)) { self :: log_debug($this."->_updateData(): changes are submited"); // Event After Modify - $this -> fireEvent('after_modify'); + if (!$new && $idForm != 'create') { + $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 -> 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 -> reloadData();