31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
47$langs->loadLangs(array(
'admin',
'errors'));
53$action =
GETPOST(
'action',
'aZ09');
59if ($action ==
'setvalue' ) {
80 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_LOGIN_SAMBA',
GETPOST(
"fieldloginsamba"),
'chaine', 0,
'', $conf->entity)) {
86 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_PASSWORD_CRYPTED',
GETPOST(
"fieldpasswordcrypted"),
'chaine', 0,
'', $conf->entity)) {
101 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_PHONE_PERSO',
GETPOST(
"fieldphoneperso"),
'chaine', 0,
'', $conf->entity)) {
125 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_DESCRIPTION',
GETPOST(
"fielddescription"),
'chaine', 0,
'', $conf->entity)) {
128 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_NOTE_PUBLIC',
GETPOST(
"fieldnotepublic"),
'chaine', 0,
'', $conf->entity)) {
131 if (!
dolibarr_set_const($db,
'LDAP_MEMBER_FIELD_BIRTHDATE',
GETPOST(
"fieldbirthdate"),
'chaine', 0,
'', $conf->entity)) {
137 if (!
dolibarr_set_const($db,
'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION',
GETPOST(
"fieldendlastsubscription"),
'chaine', 0,
'', $conf->entity)) {
142 if (!
dolibarr_set_const($db,
'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE',
GETPOST(
"fieldfirstsubscriptiondate"),
'chaine', 0,
'', $conf->entity)) {
145 if (!
dolibarr_set_const($db,
'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT',
GETPOST(
"fieldfirstsubscriptionamount"),
'chaine', 0,
'', $conf->entity)) {
148 if (!
dolibarr_set_const($db,
'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE',
GETPOST(
"fieldlastsubscriptiondate"),
'chaine', 0,
'', $conf->entity)) {
151 if (!
dolibarr_set_const($db,
'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT',
GETPOST(
"fieldlastsubscriptionamount"),
'chaine', 0,
'', $conf->entity)) {
161 if (!
dolibarr_set_const($db,
'LDAP_KEY_MEMBERS', $valkey,
'chaine', 0,
'', $conf->entity)) {
180$form =
new Form($db);
182llxHeader(
'', $langs->trans(
"LDAPSetup"),
'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP',
'', 0, 0,
'',
'',
'',
'mod-admin page-ldap_members');
184$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
186print
load_fiche_titre($langs->trans(
"LDAPSetup"), $linkback,
'title_setup');
191if (!function_exists(
"ldap_connect")) {
192 setEventMessages($langs->trans(
"LDAPFunctionsNotAvailableOnPHP"),
null,
'errors');
195print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?action=setvalue&token='.
newToken().
'">';
196print
'<input type="hidden" name="token" value="'.newToken().
'">';
201print
'<span class="opacitymedium">'.$langs->trans(
"LDAPDescMembers").
'</span><br>';
204print
'<table class="noborder centpercent">';
206print
'<tr class="liste_titre">';
207print
'<td colspan="4">'.$langs->trans(
"LDAPSynchronizeMembers").
'</td>';
211print
'<!-- LDAP_MEMBER_DN -->';
212print
'<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans(
"LDAPMemberDn").
'</span></td><td>';
213print
'<input size="48" type="text" name="user" value="' .
getDolGlobalString(
'LDAP_MEMBER_DN').
'">';
214print
'</td><td>'.$langs->trans(
"LDAPMemberDnExample").
'</td>';
215print
'<td> </td>';
219print
'<!-- LDAP_MEMBER_OBJECT_CLASS -->';
220print
'<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans(
"LDAPMemberObjectClassList").
'</span></td><td>';
221print
'<input size="48" type="text" name="objectclass" value="' .
getDolGlobalString(
'LDAP_MEMBER_OBJECT_CLASS').
'">';
222print
'</td><td>'.$langs->trans(
"LDAPMemberObjectClassListExample").
'</td>';
223print
'<td> </td>';
227print
'<!-- LDAP_MEMBER_FILTER -->';
228print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFilterConnection").
'</td><td>';
229print
'<input size="48" type="text" name="filterconnection" value="' .
getDolGlobalString(
'LDAP_MEMBER_FILTER').
'">';
230print
'</td><td>'.$langs->trans(
"LDAPFilterConnectionExample").
'</td>';
236print
'<table class="noborder centpercent">';
238print
'<tr class="liste_titre">';
239print
'<td>'.$langs->trans(
"LDAPDolibarrMapping").
'</td>';
240print
'<td colspan="2">'.$langs->trans(
"LDAPLdapMapping").
'</td>';
241print
'<td class="right">'.$langs->trans(
"LDAPNamingAttribute").
'</td>';
247print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldFullname").
'</td><td>';
248print
'<input size="25" type="text" name="fieldfullname" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_FULLNAME').
'">';
249print
'</td><td>'.$langs->trans(
"LDAPFieldFullnameExample").
'</td>';
250print
'<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_FULLNAME"'.((getDolGlobalString(
'LDAP_KEY_MEMBERS') &&
getDolGlobalString(
'LDAP_KEY_MEMBERS') ==
getDolGlobalString(
'LDAP_MEMBER_FIELD_FULLNAME')) ?
' checked' :
'').
"></td>";
254print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldName").
'</td><td>';
255print
'<input size="25" type="text" name="fieldname" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_NAME').
'">';
256print
'</td><td>'.$langs->trans(
"LDAPFieldNameExample").
'</td>';
257print
'<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_NAME"'.((getDolGlobalString(
'LDAP_KEY_MEMBERS') &&
getDolGlobalString(
'LDAP_KEY_MEMBERS') ==
getDolGlobalString(
'LDAP_MEMBER_FIELD_NAME')) ?
' checked' :
'').
"></td>";
261print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldFirstName").
'</td><td>';
262print
'<input size="25" type="text" name="fieldfirstname" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_FIRSTNAME').
'">';
263print
'</td><td>'.$langs->trans(
"LDAPFieldFirstNameExample").
'</td>';
264print
'<td class="right"> </td>';
268print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldLoginUnix").
'</td><td>';
269print
'<input size="25" type="text" name="fieldlogin" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_LOGIN').
'">';
270print
'</td><td>'.$langs->trans(
"LDAPFieldLoginExample").
'</td>';
271print
'<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN"'.((getDolGlobalString(
'LDAP_KEY_MEMBERS') &&
getDolGlobalString(
'LDAP_KEY_MEMBERS') ==
getDolGlobalString(
'LDAP_MEMBER_FIELD_LOGIN')) ?
' checked' :
'').
"></td>";
275print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldLoginSamba").
'</td><td>';
276print
'<input size="25" type="text" name="fieldloginsamba" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_LOGIN_SAMBA').
'">';
277print
'</td><td>'.$langs->trans(
"LDAPFieldLoginSambaExample").
'</td>';
278print
'<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN_SAMBA"'.((getDolGlobalString(
'LDAP_KEY_MEMBERS') &&
getDolGlobalString(
'LDAP_KEY_MEMBERS') ==
getDolGlobalString(
'LDAP_MEMBER_FIELD_LOGIN_SAMBA')) ?
' checked' :
'').
"></td>";
282print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldPasswordNotCrypted").
'</td><td>';
283print
'<input size="25" type="text" name="fieldpassword" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_PASSWORD').
'">';
284print
'</td><td>'.$langs->trans(
"LDAPFieldPasswordExample").
'</td>';
285print
'<td class="right"> </td>';
289print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldPasswordCrypted").
'</td><td>';
290print
'<input size="25" type="text" name="fieldpasswordcrypted" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_PASSWORD_CRYPTED').
'">';
291print
'</td><td>'.$langs->trans(
"LDAPFieldPasswordExample").
'</td>';
292print
'<td class="right"> </td>';
296print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldMail").
'</td><td>';
297print
'<input size="25" type="text" name="fieldmail" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_MAIL').
'">';
298print
'</td><td>'.$langs->trans(
"LDAPFieldMailExample").
'</td>';
299print
'<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_MAIL"'.((getDolGlobalString(
'LDAP_KEY_MEMBERS') &&
getDolGlobalString(
'LDAP_KEY_MEMBERS') ==
getDolGlobalString(
'LDAP_MEMBER_FIELD_MAIL')) ?
' checked' :
'').
"></td>";
303print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldPhone").
'</td><td>';
304print
'<input size="25" type="text" name="fieldphone" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_PHONE').
'">';
305print
'</td><td>'.$langs->trans(
"LDAPFieldPhoneExample").
'</td>';
306print
'<td class="right"> </td>';
311print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldHomePhone").
'</td><td>';
312print
'<input size="25" type="text" name="fieldphoneperso" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_PHONE_PERSO').
'">';
313print
'</td><td>'.$langs->trans(
"LDAPFieldHomePhoneExample").
'</td>';
314print
'<td class="right"> </td>';
318print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldMobile").
'</td><td>';
319print
'<input size="25" type="text" name="fieldmobile" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_MOBILE').
'">';
320print
'</td><td>'.$langs->trans(
"LDAPFieldMobileExample").
'</td>';
321print
'<td class="right"> </td>';
325print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldFax").
'</td><td>';
326print
'<input size="25" type="text" name="fieldfax" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_FAX').
'">';
327print
'</td><td>'.$langs->trans(
"LDAPFieldFaxExample").
'</td>';
328print
'<td class="right"> </td>';
332print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldCompany").
'</td><td>';
333print
'<input size="25" type="text" name="fieldcompany" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_COMPANY').
'">';
334print
'</td><td>'.$langs->trans(
"LDAPFieldCompanyExample").
'</td>';
335print
'<td class="right"> </td>';
339print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldAddress").
'</td><td>';
340print
'<input size="25" type="text" name="fieldaddress" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_ADDRESS').
'">';
341print
'</td><td>'.$langs->trans(
"LDAPFieldAddressExample").
'</td>';
342print
'<td class="right"> </td>';
346print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldZip").
'</td><td>';
347print
'<input size="25" type="text" name="fieldzip" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_ZIP').
'">';
348print
'</td><td>'.$langs->trans(
"LDAPFieldZipExample").
'</td>';
349print
'<td class="right"> </td>';
353print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldTown").
'</td><td>';
354print
'<input size="25" type="text" name="fieldtown" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_TOWN').
'">';
355print
'</td><td>'.$langs->trans(
"LDAPFieldTownExample").
'</td>';
356print
'<td class="right"> </td>';
360print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldCountry").
'</td><td>';
361print
'<input size="25" type="text" name="fieldcountry" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_COUNTRY').
'">';
362print
'</td><td> </td>';
363print
'<td class="right"> </td>';
367print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldDescription").
'</td><td>';
368print
'<input size="25" type="text" name="fielddescription" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_DESCRIPTION').
'">';
369print
'</td><td>'.$langs->trans(
"LDAPFieldDescriptionExample").
'</td>';
370print
'<td class="right"> </td>';
374print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldNotePublic").
'</td><td>';
375print
'<input size="25" type="text" name="fieldnotepublic" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_NOTE_PUBLIC').
'">';
376print
'</td><td>'.$langs->trans(
"LDAPFieldNotePublicExample").
'</td>';
377print
'<td class="right"> </td>';
382print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldBirthdate").
'</td><td>';
383print
'<input size="25" type="text" name="fieldbirthdate" value="' .
getDolGlobalString(
'LDAP_MEMBER_FIELD_BIRTHDATE').
'">';
384print
'</td><td> </td>';
385print
'<td class="right"> </td>';
389print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldStatus").
'</td><td>';
390print
'<input size="25" type="text" name="fieldstatus" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_STATUS').
'">';
391print
'</td><td> </td>';
392print
'<td class="right"> </td>';
397print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldFirstSubscriptionDate").
'</td><td>';
398print
'<input size="25" type="text" name="fieldfirstsubscriptiondate" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE').
'">';
399print
'</td><td> </td>';
400print
'<td class="right"> </td>';
404print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldFirstSubscriptionAmount").
'</td><td>';
405print
'<input size="25" type="text" name="fieldfirstsubscriptionamount" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT').
'">';
406print
'</td><td> </td>';
407print
'<td class="right"> </td>';
411print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldLastSubscriptionDate").
'</td><td>';
412print
'<input size="25" type="text" name="fieldlastsubscriptiondate" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE').
'">';
413print
'</td><td> </td>';
414print
'<td class="right"> </td>';
418print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldLastSubscriptionAmount").
'</td><td>';
419print
'<input size="25" type="text" name="fieldlastsubscriptionamount" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT').
'">';
420print
'</td><td> </td>';
421print
'<td class="right"> </td>';
425print
'<tr class="oddeven"><td>'.$langs->trans(
"LDAPFieldEndLastSubscription").
'</td><td>';
426print
'<input size="25" type="text" name="fieldendlastsubscription" value="' .
getDolGlobalString(
'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION').
'">';
427print
'</td><td> </td>';
428print
'<td class="right"> </td>';
433print
info_admin($langs->trans(
"LDAPDescValues"));
437print $form->buttonsSaveCancel(
"Modify",
'');
447 $butlabel = $langs->trans(
"LDAPTestSynchroMember");
448 $testlabel =
'testmember';
456if (function_exists(
"ldap_connect")) {
457 if ($action ==
'testmember') {
464 $result = $ldap->connectBind();
467 $info =
$object->_load_ldap_info();
468 $dn =
$object->_load_ldap_dn($info);
470 $result1 = $ldap->delete($dn);
471 $result2 = $ldap->add($dn, $info, $user);
472 $result3 = $ldap->delete($dn);
476 print
'<span class="ok">'.$langs->trans(
"LDAPSynchroOK").
'</span><br>';
479 print
'<span class="error">'.$langs->trans(
"LDAPSynchroKOMayBePermissions");
480 print
': '.$ldap->error;
482 print $langs->trans(
"ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).
'<br>';
486 print
"LDAP input file used for test:<br><br>\n";
487 print nl2br($ldap->dumpContent($dn, $info));
491 print
'<span class="error">'.$langs->trans(
"LDAPSynchroKO");
492 print
': '.$ldap->error;
494 print $langs->trans(
"ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).
'<br>';
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage LDAP features.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
ldap_prepare_head()
Initialize the array of tabs for customer invoice.
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass)
Show button test LDAP synchro.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.