Ajout des numros de tlphone sur la fiche adhrent
Fix: Correction sauvegarde date naissance fiche adhrent. Ajout script exemple synchor ldap2dolibarr
This commit is contained in:
parent
ba8a4f8402
commit
64472b3810
@ -50,6 +50,8 @@ class Adherent
|
||||
var $prenom;
|
||||
var $nom;
|
||||
var $fullname;
|
||||
var $login;
|
||||
var $pass;
|
||||
var $societe;
|
||||
var $adresse;
|
||||
var $cp;
|
||||
@ -57,18 +59,21 @@ class Adherent
|
||||
var $pays_id;
|
||||
var $pays_code;
|
||||
var $pays;
|
||||
var $morphy;
|
||||
|
||||
var $email;
|
||||
var $phone;
|
||||
var $phone_perso;
|
||||
var $phone_mobile;
|
||||
|
||||
var $morphy;
|
||||
var $public;
|
||||
var $commentaire;
|
||||
var $statut;
|
||||
var $login;
|
||||
var $pass;
|
||||
var $statut; // -1=brouillon, 0=résilié, 1=validé,payé
|
||||
var $naiss;
|
||||
var $photo;
|
||||
|
||||
var $typeid; // Id type adherent
|
||||
var $type; // Libellé type adherent
|
||||
var $type; // Libellé type adherent
|
||||
var $need_subscription;
|
||||
|
||||
// var $public;
|
||||
@ -95,7 +100,7 @@ class Adherent
|
||||
|
||||
|
||||
/**
|
||||
\brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
||||
\brief Fonction envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
||||
\param recipients destinataires
|
||||
\param text contenu du message
|
||||
\param subject sujet du message
|
||||
@ -338,7 +343,7 @@ class Adherent
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||
$result=$this->update(1);
|
||||
$result=$this->update($user,1);
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
@ -362,9 +367,9 @@ class Adherent
|
||||
\param notrigger 1=désactive le trigger UPDATE (quand appelé par creation)
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function update($notrigger=0)
|
||||
function update($user,$notrigger=0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf,$langs;
|
||||
|
||||
dolibarr_syslog("Adherent.class::update $notrigger");
|
||||
|
||||
@ -380,21 +385,24 @@ class Adherent
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " prenom = '".$this->prenom ."'";
|
||||
$sql .= ",nom='" .$this->nom."'";
|
||||
$sql .= ",login='" .$this->login."'";
|
||||
$sql .= ",pass='" .$this->pass."'";
|
||||
$sql .= ",societe='".$this->societe."'";
|
||||
$sql .= ",adresse='".$this->adresse."'";
|
||||
$sql .= ",cp='" .$this->cp."'";
|
||||
$sql .= ",ville='" .$this->ville."'";
|
||||
$sql .= ",pays='" .$this->pays_code."'";
|
||||
$sql .= ",note='" .$this->commentaire."'";
|
||||
$sql .= ",email='" .$this->email."'";
|
||||
$sql .= ",login='" .$this->login."'";
|
||||
$sql .= ",pass='" .$this->pass."'";
|
||||
$sql .= ",naiss=" .($this->naiss?"'".$this->naiss."'":"null");
|
||||
$sql .= ",phone=" .($this->phone?"'".addslashes($this->phone)."'":"null");
|
||||
$sql .= ",phone_perso=" .($this->phone_perso?"'".addslashes($this->phone_perso)."'":"null");
|
||||
$sql .= ",phone_mobile=" .($this->phone_mobile?"'".addslashes($this->phone_mobile)."'":"null");
|
||||
$sql .= ",note=" .($this->commentaire?"'".addslashes($this->commentaire)."'":"null");
|
||||
$sql .= ",naiss=" .$this->db->idate($this->naiss);
|
||||
$sql .= ",photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql .= ",public='" .$this->public."'";
|
||||
$sql .= ",statut=" .$this->statut;
|
||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||
$sql .= ",morphy='".$this->morphy."'";
|
||||
$sql .= ",morphy='" .$this->morphy."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Adherent::update sql=$sql");
|
||||
@ -500,30 +508,29 @@ class Adherent
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui récupére l'adhérent en donnant son login
|
||||
\param login login de l'adhérent
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Fonction qui récupére l'adhérent en donnant son login
|
||||
* \param login login de l'adhérent
|
||||
*/
|
||||
function fetch_login($login)
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1";
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->fetch($obj->rowid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1";
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->fetch($obj->rowid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -535,7 +542,9 @@ class Adherent
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy,";
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,";
|
||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||
$sql.= " d.naiss, d.photo, d.fk_adherent_type, d.morphy,";
|
||||
$sql.= " ".$this->db->pdate("d.datefin")." as datefin,";
|
||||
$sql.= " d.pays, p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,";
|
||||
$sql.= " t.libelle as type, t.cotisation as cotisation";
|
||||
@ -552,12 +561,11 @@ class Adherent
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
$this->date = $obj->datedon;
|
||||
$this->prenom = $obj->prenom;
|
||||
$this->nom = $obj->nom;
|
||||
$this->fullname = trim($obj->nom.' '.$obj->prenom);
|
||||
$this->login = $obj->login;
|
||||
$this->pass = $obj->pass;
|
||||
$this->societe = $obj->societe;
|
||||
$this->adresse = $obj->adresse;
|
||||
$this->cp = $obj->cp;
|
||||
@ -567,11 +575,15 @@ class Adherent
|
||||
if ($langs->trans("Country".$obj->pays_code) != "Country".$obj->pays_code) $this->pays = $langs->trans("Country".$obj->pays_code);
|
||||
elseif ($obj->pays_lib) $this->pays=$obj->pays_lib;
|
||||
else $this->pays=$obj->pays;
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_perso = $obj->phone_perso;
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$this->email = $obj->email;
|
||||
$this->login = $obj->login;
|
||||
$this->pass = $obj->pass;
|
||||
$this->naiss = $obj->naiss;
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
$this->date = $obj->datedon;
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->commentaire = $obj->note;
|
||||
$this->morphy = $obj->morphy;
|
||||
@ -1614,10 +1626,11 @@ class Adherent
|
||||
// Initialise paramètres
|
||||
$this->id=0;
|
||||
$this->specimen=1;
|
||||
$this->fullname = 'DOLIBARR SPECIMEN';
|
||||
$this->nom = 'DOLIBARR';
|
||||
$this->prenom = 'SPECIMEN';
|
||||
$this->fullname=trim($this->nom.' '.$this->prenom);
|
||||
$this->login='dolibspec';
|
||||
$this->pass='dolibspec';
|
||||
$this->societe = 'Societe ABC';
|
||||
$this->adresse = '61 jump street';
|
||||
$this->cp = '75000';
|
||||
@ -1625,15 +1638,16 @@ class Adherent
|
||||
$this->pays_id = 1;
|
||||
$this->pays_code = 'FR';
|
||||
$this->pays = 'France';
|
||||
$this->moraphy = 1;
|
||||
$this->morphy = 1;
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->public=1;
|
||||
$this->phone = '0999999999';
|
||||
$this->phone_perso = '0999999998';
|
||||
$this->phone_mobile = '0999999997';
|
||||
$this->commentaire='No comment';
|
||||
$this->statut=1;
|
||||
$this->login='dolibspec';
|
||||
$this->pass='dolibspec';
|
||||
$this->naiss=time();
|
||||
$this->photo='';
|
||||
$this->public=1;
|
||||
$this->statut=1;
|
||||
|
||||
$this->typeid=1; // Id type adherent
|
||||
$this->type='Type adherent'; // Libellé type adherent
|
||||
@ -1687,19 +1701,20 @@ class Adherent
|
||||
|
||||
// Champs
|
||||
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
||||
if ($this->nom && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
|
||||
if ($this->nom && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
|
||||
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
||||
if ($this->poste) $info["title"] = $this->poste;
|
||||
if ($this->address && $conf->global->LDAP_FIELD_ADDRESS) $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
||||
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
||||
if ($this->ville && $conf->global->LDAP_FIELD_TOWN) $info[$conf->global->LDAP_FIELD_TOWN] = $this->ville;
|
||||
if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = $this->phone_pro;
|
||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
||||
if ($this->poste && $conf->global->LDAP_FIELD_TITLE) $info[$conf->global->LDAP_FIELD_TITLE] = $this->poste;
|
||||
if ($this->address && $conf->global->LDAP_FIELD_ADDRESS) $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
||||
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
||||
if ($this->ville && $conf->global->LDAP_FIELD_TOWN) $info[$conf->global->LDAP_FIELD_TOWN] = $this->ville;
|
||||
if ($this->pays && $conf->global->LDAP_FIELD_COUNTRY) $info[$conf->global->LDAP_FIELD_COUNTRY] = $this->pays;
|
||||
if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = $this->phone_pro;
|
||||
if ($this->phone_perso) $info["homePhone"] = $this->phone_perso;
|
||||
if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile;
|
||||
if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
|
||||
if ($this->note && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note;
|
||||
if ($this->email && $conf->global->LDAP_FIELD_MAIL) $info[$conf->global->LDAP_FIELD_MAIL] = $this->email;
|
||||
if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
|
||||
if ($this->email && $conf->global->LDAP_FIELD_MAIL) $info[$conf->global->LDAP_FIELD_MAIL] = $this->email;
|
||||
if ($this->commentaire && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->commentaire;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
@ -129,22 +129,30 @@ if ($_REQUEST["action"] == 'update')
|
||||
$adh->id = $_POST["rowid"];
|
||||
$adh->prenom = $_POST["prenom"];
|
||||
$adh->nom = $_POST["nom"];
|
||||
$adh->societe = $_POST["societe"];
|
||||
$adh->adresse = $_POST["adresse"];
|
||||
$adh->amount = $_POST["amount"];
|
||||
$adh->cp = $_POST["cp"];
|
||||
$adh->ville = $_POST["ville"];
|
||||
$adh->email = $_POST["email"];
|
||||
$adh->fullname = trim($adh->prenom.' '.$adh->nom);
|
||||
$adh->login = $_POST["login"];
|
||||
$adh->pass = $_POST["pass"];
|
||||
$adh->naiss = $_POST["naiss"];
|
||||
$adh->photo = $_POST["photo"];
|
||||
$adh->date = $datenaiss;
|
||||
$adh->note = $_POST["note"];
|
||||
|
||||
$adh->societe = $_POST["societe"];
|
||||
$adh->adresse = $_POST["adresse"];
|
||||
$adh->cp = $_POST["cp"];
|
||||
$adh->ville = $_POST["ville"];
|
||||
$adh->pays = $_POST["pays"];
|
||||
|
||||
$adh->phone = $_POST["phone"];
|
||||
$adh->phone_perso = $_POST["phone_perso"];
|
||||
$adh->phone_mobile= $_POST["phone_mobile"];
|
||||
$adh->email = $_POST["email"];
|
||||
$adh->naiss = $_POST["naiss"];
|
||||
$adh->date = $adh->naiss;
|
||||
$adh->photo = $_POST["photo"];
|
||||
|
||||
$adh->typeid = $_POST["type"];
|
||||
$adh->commentaire = $_POST["comment"];
|
||||
$adh->morphy = $_POST["morphy"];
|
||||
|
||||
$adh->amount = $_POST["amount"];
|
||||
|
||||
// recuperation du statut et public
|
||||
$adh->statut = $_POST["statut"];
|
||||
$adh->public = $_POST["public"];
|
||||
@ -156,7 +164,7 @@ if ($_REQUEST["action"] == 'update')
|
||||
$adh->array_options[$key]=$_POST[$key];
|
||||
}
|
||||
}
|
||||
if ($adh->update(0) >= 0)
|
||||
if ($adh->update($user,0) >= 0)
|
||||
{
|
||||
Header("Location: fiche.php?rowid=".$adh->id);
|
||||
exit;
|
||||
@ -197,11 +205,14 @@ if ($_POST["action"] == 'add')
|
||||
$cp=$_POST["cp"];
|
||||
$ville=$_POST["ville"];
|
||||
$pays_code=$_POST["pays_code"];
|
||||
|
||||
$phone=$_POST["phone"];
|
||||
$phone_perso=$_POST["phone_perso"];
|
||||
$phone_mobile=$_POST["phone_mobile"];
|
||||
$email=$_POST["member_email"];
|
||||
$login=$_POST["member_login"];
|
||||
$pass=$_POST["member_pass"];
|
||||
$photo=$_POST["photo"];
|
||||
$note=$_POST["note"];
|
||||
$comment=$_POST["comment"];
|
||||
$morphy=$_POST["morphy"];
|
||||
$cotisation=$_POST["cotisation"];
|
||||
@ -214,12 +225,14 @@ if ($_POST["action"] == 'add')
|
||||
$adh->cp = $cp;
|
||||
$adh->ville = $ville;
|
||||
$adh->pays_code = $pays_code;
|
||||
$adh->phone = $phone;
|
||||
$adh->phone_perso = $phone_perso;
|
||||
$adh->phone_mobile= $phone_mobile;
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->naiss = $datenaiss;
|
||||
$adh->photo = $photo;
|
||||
$adh->note = $note;
|
||||
$adh->typeid = $type;
|
||||
$adh->commentaire = $comment;
|
||||
$adh->morphy = $morphy;
|
||||
@ -482,17 +495,26 @@ if ($action == 'edit')
|
||||
print "<input type=\"hidden\" name=\"public\" value=\"".$adh->public."\">";
|
||||
|
||||
$htmls = new Form($db);
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$adh->id.' </td></tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td>'.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td>';
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</td></tr>';
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Notes").'</td></tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td>';
|
||||
$rowspan=13;
|
||||
$rowspan=16;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></td></tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
|
||||
// Password
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||
$htmls->select_array("type", $adht->liste_array(), $adh->typeid);
|
||||
@ -511,14 +533,27 @@ if ($action == 'edit')
|
||||
// Adresse
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.$adh->adresse.'</textarea></td></tr>';
|
||||
|
||||
// Cp
|
||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="32" value="'.$adh->ville.'"></td></tr>';
|
||||
|
||||
// Pays
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
||||
|
||||
// Tel
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.$adh->phone.'"></td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.$adh->phone_perso.'"></td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.$adh->phone_mobile.'"></td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
|
||||
$htmls->select_date(-1,'naiss','','',1,'update');
|
||||
@ -560,18 +595,18 @@ if ($action == 'create')
|
||||
|
||||
// Nom
|
||||
print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" value="'.$adh->nom.'" size="40"></td>';
|
||||
print '<td width="50%" valign="top">'.$langs->trans("Comments").' :</td></tr>';
|
||||
print '<td width="50%" valign="top">'.$langs->trans("Notes").' :</td></tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td>';
|
||||
$rowspan=12;
|
||||
print '<td valign="top" rowspan="'.$rowspan.'"><textarea name="comment" wrap="soft" cols="60" rows="12"></textarea></td></tr>';
|
||||
$rowspan=15;
|
||||
print '<td valign="top" rowspan="'.$rowspan.'"><textarea name="comment" wrap="soft" cols="60" rows="12">'.$adh->commantaire.'</textarea></td></tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td><input type="text" name="member_login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
|
||||
// Mot de pass
|
||||
print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="member_pass" size="40" value="'.$adh->password.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="member_pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("MemberType").'*</td><td>';
|
||||
@ -595,22 +630,31 @@ if ($action == 'create')
|
||||
|
||||
// Adresse
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2"></textarea></td></tr>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.$adh->adresse.'</textarea></td></tr>';
|
||||
|
||||
// CP
|
||||
// CP / Ville
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="32" value="'.$adh->ville.'"></td></tr>';
|
||||
|
||||
// Ville
|
||||
// Pays
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays_code');
|
||||
print '</td></tr>';
|
||||
|
||||
// Tel pro
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.$adh->phone.'"></td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.$adh->phone_perso.'"></td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.$adh->phone_mobile.'"></td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="member_email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
|
||||
$htmls->select_date(-1,'naiss','','',1,'add');
|
||||
$htmls->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'add');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Url photo
|
||||
@ -756,7 +800,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
// Nom
|
||||
print '<tr><td>'.$langs->trans("Lastname").'*</td><td class="valeur">'.$adh->nom.' </td>';
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</td></tr>';
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Notes").'</td></tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td>'.$langs->trans("Firstname").'*</td><td class="valeur">'.$adh->prenom.' </td>';
|
||||
@ -768,22 +812,50 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'*</td><td class="valeur">'.$adh->type."</td></tr>\n";
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$adh->getmorphylib().'</td></tr>';
|
||||
|
||||
// Tiers
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.' </td></tr>';
|
||||
|
||||
// Adresse
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).' </td></tr>';
|
||||
|
||||
// CP / Ville
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.' </td></tr>';
|
||||
|
||||
// Pays
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.'</td></tr>';
|
||||
|
||||
// Tel pro.
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.$adh->phone.'</td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.$adh->phone_perso.'</td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.$adh->phone_mobile.'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$adh->naiss.' </td></tr>';
|
||||
|
||||
// URL
|
||||
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.' </td></tr>';
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">';
|
||||
if ($adh->public==1) print $langs->trans("Yes");
|
||||
else print $langs->trans("No");
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Autres attributs
|
||||
foreach($adho->attribute_label as $key=>$value){
|
||||
print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]." </td></tr>\n";
|
||||
}
|
||||
|
||||
@ -61,6 +61,11 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',$_POST["fieldphone"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',$_POST["fieldfax"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',$_POST["fieldmobile"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',$_POST["fieldaddress"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_ZIP',$_POST["fieldzip"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_TOWN',$_POST["fieldtown"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY',$_POST["fieldcountry"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',$_POST["fielddescription"])) $error++;
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@ -200,6 +205,45 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_FAX.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_FAX?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_ADDRESS.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_ADDRESS?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// CP
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_ZIP.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_ZIP?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Ville
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_TOWN.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_TOWN?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Pays
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCountryExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_COUNTRY.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_COUNTRY?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Description
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_DESCRIPTION?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||
|
||||
@ -297,6 +297,7 @@ class Conf
|
||||
$this->export->dir_temp =DOL_DATA_ROOT."/export/temp";
|
||||
// Module ldap
|
||||
$this->ldap->enabled=defined("MAIN_MODULE_LDAP")?MAIN_MODULE_LDAP:0;
|
||||
$this->ldap->dir_temp=DOL_DATA_ROOT."/ldap/temp";
|
||||
// Module FCKeditor
|
||||
$this->fckeditor->enabled=defined("MAIN_MODULE_FCKEDITOR")?MAIN_MODULE_FCKEDITOR:0;
|
||||
$this->fckeditor->dir_output=DOL_DATA_ROOT."/fckeditor";
|
||||
|
||||
@ -304,10 +304,10 @@ if ($user->rights->societe->contact->creer)
|
||||
$form->select_pays($contact->fk_pays);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
@ -382,10 +382,10 @@ if ($user->rights->societe->contact->creer)
|
||||
$form->select_pays($contact->fk_pays);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td><input name="email" type="text" size="40" maxlength="80" value="'.$contact->email.'"></td>';
|
||||
@ -501,10 +501,10 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
print $contact->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td>'.$contact->phone_pro.'</td>';
|
||||
print '<td>Tel Perso</td><td>'.$contact->phone_perso.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.$contact->phone_pro.'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.$contact->phone_perso.'</td></tr>';
|
||||
|
||||
print '<tr><td>Portable</td><td>'.$contact->phone_mobile.'</td>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.$contact->phone_mobile.'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.$contact->fax.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td>';
|
||||
|
||||
@ -582,6 +582,8 @@ LDAPFieldZip=Zip
|
||||
LDAPFieldZipExample=Example : postalcode
|
||||
LDAPFieldTown=Town
|
||||
LDAPFieldTownExample=Example : l
|
||||
LDAPFieldCountry=Country
|
||||
LDAPFieldCountryExample=Example :
|
||||
LDAPFieldDescription=Description
|
||||
LDAPFieldDescriptionExample=Example : description
|
||||
LDAPFieldSid=SID
|
||||
|
||||
@ -38,6 +38,9 @@ Region=Region
|
||||
Country=Country
|
||||
CountryCode=Country code
|
||||
Phone=Phone
|
||||
PhonePro=Prof. phone
|
||||
PhonePerso=Pers. phone
|
||||
PhoneMobile=Mobile
|
||||
Fax=Fax
|
||||
Zip=Zip Code
|
||||
Town=Town
|
||||
|
||||
@ -582,6 +582,8 @@ LDAPFieldZip=Code postal
|
||||
LDAPFieldZipExample=Exemple : postalcode
|
||||
LDAPFieldTown=Ville
|
||||
LDAPFieldTownExample=Exemple : l
|
||||
LDAPFieldCountry=Pays
|
||||
LDAPFieldCountryExample=Exemple :
|
||||
LDAPFieldDescription=Description
|
||||
LDAPFieldDescriptionExample=Exemple : description
|
||||
LDAPFieldSid=SID
|
||||
|
||||
@ -38,6 +38,9 @@ Region=R
|
||||
Country=Pays
|
||||
CountryCode=Code pays
|
||||
Phone=Téléphone
|
||||
PhonePro=Tél pro.
|
||||
PhonePerso=Tél perso.
|
||||
PhoneMobile=Tél portable
|
||||
Fax=Fax
|
||||
Zip=Code postal
|
||||
Town=Ville
|
||||
|
||||
@ -221,8 +221,8 @@ class Ldap
|
||||
// Try in auth mode
|
||||
if ($conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS)
|
||||
{
|
||||
dolibarr_syslog("Ldap.class::connect_bind try authBind on ".$host." user=".$conf->global->LDAP_ADMIN_DN,LOG_DEBUG);
|
||||
$result=$this->authBind($conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS);
|
||||
dolibarr_syslog("Ldap.class::connect_bind try bindauth on ".$host." user=".$conf->global->LDAP_ADMIN_DN,LOG_DEBUG);
|
||||
$result=$this->bindauth($conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS);
|
||||
if ($result)
|
||||
{
|
||||
$this->bind=$this->result;
|
||||
@ -287,8 +287,8 @@ class Ldap
|
||||
{
|
||||
if (! $this->result=@ldap_bind($this->connection))
|
||||
{
|
||||
$this->ldapErrorCode = ldap_errno( $this->connection);
|
||||
$this->ldapErrorText = ldap_error( $this->connection);
|
||||
$this->ldapErrorCode = ldap_errno($this->connection);
|
||||
$this->ldapErrorText = ldap_error($this->connection);
|
||||
$this->error=$this->ldapErrorCode." ".$this->ldapErrorText;
|
||||
return false;
|
||||
}
|
||||
@ -304,14 +304,17 @@ class Ldap
|
||||
* "cn=Directory Manager" under iPlanet. For a user, it will be something
|
||||
* like "uid=jbloggs,ou=People,dc=foo,dc=com".
|
||||
*/
|
||||
function authBind( $bindDn,$pass)
|
||||
function bindauth($bindDn,$pass)
|
||||
{
|
||||
if ( !$this->result = @ldap_bind( $this->connection,$bindDn,$pass)) {
|
||||
$this->ldapErrorCode = ldap_errno( $this->connection);
|
||||
$this->ldapErrorText = ldap_error( $this->connection);
|
||||
if (! $this->result = @ldap_bind( $this->connection,$bindDn,$pass))
|
||||
{
|
||||
$this->ldapErrorCode = ldap_errno($this->connection);
|
||||
$this->ldapErrorText = ldap_error($this->connection);
|
||||
$this->error=$this->ldapErrorCode." ".$this->ldapErrorText;
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -585,7 +588,7 @@ class Ldap
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet utilisateru qui crée
|
||||
* \return boolean <0 si KO, >0 si OK
|
||||
* \return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function add($dn, $info, $user)
|
||||
{
|
||||
@ -600,6 +603,8 @@ class Ldap
|
||||
if (! is_array($val)) $info[$key]=$this->ldap_utf8_encode($val);
|
||||
}
|
||||
|
||||
$this->dump($dn,$info);
|
||||
|
||||
//print_r($info);
|
||||
$result=@ldap_add($this->connection, $dn, $info);
|
||||
|
||||
@ -610,7 +615,7 @@ class Ldap
|
||||
/*
|
||||
* \brief Delete a LDAP entry
|
||||
* \param dn DN entry key
|
||||
* \return boolean <0 si KO, >0 si OK
|
||||
* \return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function delete($dn)
|
||||
{
|
||||
@ -628,6 +633,40 @@ class Ldap
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Dump a LDAP message to ldapinput.in file
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function dump($dn, $info)
|
||||
{
|
||||
global $conf;
|
||||
create_exdir($conf->ldap->dir_temp);
|
||||
|
||||
$file=$conf->ldap->dir_temp.'/ldapinput.in';
|
||||
$fp=fopen($file,"w");
|
||||
if ($fp)
|
||||
{
|
||||
fputs($fp, "dn: ".$dn."\n");
|
||||
foreach($info as $key => $value)
|
||||
{
|
||||
if (! is_array($value))
|
||||
{
|
||||
fputs($fp, "$key: $value\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($value as $valuekey => $valuevalue)
|
||||
{
|
||||
fputs($fp, "$key: $valuevalue\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2.4 Attribute methods -----------------------------------------------------
|
||||
/**
|
||||
@ -680,7 +719,7 @@ class Ldap
|
||||
|
||||
// if the directory is AD, then bind first with the search user first
|
||||
if ($this->serverType == "activedirectory") {
|
||||
$this->authBind($this->searchUser, $this->searchPassword);
|
||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||
}
|
||||
|
||||
$filter = '('.$useridentifier.'='.$search.')';
|
||||
@ -715,25 +754,6 @@ class Ldap
|
||||
return $userslist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le SID de l'utilisateur
|
||||
* ldapuser. le login de l'utilisateur
|
||||
* \deprecated
|
||||
*/
|
||||
function getObjectSid($ldapUser)
|
||||
{
|
||||
$criteria = $this->getUserIdentifier()."=$ldapUser";
|
||||
$justthese = array("objectsid");
|
||||
|
||||
$ldapSearchResult = ldap_search($this->connection, $this->people, $criteria, $justthese);
|
||||
|
||||
$entry = ldap_first_entry($this->connection, $ldapSearchResult);
|
||||
$ldapBinary = ldap_get_values_len ($this->connection, $entry, "objectsid");
|
||||
$SIDText = $this->binSIDtoText($ldapBinary[0]);
|
||||
return $SIDText;
|
||||
return $ldapBinary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a little-endian hex-number to one, that 'hexdec' can convert
|
||||
* \deprecated
|
||||
@ -745,26 +765,9 @@ class Ldap
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the textual SID
|
||||
* \deprecated
|
||||
*/
|
||||
function binSIDtoText($binsid) {
|
||||
$hex_sid=bin2hex($binsid);
|
||||
$rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID
|
||||
$subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
|
||||
$auth = hexdec(substr($hex_sid,4,12)); // SECURITY_NT_AUTHORITY
|
||||
$result = "$rev-$auth";
|
||||
for ($x=0;$x < $subcount; $x++) {
|
||||
$subauth[$x] = hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY
|
||||
$result .= "-".$subauth[$x];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction de recherche avec filtre
|
||||
* \remarks this->connection doit etre défini donc la methode bind ou authbind doit avoir deja été appelée
|
||||
* \remarks this->connection doit etre défini donc la methode bind ou bindauth doit avoir deja été appelée
|
||||
* \param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
|
||||
* \param filter Filtre de recherche (ex: (sn=nom_personne) )
|
||||
* \return array Tableau des reponses
|
||||
@ -778,7 +781,7 @@ class Ldap
|
||||
|
||||
// if the directory is AD, then bind first with the search user first
|
||||
if ($this->serverType == "activedirectory") {
|
||||
$this->authBind($this->searchUser, $this->searchPassword);
|
||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||
}
|
||||
|
||||
$this->result = @ldap_search($this->connection, $checkDn, $filter);
|
||||
@ -807,7 +810,7 @@ class Ldap
|
||||
|
||||
// if the directory is AD, then bind first with the search user first
|
||||
if ($this->serverType == "activedirectory") {
|
||||
$this->authBind($this->searchUser, $this->searchPassword);
|
||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||
}
|
||||
$userIdentifier = $this->getUserIdentifier();
|
||||
|
||||
@ -877,23 +880,6 @@ class Ldap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief permet d'enlever les accents d'une chaine.
|
||||
* \param str
|
||||
* \return string
|
||||
*/
|
||||
function dolibarr_ldap_unacc($str)
|
||||
{
|
||||
$stu = ereg_replace("é","e",$str);
|
||||
$stu = ereg_replace("è","e",$stu);
|
||||
$stu = ereg_replace("ê","e",$stu);
|
||||
$stu = ereg_replace("à","a",$stu);
|
||||
$stu = ereg_replace("ç","c",$stu);
|
||||
$stu = ereg_replace("ï","i",$stu);
|
||||
$stu = ereg_replace("ä","a",$stu);
|
||||
return $stu;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief UserAccountControl Flgs to more human understandable form...
|
||||
*
|
||||
|
||||
@ -442,7 +442,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
|
||||
print '<form action="fiche.php" method="post" name="createuser">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
if ($ldap_SID) print '<input type="hidden" name="ldap_sid" value="'.$ldap_SID.'">';
|
||||
if ($ldap_sid) print '<input type="hidden" name="ldap_sid" value="'.$ldap_sid.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -488,7 +488,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (!$ldap_SID)
|
||||
if (!$ldap_sid)
|
||||
{
|
||||
$generated_password='';
|
||||
if ($conf->global->USER_PASSWORD_GENERATED)
|
||||
@ -505,7 +505,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
// Mot de passe
|
||||
print '<tr><td valign="top">'.$langs->trans("Password").'</td>';
|
||||
print '<td>';
|
||||
if ($ldap_SID)
|
||||
if ($ldap_sid)
|
||||
{
|
||||
print 'mot de passe du domaine';
|
||||
}
|
||||
|
||||
@ -479,6 +479,11 @@ alter table llx_facturedet_rec add column total_ht real;
|
||||
alter table llx_facturedet_rec add column total_tva real;
|
||||
alter table llx_facturedet_rec add column total_ttc real;
|
||||
|
||||
alter table llx_adherent add column phone varchar(30) after email;
|
||||
alter table llx_adherent add column phone_perso varchar(30) after phone;
|
||||
alter table llx_adherent add column phone_mobile varchar(30) after phone_perso;
|
||||
|
||||
|
||||
|
||||
update llx_facture set fk_facture_source=null where fk_facture_source is not null and type = 0;
|
||||
|
||||
|
||||
@ -22,36 +22,42 @@
|
||||
-- ===================================================================
|
||||
--
|
||||
-- statut
|
||||
-- 0 : non adherent
|
||||
-- 1 : adherent
|
||||
-- -1 : brouillon
|
||||
-- 0 : resilie
|
||||
-- 1 : valide
|
||||
|
||||
create table llx_adherent
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
statut smallint NOT NULL DEFAULT 0,
|
||||
public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
|
||||
nom varchar(50),
|
||||
prenom varchar(50),
|
||||
login varchar(50) NOT NULL, -- login
|
||||
pass varchar(50), -- password
|
||||
fk_adherent_type smallint,
|
||||
morphy enum('mor','phy') NOT NULL, -- personne morale / personne physique
|
||||
datevalid datetime, -- date de validation
|
||||
datec datetime, -- date de creation
|
||||
prenom varchar(50),
|
||||
nom varchar(50),
|
||||
societe varchar(50),
|
||||
adresse text,
|
||||
cp varchar(30),
|
||||
ville varchar(50),
|
||||
pays varchar(50),
|
||||
email varchar(255),
|
||||
login varchar(50) NOT NULL, -- login utilise pour editer sa fiche
|
||||
pass varchar(50), -- pass utilise pour editer sa fiche
|
||||
phone varchar(30),
|
||||
phone_perso varchar(30),
|
||||
phone_mobile varchar(30),
|
||||
naiss date, -- date de naissance
|
||||
photo varchar(255), -- url vers la photo de l'adherent
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
fk_user_valid integer NOT NULL,
|
||||
photo varchar(255), -- url vers photo
|
||||
|
||||
statut smallint NOT NULL DEFAULT 0,
|
||||
public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
|
||||
datefin datetime, -- date de fin de validité de la cotisation
|
||||
note text,
|
||||
|
||||
datevalid datetime, -- date de validation
|
||||
datec datetime, -- date de creation
|
||||
tms timestamp, -- date de modification
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
fk_user_valid integer NOT NULL
|
||||
|
||||
UNIQUE INDEX(login)
|
||||
)type=innodb;
|
||||
|
||||
@ -72,8 +72,13 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$ldap->error="";
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$member = new Adherent($db);
|
||||
@ -81,7 +86,10 @@ if ($resql)
|
||||
|
||||
print $langs->trans("UpdateMember")." rowid=".$member->id." ".$member->fullname;
|
||||
|
||||
$result=$member->update_ldap($user);
|
||||
$info=$member->_load_ldap_info();
|
||||
$dn=$member->_load_ldap_dn($info);
|
||||
|
||||
$result=$ldap->update($dn,$info,$user);
|
||||
if ($result > 0)
|
||||
{
|
||||
print " - ".$langs->trans("OK");
|
||||
@ -89,12 +97,15 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
print " - ".$langs->trans("KO").' - '.$member->error;
|
||||
print " - ".$langs->trans("KO").' - '.$ldap->error;
|
||||
}
|
||||
print "\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
155
scripts/adherents/sync_member_ldap2dolibarr.php
Normal file
155
scripts/adherents/sync_member_ldap2dolibarr.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file scripts/adherents/sync_member_ldap2dolibarr.php
|
||||
\ingroup ldap adherent
|
||||
\brief Script de mise a jour des adherents dans Dolibarr depuis LDAP
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (eregi('([^\\\/]+)$',$script_file,$reg)) $script_file=$reg[1];
|
||||
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer $script_file en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! isset($argv[1]) || ! is_numeric($argv[1])) {
|
||||
print "Usage: $script_file id_member_type\n";
|
||||
exit;
|
||||
}
|
||||
$typeid=$argv[1];
|
||||
|
||||
// Recupere env dolibarr
|
||||
$version='$Revision$';
|
||||
$path=eregi_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
print "***** $script_file ($version) *****\n";
|
||||
|
||||
if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
|
||||
if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
|
||||
|
||||
/*
|
||||
if (! $conf->global->LDAP_MEMBER_ACTIVE)
|
||||
{
|
||||
print $langs->trans("LDAPSynchronizationNotSetupInDolibarr");
|
||||
exit 1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
if ($result >= 0)
|
||||
{
|
||||
$justthese=array();
|
||||
|
||||
$ldaprecords = $ldap->search($conf->global->LDAP_MEMBER_DN, '('.$conf->global->LDAP_KEY_MEMBERS.'=*)');
|
||||
if (is_array($ldaprecords))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
foreach ($ldaprecords as $key => $ldapuser)
|
||||
{
|
||||
if ($key == 'count') continue;
|
||||
|
||||
$member = new Adherent($db);
|
||||
|
||||
// Propriete membre
|
||||
$member->prenom=$ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME][0];
|
||||
$member->nom=$ldapuser[$conf->global->LDAP_FIELD_NAME][0];
|
||||
$member->fullname=($ldapuser[$conf->global->LDAP_FIELD_FULLNAME][0] ? $ldapuser[$conf->global->LDAP_FIELD_FULLNAME][0] : trim($member->prenom." ".$member->nom));
|
||||
//$member->societe;
|
||||
//$member->adresse=$ldapuser[$conf->global->LDAP_FIELD_FULLNAME]
|
||||
//$member->cp;
|
||||
//$member->ville;
|
||||
//$member->pays_id;
|
||||
//$member->pays_code;
|
||||
//$member->pays;
|
||||
//$member->morphy;
|
||||
$member->email=$ldapuser[$conf->global->LDAP_FIELD_EMAIL][0];
|
||||
//$member->public;
|
||||
//$member->commentaire;
|
||||
$member->statut=-1;
|
||||
$member->login=$ldapuser[$conf->global->LDAP_FIELD_LOGIN][0];
|
||||
//$member->pass;
|
||||
//$member->naiss;
|
||||
//$member->photo;
|
||||
|
||||
// Propriete type membre
|
||||
$member->typeid=$typeid;
|
||||
|
||||
|
||||
//----------------------------
|
||||
// YOUR OWN RULES HERE
|
||||
//----------------------------
|
||||
|
||||
|
||||
|
||||
//----------------------------
|
||||
// END
|
||||
//----------------------------
|
||||
|
||||
print $langs->trans("MemberCreate").' no '.$key.': '.$member->fullname."\n";
|
||||
|
||||
print_r($member);
|
||||
exit;
|
||||
|
||||
// $member->create();
|
||||
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error('',$ldap->error);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error('',$ldap->error);
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
return $error;
|
||||
?>
|
||||
@ -72,8 +72,13 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$ldap->error="";
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$contact = new Contact($db);
|
||||
@ -82,9 +87,6 @@ if ($resql)
|
||||
|
||||
print $langs->trans("UpdateContact")." rowid=".$contact->id." ".$contact->fullname;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
$info=$contact->_load_ldap_info();
|
||||
$dn=$contact->_load_ldap_dn($info);
|
||||
|
||||
@ -102,6 +104,9 @@ if ($resql)
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -72,8 +72,13 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$ldap->error="";
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$fgroup = new UserGroup($db);
|
||||
@ -82,9 +87,6 @@ if ($resql)
|
||||
|
||||
print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->nom;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
$info=$fgroup->_load_ldap_info();
|
||||
$dn=$fgroup->_load_ldap_dn($info);
|
||||
|
||||
@ -96,12 +98,15 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
print " - ".$langs->trans("KO").' - '.$fgroup->error;
|
||||
print " - ".$langs->trans("KO").' - '.$ldap->error;
|
||||
}
|
||||
print "\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -72,8 +72,13 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$ldap->error="";
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$fuser = new User($db);
|
||||
@ -82,9 +87,6 @@ if ($resql)
|
||||
|
||||
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;
|
||||
|
||||
$ldap=new Ldap();
|
||||
$ldap->connect_bind();
|
||||
|
||||
$info=$fuser->_load_ldap_info();
|
||||
$dn=$fuser->_load_ldap_dn($info);
|
||||
|
||||
@ -96,12 +98,15 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
print " - ".$langs->trans("KO").' - '.$fuser->error;
|
||||
print " - ".$langs->trans("KO").' - '.$ldap->error;
|
||||
}
|
||||
print "\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user