mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 03:51:25 +01:00
Ajout champ gr par la synchro LDAP du module adhrent.
This commit is contained in:
@@ -87,6 +87,11 @@ class Adherent
|
||||
var $user_id;
|
||||
var $user_login;
|
||||
|
||||
// Fiels loaded by fetch_subscriptions()
|
||||
var $fistsubscription_date;
|
||||
var $fistsubscription_amount;
|
||||
var $lastsubscription_date;
|
||||
var $lastsubscription_amount;
|
||||
|
||||
// var $public;
|
||||
var $array_options;
|
||||
@@ -758,7 +763,11 @@ class Adherent
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui r<>cup<75>re l'adh<EFBFBD>rent en donnant son rowid
|
||||
\brief Fonction qui r<>cup<75>re pour un adh<EFBFBD>rent les param<61>tres
|
||||
firstsubscription_date
|
||||
fistrsubscription_amount
|
||||
lastsubscription_date
|
||||
lastsubscription_amount
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function fetch_subscriptions()
|
||||
@@ -780,21 +789,23 @@ class Adherent
|
||||
$i=0;
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($i==0) $this->firstsubscription_date=$obj->dateadh;
|
||||
if ($i==0)
|
||||
{
|
||||
$this->firstsubscription_date=$obj->dateadh;
|
||||
$this->firstsubscription_amount=$obj->cotisation;
|
||||
}
|
||||
$this->lastsubscription_date=$obj->dateadh;
|
||||
$this->lastsubscription_amount=$obj->cotisation;
|
||||
|
||||
// TODO Completer avec records
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1921,6 +1932,11 @@ class Adherent
|
||||
$this->typeid=1; // Id type adherent
|
||||
$this->type='Type adherent'; // Libell<6C> type adherent
|
||||
$this->need_subscription=0;
|
||||
|
||||
$this->firstsubscription_date=time();
|
||||
$this->firstsubscription_amount=10;
|
||||
$this->lastsubscription_date=time();
|
||||
$this->lastsubscription_amount=10;
|
||||
}
|
||||
|
||||
|
||||
@@ -1956,7 +1972,7 @@ class Adherent
|
||||
// Object classes
|
||||
$info["objectclass"]=split(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
||||
|
||||
// Champs
|
||||
// Member
|
||||
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->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
||||
@@ -1973,15 +1989,14 @@ class Adherent
|
||||
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->commentaire && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->commentaire;
|
||||
if ($this->naiss && $conf->global->LDAP_FIELD_BIRTHDATE) $info[$conf->global->LDAP_FIELD_BIRTHDATE] = dolibarr_print_date($this->naiss,'%Y%m%d%H%M%SZ');
|
||||
if ($this->naiss && $conf->global->LDAP_FIELD_BIRTHDATE) $info[$conf->global->LDAP_FIELD_BIRTHDATE] = dolibarr_print_date($this->naiss,'dayhourldap');
|
||||
if ($this->statut && $conf->global->LDAP_FIELD_MEMBER_STATUS) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
||||
|
||||
if ($_ENV["PARINUX"])
|
||||
{
|
||||
$info["prnxFirstContribution"]=dolibarr_print_date($this->firstsubscription_date,'%Y%m%d%H%M%SZ');
|
||||
$info["prnxLastContribution"]=dolibarr_print_date($this->lastsubscription_date,'%Y%m%d%H%M%SZ');
|
||||
$info["prnxLastContributionPrice"]=$this->lastsubscription_amount;
|
||||
$info["prnxStatus"]=$this->statut;
|
||||
}
|
||||
// Subscriptions
|
||||
if ($this->firstsubscription_date && $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dolibarr_print_date($this->firstsubscription_date,'dayhourldap');
|
||||
if ($this->firstsubscription_amount && $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->firstsubscription_amount;
|
||||
if ($this->lastsubscription_date && $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dolibarr_print_date($this->lastsubscription_date,'dayhourldap');
|
||||
if ($this->lastsubscription_amount && $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->lastsubscription_amount;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
{
|
||||
$error=0;
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$_POST["key"])) $error++;
|
||||
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',$_POST["user"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',$_POST["objectclass"])) $error++;
|
||||
// Members
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FULLNAME',$_POST["fieldfullname"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_LOGIN',$_POST["fieldlogin"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_LOGIN_SAMBA',$_POST["fieldloginsamba"])) $error++;
|
||||
@@ -71,6 +71,13 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY',$_POST["fieldcountry"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',$_POST["fielddescription"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_BIRTHDATE',$_POST["fieldbirthdate"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS',$_POST["fieldstatus"])) $error++;
|
||||
|
||||
// Subscriptions
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE', $_POST["fieldfirstsubscriptiondate"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT',$_POST["fieldfirstsubscriptionamount"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', $_POST["fieldlastsubscriptiondate"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', $_POST["fieldlastsubscriptionamount"])) $error++;
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@@ -173,7 +180,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_FIRSTNAME?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login unix
|
||||
@@ -197,7 +204,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PASSWORD.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Password crypted
|
||||
@@ -205,7 +212,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Mail
|
||||
@@ -221,7 +228,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PHONE.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_PHONE?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Phone perso
|
||||
@@ -229,7 +236,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhonePerso").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldphoneperso" value="'.$conf->global->LDAP_FIELD_PHONE_PERSO.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPhonePersoExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PHONE_PERSO.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_PHONEHOME?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Mobile
|
||||
@@ -237,7 +244,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_MOBILE.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_MOBILE?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Fax
|
||||
@@ -245,7 +252,7 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">';
|
||||
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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
@@ -253,7 +260,7 @@ $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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// CP
|
||||
@@ -261,7 +268,7 @@ $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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ville
|
||||
@@ -269,7 +276,7 @@ $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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Pays
|
||||
@@ -277,7 +284,7 @@ $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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Description
|
||||
@@ -285,7 +292,7 @@ $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 '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date naissance
|
||||
@@ -293,7 +300,47 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldbirthdate" value="'.$conf->global->LDAP_FIELD_BIRTHDATE.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldBirthdateExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_BIRTHDATE.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_FIELD_BIRTHDATE?' checked="true"':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldStatus").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldstatus" value="'.$conf->global->LDAP_FIELD_MEMBER_STATUS.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// First subscription date
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstSubscriptionDate").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfirstsubscriptiondate" value="'.$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// First subscription amount
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstSubscriptionAmount").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfirstsubscriptionamount" value="'.$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Last subscription date
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLastSubscriptionDate").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldlastsubscriptiondate" value="'.$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Last subscription amount
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLastSubscriptionAmount").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldlastsubscriptionamount" value="'.$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
@@ -359,6 +406,10 @@ if (function_exists("ldap_connect"))
|
||||
print '</font><br>';
|
||||
}
|
||||
|
||||
print "<br>\n";
|
||||
print "LDAP input file used for test:<br><br>\n";
|
||||
print nl2br($ldap->dump_content($dn,$info));
|
||||
print "\n<br>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ LDAPCard=LDAP card
|
||||
LDAPRecordNotFound=Record not found in LDAP database
|
||||
LDAPUsers=Users in LDAP database
|
||||
LDAPGroups=Groups in LDAP database
|
||||
LDAPFieldStatus=Status
|
||||
LDAPFieldFirstSubscriptionDate=First subscription date
|
||||
LDAPFieldFirstSubscriptionAmount=Fist subscription amount
|
||||
LDAPFieldLastSubscriptionDate=Last subscription date
|
||||
LDAPFieldLastSubscriptionAmount=Last subscription amount
|
||||
SynchronizeDolibarr2Ldap=Synchronize user (Dolibarr -> LDAP)
|
||||
UserSynchronized=User synchronized
|
||||
ForceSynchronize=Force synchronizing Dolibarr -> LDAP
|
||||
|
||||
@@ -14,6 +14,11 @@ LDAPCard=Fiche LDAP
|
||||
LDAPRecordNotFound=Enregistrement non trouv<75> dans la base LDAP
|
||||
LDAPUsers=Utilisateurs en base LDAP
|
||||
LDAPGroups=Groupes en base LDAP
|
||||
LDAPFieldStatus=Statut
|
||||
LDAPFieldFirstSubscriptionDate=Date premi<6D>re adh<64>sion
|
||||
LDAPFieldFirstSubscriptionAmount=Montant premi<6D>re adh<64>sion
|
||||
LDAPFieldLastSubscriptionDate=Date derni<6E>re adh<64>sion
|
||||
LDAPFieldLastSubscriptionAmount=Montant derni<6E>re adh<64>sion
|
||||
SynchronizeDolibarr2Ldap=Synchroniser utilisateur (Dolibarr -> LDAP)
|
||||
UserSynchronized=Utilisateur synchronis<69>
|
||||
ForceSynchronize=Forcer synchro Dolibarr -> LDAP
|
||||
|
||||
@@ -491,7 +491,7 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
"%d %b %Y",
|
||||
"%d/%m/%Y %H:%M",
|
||||
"%d/%m/%Y %H:%M:%S",
|
||||
"day", "daytext", "dayhour", "dayhourtext"
|
||||
"day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
|
||||
\return string Date format<61>e ou '' si time null
|
||||
*/
|
||||
function dolibarr_print_date($time,$format='')
|
||||
@@ -504,6 +504,7 @@ function dolibarr_print_date($time,$format='')
|
||||
if ($format == 'day') $format=$conf->format_date_short;
|
||||
if ($format == 'daytext') $format=$conf->format_date_text_short;
|
||||
if ($format == 'dayhour') $format=$conf->format_date_hour_short;
|
||||
if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ';
|
||||
if ($format == 'dayhourtext') $format=$conf->format_date_hour_text_short;
|
||||
|
||||
// Si date non d<>finie, on renvoie ''
|
||||
|
||||
@@ -653,20 +653,16 @@ class Ldap
|
||||
|
||||
|
||||
/*
|
||||
* \brief Dump a LDAP message to ldapinput.in file
|
||||
* \brief Build a LDAP message
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \return int <0 si KO, >0 si OK
|
||||
* \return string Content of file
|
||||
*/
|
||||
function dump($dn, $info)
|
||||
function dump_content($dn, $info)
|
||||
{
|
||||
global $conf;
|
||||
create_exdir($conf->ldap->dir_temp);
|
||||
$content='';
|
||||
|
||||
$file=$conf->ldap->dir_temp.'/ldapinput.in';
|
||||
$fp=fopen($file,"w");
|
||||
if ($fp)
|
||||
{
|
||||
// Create file content
|
||||
if (ereg('^ldap',$this->server[0]))
|
||||
{
|
||||
$target="-H ".join(',',$this->server);
|
||||
@@ -675,25 +671,54 @@ class Ldap
|
||||
{
|
||||
$target="-h ".join(',',$this->server)." -p ".$this->serverPort;
|
||||
}
|
||||
fputs($fp,"# ldapadd $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||
fputs($fp,"# ldapmodify $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||
fputs($fp,"# ldapdelete $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||
fputs($fp, "dn: ".$dn."\n");
|
||||
$content.="# ldapadd $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n";
|
||||
$content.="# ldapmodify $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n";
|
||||
$content.="# ldapdelete $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n";
|
||||
$content.="dn: ".$dn."\n";
|
||||
foreach($info as $key => $value)
|
||||
{
|
||||
if (! is_array($value))
|
||||
{
|
||||
fputs($fp, "$key: $value\n");
|
||||
$content.="$key: $value\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($value as $valuekey => $valuevalue)
|
||||
{
|
||||
fputs($fp, "$key: $valuevalue\n");
|
||||
$content.="$key: $valuevalue\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Dump a LDAP message to ldapinput.in file
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function dump($dn, $info)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Create content
|
||||
$content=$this->dump_content($dn, $info);
|
||||
|
||||
//Create file
|
||||
$result=create_exdir($conf->ldap->dir_temp);
|
||||
|
||||
$file=$conf->ldap->dir_temp.'/ldapinput.in';
|
||||
$fp=fopen($file,"w");
|
||||
if ($fp)
|
||||
{
|
||||
fputs($fp, $content);
|
||||
fclose($fp);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user