LSldapObject : fix onModify triggers execution

This commit is contained in:
Benjamin Renard 2012-03-22 19:51:27 +01:00
parent ea5c120b75
commit 421d7f4dce

View file

@ -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);
@ -356,15 +367,6 @@ class LSldapObject {
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 {