Modif gestion de LDAP ajout de la classe objet d'egroupware
This commit is contained in:
parent
0162df1793
commit
00645d1c08
@ -74,6 +74,8 @@ class Contact
|
|||||||
*/
|
*/
|
||||||
Function update($id, $user=0)
|
Function update($id, $user=0)
|
||||||
{
|
{
|
||||||
|
$this->error = array();
|
||||||
|
|
||||||
$this->email = trim($this->email);
|
$this->email = trim($this->email);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET name='$this->name', firstname='$this->firstname'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET name='$this->name', firstname='$this->firstname'";
|
||||||
@ -82,11 +84,9 @@ class Contact
|
|||||||
$sql .= ", email='$this->email'";
|
$sql .= ", email='$this->email'";
|
||||||
$sql .= ", note='$this->note'";
|
$sql .= ", note='$this->note'";
|
||||||
|
|
||||||
$contact->address = $HTTP_POST_VARS["adresse"];
|
$contact->address = $HTTP_POST_VARS["adresse"];
|
||||||
$contact->cp = $HTTP_POST_VARS["cp"];
|
$contact->cp = $HTTP_POST_VARS["cp"];
|
||||||
$contact->ville = $HTTP_POST_VARS["ville"];
|
$contact->ville = $HTTP_POST_VARS["ville"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= ", phone = '$this->phone_pro'";
|
$sql .= ", phone = '$this->phone_pro'";
|
||||||
$sql .= ", phone_perso = '$this->phone_perso'";
|
$sql .= ", phone_perso = '$this->phone_perso'";
|
||||||
@ -131,28 +131,41 @@ class Contact
|
|||||||
if ($this->poste)
|
if ($this->poste)
|
||||||
$info["title"] = utf8_encode($this->poste);
|
$info["title"] = utf8_encode($this->poste);
|
||||||
|
|
||||||
//$info["homePostalAddress"] = "AdressePersonnelle\nVIlle";
|
if ($this->socid > 0)
|
||||||
//$info["street"] = "street";
|
{
|
||||||
//$info["postalCode"] = "postalCode";
|
$soc = new Societe($this->db);
|
||||||
//$info["postalAddress"] = "postalAddress";
|
$soc->fetch($this->socid);
|
||||||
|
$info["o"] = $soc->nom;
|
||||||
|
}
|
||||||
|
|
||||||
/* $info["objectclass"][0] = "top";
|
$info["objectclass"][0] = "organizationalPerson";
|
||||||
$info["objectclass"][1] = "person";
|
$info["objectclass"][1] = "inetOrgPerson";
|
||||||
$info["objectclass"][2] = "organizationalPerson";
|
$info["objectclass"][2] = "phpgwContact"; // compatibilite egroupware
|
||||||
*/
|
|
||||||
$info["objectclass"] = "inetOrgPerson";
|
|
||||||
// $info["objectclass"][1] = "phpgwContact"; // compatibilite egroupware
|
|
||||||
|
|
||||||
// add data to directory
|
$info['uidnumber'] = $id;
|
||||||
$dn = utf8_encode("cn=".$this->old_firstname." ".$this->old_name).", ".LDAP_SERVER_DN ;
|
|
||||||
|
$info['phpgwTz'] = 0;
|
||||||
|
$info['phpgwMailType'] = 'INTERNET';
|
||||||
|
$info['phpgwMailHomeType'] = 'INTERNET';
|
||||||
|
|
||||||
|
$info["uid"] = $id. ":".$info["sn"];
|
||||||
|
$info["phpgwContactTypeId"] = 'n';
|
||||||
|
$info["phpgwContactCatId"] = 0;
|
||||||
|
$info["phpgwContactAccess"] = "public";
|
||||||
|
$info["phpgwContactOwner"] = 7;
|
||||||
|
$info["givenName"] = $info["sn"];
|
||||||
|
|
||||||
|
if ($this->phone_mobile)
|
||||||
|
$info["phpgwCellTelephoneNumber"] = dolibarr_print_phone($this->phone_mobile);
|
||||||
|
|
||||||
|
//$dn = "uid=".$info["uid"].","."cn=".$info["cn"].", ".LDAP_SERVER_DN ;
|
||||||
|
$dn = "cn=".$info["cn"].", ".LDAP_SERVER_DN ;
|
||||||
|
|
||||||
$r = @ldap_delete($ds, $dn);
|
$r = @ldap_delete($ds, $dn);
|
||||||
|
|
||||||
$dn = "cn=".$info["cn"].", ".LDAP_SERVER_DN ;
|
|
||||||
|
|
||||||
if (! ldap_add($ds, $dn, $info))
|
if (! ldap_add($ds, $dn, $info))
|
||||||
{
|
{
|
||||||
print ldap_errno();
|
$this->error[0] = ldap_err2str(ldap_errno($ds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user