Correction bug sur le numéro de fax

This commit is contained in:
Rodolphe Quiedeville 2004-07-12 13:43:06 +00:00
parent 596a92f573
commit 16d10b113f
2 changed files with 155 additions and 154 deletions

View File

@ -75,172 +75,172 @@ class Contact
* *
*/ */
Function update($id, $user=0) Function update($id, $user=0)
{ {
$this->id = $id; $this->id = $id;
$this->error = array(); $this->error = array();
$this->email = trim($this->email); $this->email = trim($this->email);
$this->phone_pro = ereg_replace(" ","",$this->phone_pro); $this->phone_pro = ereg_replace(" ","",$this->phone_pro);
$this->phone_perso = ereg_replace(" ","",$this->phone_perso); $this->phone_perso = ereg_replace(" ","",$this->phone_perso);
if (strlen($this->phone_pro) == 0 && $this->socid > 0) if (strlen($this->phone_pro) == 0 && $this->socid > 0)
{ {
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->fetch($this->socid); $soc->fetch($this->socid);
$this->phone_pro = $soc->tel; $this->phone_pro = $soc->tel;
} }
$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'";
$sql .= ", poste='$this->poste'"; $sql .= ", poste='$this->poste'";
$sql .= ", fax='$this->fax'"; $sql .= ", fax='$this->fax'";
$sql .= ", email='$this->email'"; $sql .= ", email='$this->email'";
$sql .= ", note='$this->note'"; $sql .= ", note='$this->note'";
$sql .= ", phone = '$this->phone_pro'"; $sql .= ", phone = '$this->phone_pro'";
$sql .= ", phone_perso = '$this->phone_perso'"; $sql .= ", phone_perso = '$this->phone_perso'";
$sql .= ", phone_mobile = '$this->phone_mobile'"; $sql .= ", phone_mobile = '$this->phone_mobile'";
$sql .= ", jabberid = '$this->jabberid'"; $sql .= ", jabberid = '$this->jabberid'";
$sql .= " WHERE idp=$id"; $sql .= " WHERE idp=$id";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if (!$result) if (!$result)
{ {
print $this->db->error() . '<br>' . $sql; print $this->db->error() . '<br>' . $sql;
} }
if (defined('MAIN_MODULE_LDAP') && MAIN_MODULE_LDAP) if (defined('MAIN_MODULE_LDAP') && MAIN_MODULE_LDAP)
{ {
$this->update_ldap($user); $this->update_ldap($user);
} }
return $result; return $result;
} }
/* /*
* Mise à jour de l'arbre ldap * Mise à jour de l'arbre ldap
* *
*/ */
Function update_ldap($user) Function update_ldap($user)
{ {
$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); dolibarr_ldap_setversion($ds,$version);
$ldapbind = dolibarr_ldap_bind($ds); $ldapbind = dolibarr_ldap_bind($ds);
if ($ldapbind) if ($ldapbind)
{ {
$info["objectclass"][0] = "organizationalPerson"; $info["objectclass"][0] = "organizationalPerson";
$info["objectclass"][1] = "inetOrgPerson"; $info["objectclass"][1] = "inetOrgPerson";
$info["ou"] = People; $info["ou"] = People;
$info["cn"] = utf8_encode($this->firstname." ".$this->name); $info["cn"] = utf8_encode($this->firstname." ".$this->name);
$info["sn"] = utf8_encode($this->name); $info["sn"] = utf8_encode($this->name);
$info["givenName"] = utf8_encode($this->firstname); $info["givenName"] = utf8_encode($this->firstname);
if ($this->poste) if ($this->poste)
$info["title"] = utf8_encode($this->poste); $info["title"] = utf8_encode($this->poste);
if ($this->socid > 0) if ($this->socid > 0)
{ {
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->fetch($this->socid); $soc->fetch($this->socid);
$info["o"] = utf8_encode($soc->nom); $info["o"] = utf8_encode($soc->nom);
if ($soc->client == 1) if ($soc->client == 1)
$info["businessCategory"] = utf8_encode("Clients"); $info["businessCategory"] = utf8_encode("Clients");
elseif ($soc->client == 2) elseif ($soc->client == 2)
$info["businessCategory"] = utf8_encode("Prospects"); $info["businessCategory"] = utf8_encode("Prospects");
if ($soc->fournisseur == 1) if ($soc->fournisseur == 1)
$info["businessCategory"] = utf8_encode("Fournisseurs"); $info["businessCategory"] = utf8_encode("Fournisseurs");
if ($soc->ville) if ($soc->ville)
{ {
if ($soc->address) if ($soc->address)
$info["street"] = ($soc->address); $info["street"] = ($soc->address);
if ($soc->cp) if ($soc->cp)
$info["postalCode"] = ($soc->cp); $info["postalCode"] = ($soc->cp);
$info["l"] = utf8_encode($soc->ville); $info["l"] = utf8_encode($soc->ville);
} }
} }
if ($this->phone_pro) if ($this->phone_pro)
$info["telephoneNumber"] = dolibarr_print_phone($this->phone_pro); $info["telephoneNumber"] = dolibarr_print_phone($this->phone_pro);
if ($this->phone_perso) if ($this->phone_perso)
$info["homePhone"] = dolibarr_print_phone($this->phone_perso); $info["homePhone"] = dolibarr_print_phone($this->phone_perso);
if ($this->phone_mobile) if ($this->phone_mobile)
$info["mobile"] = dolibarr_print_phone($this->phone_mobile); $info["mobile"] = dolibarr_print_phone($this->phone_mobile);
if ($this->note) if ($this->note)
$info["description"] = ($this->note); $info["description"] = ($this->note);
if(LDAP_SERVER_TYPE == "egroupware") if(LDAP_SERVER_TYPE == "egroupware")
{ {
$info["objectclass"][2] = "phpgwContact"; // compatibilite egroupware $info["objectclass"][2] = "phpgwContact"; // compatibilite egroupware
if ($this->email) if ($this->email)
$info["rfc822Mailbox"] = $this->email; $info["rfc822Mailbox"] = $this->email;
$info['uidnumber'] = $this->id; $info['uidnumber'] = $this->id;
$info['phpgwTz'] = 0; $info['phpgwTz'] = 0;
$info['phpgwMailType'] = 'INTERNET'; $info['phpgwMailType'] = 'INTERNET';
$info['phpgwMailHomeType'] = 'INTERNET'; $info['phpgwMailHomeType'] = 'INTERNET';
$info["uid"] = $this->id. ":".$info["sn"]; $info["uid"] = $this->id. ":".$info["sn"];
$info["phpgwContactTypeId"] = 'n'; $info["phpgwContactTypeId"] = 'n';
$info["phpgwContactCatId"] = 0; $info["phpgwContactCatId"] = 0;
$info["phpgwContactAccess"] = "public"; $info["phpgwContactAccess"] = "public";
$info["phpgwContactOwner"] = $user->egroupware_id; $info["phpgwContactOwner"] = $user->egroupware_id;
if ($this->phone_mobile) if ($this->phone_mobile)
$info["phpgwCellTelephoneNumber"] = dolibarr_print_phone($this->phone_mobile); $info["phpgwCellTelephoneNumber"] = dolibarr_print_phone($this->phone_mobile);
} }
else else
{ {
if ($this->email) if ($this->email)
$info["mail"] = $this->email; $info["mail"] = $this->email;
} }
$dnshort = explode(",", LDAP_SERVER_DN,2); $dnshort = explode(",", LDAP_SERVER_DN,2);
$dn = "cn=".$info["cn"].","."ou=".$info["ou"].",".$dnshort[1]; $dn = "cn=".$info["cn"].","."ou=".$info["ou"].",".$dnshort[1];
$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));
var_dump($info); var_dump($info);
} }
} }
else else
{ {
echo "Connection au dn $dn échoué !"; echo "Connection au dn $dn échoué !";
} }
dolibarr_ldap_unbind($ds); dolibarr_ldap_unbind($ds);
} }
else else
{ {
echo "Impossible de se connecter au serveur LDAP !"; echo "Impossible de se connecter au serveur LDAP !";
} }
} }
/* /*
* Mise à jour des infos persos * Mise à jour des infos persos
* *
@ -269,7 +269,7 @@ class Contact
*/ */
Function fetch($id, $user=0) Function fetch($id, $user=0)
{ {
$sql = "SELECT c.idp, c.fk_soc, c.name, c.firstname, c.email, phone, phone_perso, phone_mobile, jabberid, c.birthday, c.note, poste"; $sql = "SELECT c.idp, c.fk_soc, c.name, c.firstname, c.email, phone, phone_perso, phone_mobile, fax, jabberid, c.birthday, c.note, poste";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " WHERE c.idp = $id"; $sql .= " WHERE c.idp = $id";
@ -292,6 +292,7 @@ class Contact
$this->fullname = $this->firstname . ' ' . $this->name; $this->fullname = $this->firstname . ' ' . $this->name;
$this->phone_pro = dolibarr_print_phone($obj->phone); $this->phone_pro = dolibarr_print_phone($obj->phone);
$this->fax = dolibarr_print_phone($obj->fax);
$this->phone_perso = dolibarr_print_phone($obj->phone_perso); $this->phone_perso = dolibarr_print_phone($obj->phone_perso);
$this->phone_mobile = dolibarr_print_phone($obj->phone_mobile); $this->phone_mobile = dolibarr_print_phone($obj->phone_mobile);

View File

@ -35,7 +35,7 @@ if ($_POST["action"] == 'add')
$contact->name = $_POST["name"]; $contact->name = $_POST["name"];
$contact->firstname = $_POST["firstname"]; $contact->firstname = $_POST["firstname"];
$contact->civilite_id = $_POST["civilite_id"]; $contact->civilite_id = $_POST["civilite_id"];
$contact->poste = $_POST["poste"]; $contact->poste = $_POST["poste"];
$contact->address = $_POST["adresse"]; $contact->address = $_POST["adresse"];
$contact->cp = $_POST["cp"]; $contact->cp = $_POST["cp"];
@ -226,7 +226,7 @@ elseif ($_GET["action"] == 'edit')
print '<tr><td>CP Ville</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80">&nbsp;<input name="cp" type="text" size="20" maxlength="80"></td>'; print '<tr><td>CP Ville</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80">&nbsp;<input name="cp" type="text" size="20" maxlength="80"></td>';
print '<td>Fax</td><td><input name="fax" type="text" size="18" maxlength="80"></td></tr>'; print '<td>Fax</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
print '<tr><td>Email</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>'; print '<tr><td>Email</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>'; print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';