mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-23 00:43:48 +01:00
LSldapObject::submitChange(): code cleaning
This commit is contained in:
parent
a353ca5c37
commit
7ef6e57c49
1 changed files with 39 additions and 40 deletions
|
@ -675,49 +675,48 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
|||
}
|
||||
}
|
||||
if(!empty($submitData)) {
|
||||
$dn=$this -> getDn();
|
||||
|
||||
if($dn) {
|
||||
$this -> dn=$dn;
|
||||
self :: log_debug($this." -> submitChange($idForm): submitData=".varDump($submitData));
|
||||
if ($new) {
|
||||
// Check DN is not already exist
|
||||
if (LSldap :: exists($dn)) {
|
||||
return;
|
||||
}
|
||||
if (!$this -> fireEvent('before_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_20');
|
||||
return;
|
||||
}
|
||||
foreach ($submitData as $attr_name => $attr) {
|
||||
if (!$this -> attrs[$attr_name] -> fireEvent('before_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_20');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!LSldap :: update($this -> getType(),$dn, $submitData)) {
|
||||
return;
|
||||
}
|
||||
self :: log_debug($this." -> submitChange($idForm): changes applied in LDAP");
|
||||
if ($new) {
|
||||
if (!$this -> fireEvent('after_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_21');
|
||||
return;
|
||||
}
|
||||
foreach ($submitData as $attr_name => $attr) {
|
||||
if (!$this -> attrs[$attr_name] -> fireEvent('after_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_21');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$dn = $this -> getDn();
|
||||
if (!$dn) {
|
||||
LSerror :: addErrorCode('LSldapObject_13');
|
||||
return;
|
||||
}
|
||||
|
||||
$this -> dn = $dn;
|
||||
self :: log_debug($this." -> submitChange($idForm): submitData=".varDump($submitData));
|
||||
if ($new) {
|
||||
// Check DN is not already exist
|
||||
if (LSldap :: exists($dn)) {
|
||||
return;
|
||||
}
|
||||
if (!$this -> fireEvent('before_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_20');
|
||||
return;
|
||||
}
|
||||
foreach ($submitData as $attr_name => $attr) {
|
||||
if (!$this -> attrs[$attr_name] -> fireEvent('before_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_20');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!LSldap :: update($this -> getType(),$dn, $submitData)) {
|
||||
self :: log_debug($this." -> submitChange($idForm): LSldap :: update() failed");
|
||||
return;
|
||||
}
|
||||
self :: log_debug($this." -> submitChange($idForm): changes applied in LDAP");
|
||||
if ($new) {
|
||||
if (!$this -> fireEvent('after_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_21');
|
||||
return;
|
||||
}
|
||||
foreach ($submitData as $attr_name => $attr) {
|
||||
if (!$this -> attrs[$attr_name] -> fireEvent('after_create')) {
|
||||
LSerror :: addErrorCode('LSldapObject_21');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
self :: log_debug($this." -> submitChange($idForm): no change");
|
||||
|
|
Loading…
Reference in a new issue