From 59fe34752c3444aec70b01bb6f5f2c4f6f03bb01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Sep 2019 15:50:48 +0200 Subject: [PATCH] Fix error reporting of LDAP errors --- ...interface_50_modLdap_Ldapsynchro.class.php | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index b0fc6634a98..daa5ae9a525 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -621,7 +621,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[]="ErrorLDAP ".$ldap->error; + } } } elseif ($action == 'MEMBER_NEW_PASSWORD') @@ -644,7 +647,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result=$ldap->update($dn, $info, $user, $olddn); } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } } } @@ -668,7 +674,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result=$ldap->update($dn, $info, $user, $olddn); } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } } } @@ -721,7 +730,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } } @@ -747,7 +759,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result=$ldap->add($dn, $info, $user); } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } } elseif ($action == 'MEMBER_TYPE_MODIFY') @@ -788,7 +803,9 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result=$ldap->update($dn, $info, $user, $olddn); } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } } elseif ($action == 'MEMBER_TYPE_DELETE') @@ -807,7 +824,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result=$ldap->delete($dn); } - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; + if ($result <= 0) + { + $this->errors[] = "ErrorLDAP ".$ldap->error; + } } }