LSldapObject::submitChange(): fix error renaming LSobject

Old RDN value was keep and block the update ot the other changed 
attributes.
This commit is contained in:
Benjamin Renard 2021-01-28 16:59:42 +01:00
parent fadfe2d2ba
commit 29e499e1d6

View file

@ -640,7 +640,6 @@ class LSldapObject extends LSlog_staticLoggerClass {
foreach($this -> attrs as $attr) {
if(($attr -> isUpdate())&&($attr -> isValidate())) {
if(($attr -> name == $this -> getConfig('rdn')) && (!$new)) {
$new = true;
self :: log_debug("$this -> submitChange($idForm): renaming detected");
if (!$this -> fireEvent('before_rename')) {
LSerror :: addErrorCode('LSldapObject_16');
@ -650,8 +649,9 @@ class LSldapObject extends LSlog_staticLoggerClass {
$this -> dn = false;
$newDn = $this -> getDn();
if ($newDn) {
self :: log_debug("$this -> submitChange($idForm): Rename me to '$newDn'");
if (!LSldap :: move($oldDn,$newDn)) {
self :: log_debug("$this -> submitChange($idForm): Rename me from '$oldDn' to '$newDn'");
if (!LSldap :: move($oldDn, $newDn)) {
self :: log_error("$this -> submitChange($idForm): Fail to rename me from '$oldDn' to '$newDn'. Stop.");
return;
}
$this -> dn = $newDn;