Ajout Debug Syslog
This commit is contained in:
parent
7b34878ed2
commit
97be4b83b9
@ -98,6 +98,7 @@ class Contact
|
|||||||
*/
|
*/
|
||||||
function update($id, $user=0)
|
function update($id, $user=0)
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("Contact::Update id=".$id,LOG_DEBUG);
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->error = array();
|
$this->error = array();
|
||||||
|
|
||||||
@ -116,8 +117,8 @@ class Contact
|
|||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||||
$sql .= " civilite='$this->civilite_id'";
|
$sql .= " civilite='$this->civilite_id'";
|
||||||
$sql .= ", name='$this->name'";
|
$sql .= ", name='".trim($this->name)."'";
|
||||||
$sql .= ", firstname='$this->firstname'";
|
$sql .= ", firstname='".trim($this->firstname)."'";
|
||||||
$sql .= ", address='$this->address'";
|
$sql .= ", address='$this->address'";
|
||||||
$sql .= ", cp='$this->cp'";
|
$sql .= ", cp='$this->cp'";
|
||||||
$sql .= ", ville='$this->ville'";
|
$sql .= ", ville='$this->ville'";
|
||||||
@ -146,9 +147,9 @@ class Contact
|
|||||||
if (defined('MAIN_MODULE_LDAP') && MAIN_MODULE_LDAP)
|
if (defined('MAIN_MODULE_LDAP') && MAIN_MODULE_LDAP)
|
||||||
{
|
{
|
||||||
if (defined('LDAP_CONTACT_ACTIVE') && LDAP_CONTACT_ACTIVE == 1)
|
if (defined('LDAP_CONTACT_ACTIVE') && LDAP_CONTACT_ACTIVE == 1)
|
||||||
|
{
|
||||||
$this->update_ldap($user);
|
$this->update_ldap($user);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@ -161,14 +162,15 @@ class Contact
|
|||||||
*/
|
*/
|
||||||
function update_ldap($user)
|
function update_ldap($user)
|
||||||
{
|
{
|
||||||
|
$info = array();
|
||||||
|
dolibarr_syslog("Contact::update_ldap",LOG_DEBUG);
|
||||||
|
|
||||||
$this->fetch($this->id);
|
$this->fetch($this->id);
|
||||||
|
|
||||||
$ds = dolibarr_ldap_connect();
|
$ds = dolibarr_ldap_connect();
|
||||||
|
|
||||||
if ($ds)
|
if ($ds)
|
||||||
{
|
{
|
||||||
dolibarr_ldap_setversion($ds,$version);
|
|
||||||
|
|
||||||
$ldapbind = dolibarr_ldap_bind($ds);
|
$ldapbind = dolibarr_ldap_bind($ds);
|
||||||
|
|
||||||
if ($ldapbind)
|
if ($ldapbind)
|
||||||
@ -332,17 +334,20 @@ class Contact
|
|||||||
|
|
||||||
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN;
|
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN;
|
||||||
|
|
||||||
|
dolibarr_syslog("Contact::update_ldap dn : ".$dn,LOG_DEBUG);
|
||||||
|
|
||||||
$r = @ldap_delete($ds, $dn);
|
$r = @ldap_delete($ds, $dn);
|
||||||
|
|
||||||
if (! @ldap_add($ds, $dn, $info))
|
if (! @ldap_add($ds, $dn, $info))
|
||||||
{
|
{
|
||||||
$this->error[0] = ldap_err2str(ldap_errno($ds));
|
$this->error[0] = ldap_err2str(ldap_errno($ds));
|
||||||
|
dolibarr_syslog("Contact::update_ldap error : ".$this->error[0],LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "Connexion au dn $dn échoué !";
|
dolibarr_syslog("Contact::update_ldap bind failed",LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_ldap_unbind($ds);
|
dolibarr_ldap_unbind($ds);
|
||||||
@ -350,6 +355,7 @@ class Contact
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("Contact::update_ldap Connexion failed",LOG_DEBUG);
|
||||||
echo "Impossible de se connecter au serveur LDAP !";
|
echo "Impossible de se connecter au serveur LDAP !";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -587,7 +593,6 @@ class Contact
|
|||||||
|
|
||||||
if ($ds)
|
if ($ds)
|
||||||
{
|
{
|
||||||
dolibarr_ldap_setversion($ds, $version);
|
|
||||||
$ldapbind = dolibarr_ldap_bind($ds);
|
$ldapbind = dolibarr_ldap_bind($ds);
|
||||||
|
|
||||||
if ($ldapbind)
|
if ($ldapbind)
|
||||||
@ -622,7 +627,7 @@ class Contact
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Charge les informations sur le contact, depuis la base
|
* \brief Charge les informations sur le contact, depuis la base
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user