dolibarr  13.0.2
ldap_members.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
4  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
7  * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array('admin', 'errors'));
38 
39 if (!$user->admin)
41 
42 $action = GETPOST('action', 'aZ09');
43 
44 /*
45  * Actions
46  */
47 
48 if ($action == 'setvalue' && $user->admin)
49 {
50  $error = 0;
51 
52  $db->begin();
53 
54  if (!dolibarr_set_const($db, 'LDAP_MEMBER_DN', GETPOST("user"), 'chaine', 0, '', $conf->entity)) $error++;
55  if (!dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
56  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FILTER', GETPOST("filterconnection"), 'chaine', 0, '', $conf->entity)) $error++;
57  // Members
58  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
59  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN', GETPOST("fieldlogin"), 'chaine', 0, '', $conf->entity)) $error++;
60  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN_SAMBA', GETPOST("fieldloginsamba"), 'chaine', 0, '', $conf->entity)) $error++;
61  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD', GETPOST("fieldpassword"), 'chaine', 0, '', $conf->entity)) $error++;
62  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PASSWORD_CRYPTED', GETPOST("fieldpasswordcrypted"), 'chaine', 0, '', $conf->entity)) $error++;
63  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NAME', GETPOST("fieldname"), 'chaine', 0, '', $conf->entity)) $error++;
64  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FIRSTNAME', GETPOST("fieldfirstname"), 'chaine', 0, '', $conf->entity)) $error++;
65  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MAIL', GETPOST("fieldmail"), 'chaine', 0, '', $conf->entity)) $error++;
66  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE', GETPOST("fieldphone"), 'chaine', 0, '', $conf->entity)) $error++;
67  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO', GETPOST("fieldphoneperso"), 'chaine', 0, '', $conf->entity)) $error++;
68  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) $error++;
69  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) $error++;
70  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) $error++;
71  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY', GETPOST("fieldcompany"), 'chaine', 0, '', $conf->entity)) $error++;
72  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS', GETPOST("fieldaddress"), 'chaine', 0, '', $conf->entity)) $error++;
73  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) $error++;
74  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) $error++;
75  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) $error++;
76  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
77  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC', GETPOST("fieldnotepublic"), 'chaine', 0, '', $conf->entity)) $error++;
78  if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE', GETPOST("fieldbirthdate"), 'chaine', 0, '', $conf->entity)) $error++;
79  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS', GETPOST("fieldstatus"), 'chaine', 0, '', $conf->entity)) $error++;
80  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"), 'chaine', 0, '', $conf->entity)) $error++;
81 
82  // Subscriptions
83  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE', GETPOST("fieldfirstsubscriptiondate"), 'chaine', 0, '', $conf->entity)) $error++;
84  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT', GETPOST("fieldfirstsubscriptionamount"), 'chaine', 0, '', $conf->entity)) $error++;
85  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', GETPOST("fieldlastsubscriptiondate"), 'chaine', 0, '', $conf->entity)) $error++;
86  if (!dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', GETPOST("fieldlastsubscriptionamount"), 'chaine', 0, '', $conf->entity)) $error++;
87 
88  // This one must be after the others
89  $valkey = '';
90  $key = GETPOST("key");
91  if ($key) $valkey = $conf->global->$key;
92  if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
93 
94  if (!$error)
95  {
96  $db->commit();
97  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
98  } else {
99  $db->rollback();
100  dol_print_error($db);
101  }
102 }
103 
104 
105 
106 /*
107  * View
108  */
109 
110 $form = new Form($db);
111 
112 llxHeader('', $langs->trans("LDAPSetup"), 'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP');
113 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
114 
115 print load_fiche_titre($langs->trans("LDAPSetup"), $linkback, 'title_setup');
116 
117 $head = ldap_prepare_head();
118 
119 // Test si fonction LDAP actives
120 if (!function_exists("ldap_connect"))
121 {
122  setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
123 }
124 
125 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
126 print '<input type="hidden" name="token" value="'.newToken().'">';
127 
128 print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1);
129 
130 
131 print $langs->trans("LDAPDescMembers").'<br>';
132 print '<br>';
133 
134 print '<table class="noborder centpercent">';
135 
136 print '<tr class="liste_titre">';
137 print '<td colspan="4">'.$langs->trans("LDAPSynchronizeMembers").'</td>';
138 print "</tr>\n";
139 
140 // DN Pour les adherents
141 print '<tr class="oddeven"><td width="25%"><span class="fieldrequired">'.$langs->trans("LDAPMemberDn").'</span></td><td>';
142 print '<input size="48" type="text" name="user" value="'.$conf->global->LDAP_MEMBER_DN.'">';
143 print '</td><td>'.$langs->trans("LDAPMemberDnExample").'</td>';
144 print '<td>&nbsp;</td>';
145 print '</tr>';
146 
147 // List of object class used to define attributes in structure
148 print '<tr class="oddeven"><td width="25%"><span class="fieldrequired">'.$langs->trans("LDAPMemberObjectClassList").'</span></td><td>';
149 print '<input size="48" type="text" name="objectclass" value="'.$conf->global->LDAP_MEMBER_OBJECT_CLASS.'">';
150 print '</td><td>'.$langs->trans("LDAPMemberObjectClassListExample").'</td>';
151 print '<td>&nbsp;</td>';
152 print '</tr>';
153 
154 // Filter, used to filter search
155 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
156 print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_MEMBER_FILTER.'">';
157 print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
158 print '<td></td>';
159 print '</tr>';
160 
161 print '</table>';
162 print '<br>';
163 print '<table class="noborder centpercent">';
164 
165 print '<tr class="liste_titre">';
166 print '<td width="25%">'.$langs->trans("LDAPDolibarrMapping").'</td>';
167 print '<td colspan="2">'.$langs->trans("LDAPLdapMapping").'</td>';
168 print '<td class="right">'.$langs->trans("LDAPNamingAttribute").'</td>';
169 print "</tr>\n";
170 
171 // Filtre
172 
173 // Common name
174 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
175 print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_MEMBER_FIELD_FULLNAME.'">';
176 print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
177 print '<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS == $conf->global->LDAP_MEMBER_FIELD_FULLNAME) ? ' checked' : '')."></td>";
178 print '</tr>';
179 
180 // Name
181 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>';
182 print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_MEMBER_FIELD_NAME.'">';
183 print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
184 print '<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_NAME"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS == $conf->global->LDAP_MEMBER_FIELD_NAME) ? ' checked' : '')."></td>";
185 print '</tr>';
186 
187 // Firstname
188 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
189 print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME.'">';
190 print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
191 print '<td class="right">&nbsp;</td>';
192 print '</tr>';
193 
194 // Login unix
195 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
196 print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN.'">';
197 print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
198 print '<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS == $conf->global->LDAP_MEMBER_FIELD_LOGIN) ? ' checked' : '')."></td>";
199 print '</tr>';
200 
201 // Login samba
202 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
203 print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA.'">';
204 print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
205 print '<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS == $conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA) ? ' checked' : '')."></td>";
206 print '</tr>';
207 
208 // Password not crypted
209 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
210 print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_MEMBER_FIELD_PASSWORD.'">';
211 print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
212 print '<td class="right">&nbsp;</td>';
213 print '</tr>';
214 
215 // Password crypted
216 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
217 print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED.'">';
218 print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
219 print '<td class="right">&nbsp;</td>';
220 print '</tr>';
221 
222 // Mail
223 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
224 print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_MEMBER_FIELD_MAIL.'">';
225 print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
226 print '<td class="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_MAIL"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS == $conf->global->LDAP_MEMBER_FIELD_MAIL) ? ' checked' : '')."></td>";
227 print '</tr>';
228 
229 // Phone pro
230 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
231 print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_MEMBER_FIELD_PHONE.'">';
232 print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
233 print '<td class="right">&nbsp;</td>';
234 print '</tr>';
235 
236 // Phone perso
237 
238 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomePhone").'</td><td>';
239 print '<input size="25" type="text" name="fieldphoneperso" value="'.$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO.'">';
240 print '</td><td>'.$langs->trans("LDAPFieldHomePhoneExample").'</td>';
241 print '<td class="right">&nbsp;</td>';
242 print '</tr>';
243 
244 // Mobile
245 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
246 print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_MEMBER_FIELD_MOBILE.'">';
247 print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
248 print '<td class="right">&nbsp;</td>';
249 print '</tr>';
250 
251 // Skype
252 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
253 print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_MEMBER_FIELD_SKYPE.'">';
254 print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
255 print '<td class="right">&nbsp;</td>';
256 print '</tr>';
257 
258 // Fax
259 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
260 print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_MEMBER_FIELD_FAX.'">';
261 print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
262 print '<td class="right">&nbsp;</td>';
263 print '</tr>';
264 
265 // Company
266 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
267 print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_MEMBER_FIELD_COMPANY.'">';
268 print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
269 print '<td class="right">&nbsp;</td>';
270 print '</tr>';
271 
272 // Address
273 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
274 print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_MEMBER_FIELD_ADDRESS.'">';
275 print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
276 print '<td class="right">&nbsp;</td>';
277 print '</tr>';
278 
279 // ZIP
280 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
281 print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_MEMBER_FIELD_ZIP.'">';
282 print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
283 print '<td class="right">&nbsp;</td>';
284 print '</tr>';
285 
286 // TOWN
287 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
288 print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_MEMBER_FIELD_TOWN.'">';
289 print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
290 print '<td class="right">&nbsp;</td>';
291 print '</tr>';
292 
293 // COUNTRY
294 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
295 print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_MEMBER_FIELD_COUNTRY.'">';
296 print '</td><td>&nbsp;</td>';
297 print '<td class="right">&nbsp;</td>';
298 print '</tr>';
299 
300 // Description
301 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
302 print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION.'">';
303 print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
304 print '<td class="right">&nbsp;</td>';
305 print '</tr>';
306 
307 // Public Note
308 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldNotePublic").'</td><td>';
309 print '<input size="25" type="text" name="fieldnotepublic" value="'.$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC.'">';
310 print '</td><td>'.$langs->trans("LDAPFieldNotePublicExample").'</td>';
311 print '<td class="right">&nbsp;</td>';
312 print '</tr>';
313 
314 // Birthday
315 
316 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';
317 print '<input size="25" type="text" name="fieldbirthdate" value="'.$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE.'">';
318 print '</td><td>&nbsp;</td>';
319 print '<td class="right">&nbsp;</td>';
320 print '</tr>';
321 
322 // Status
323 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldStatus").'</td><td>';
324 print '<input size="25" type="text" name="fieldstatus" value="'.$conf->global->LDAP_FIELD_MEMBER_STATUS.'">';
325 print '</td><td>&nbsp;</td>';
326 print '<td class="right">&nbsp;</td>';
327 print '</tr>';
328 
329 // First subscription date
330 
331 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstSubscriptionDate").'</td><td>';
332 print '<input size="25" type="text" name="fieldfirstsubscriptiondate" value="'.$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE.'">';
333 print '</td><td>&nbsp;</td>';
334 print '<td class="right">&nbsp;</td>';
335 print '</tr>';
336 
337 // First subscription amount
338 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstSubscriptionAmount").'</td><td>';
339 print '<input size="25" type="text" name="fieldfirstsubscriptionamount" value="'.$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT.'">';
340 print '</td><td>&nbsp;</td>';
341 print '<td class="right">&nbsp;</td>';
342 print '</tr>';
343 
344 // Last subscription date
345 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLastSubscriptionDate").'</td><td>';
346 print '<input size="25" type="text" name="fieldlastsubscriptiondate" value="'.$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE.'">';
347 print '</td><td>&nbsp;</td>';
348 print '<td class="right">&nbsp;</td>';
349 print '</tr>';
350 
351 // Last subscription amount
352 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLastSubscriptionAmount").'</td><td>';
353 print '<input size="25" type="text" name="fieldlastsubscriptionamount" value="'.$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT.'">';
354 print '</td><td>&nbsp;</td>';
355 print '<td class="right">&nbsp;</td>';
356 print '</tr>';
357 
358 // End last subscriptions
359 print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldEndLastSubscription").'</td><td>';
360 print '<input size="25" type="text" name="fieldendlastsubscription" value="'.$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION.'">';
361 print '</td><td>&nbsp;</td>';
362 print '<td class="right">&nbsp;</td>';
363 print '</tr>';
364 
365 print '</table>';
366 
367 print info_admin($langs->trans("LDAPDescValues"));
368 
370 
371 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
372 
373 print '</form>';
374 
375 
376 
377 /*
378  * Test de la connexion
379  */
380 if (!empty($conf->global->LDAP_MEMBER_ACTIVE))
381 {
382  $butlabel = $langs->trans("LDAPTestSynchroMember");
383  $testlabel = 'testmember';
384  $key = $conf->global->LDAP_KEY_MEMBERS;
385  $dn = $conf->global->LDAP_MEMBER_DN;
386  $objectclass = $conf->global->LDAP_MEMBER_OBJECT_CLASS;
387 
388  show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
389 }
390 
391 if (function_exists("ldap_connect"))
392 {
393  if ($_GET["action"] == 'testmember')
394  {
395  // Creation objet
396  $object = new Adherent($db);
397  $object->initAsSpecimen();
398 
399  // Test synchro
400  $ldap = new Ldap();
401  $result = $ldap->connect_bind();
402 
403  if ($result > 0)
404  {
405  $info = $object->_load_ldap_info();
406  $dn = $object->_load_ldap_dn($info);
407 
408  $result1 = $ldap->delete($dn); // To be sure to delete existing records
409  $result2 = $ldap->add($dn, $info, $user); // Now the test
410  $result3 = $ldap->delete($dn); // Clean what we did
411 
412  if ($result2 > 0)
413  {
414  print img_picto('', 'info').' ';
415  print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
416  } else {
417  print img_picto('', 'error').' ';
418  print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
419  print ': '.$ldap->error;
420  print '</font><br>';
421  print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
422  }
423 
424  print "<br>\n";
425  print "LDAP input file used for test:<br><br>\n";
426  print nl2br($ldap->dump_content($dn, $info));
427  print "\n<br>";
428  } else {
429  print img_picto('', 'error').' ';
430  print '<font class="error">'.$langs->trans("LDAPSynchroKO");
431  print ': '.$ldap->error;
432  print '</font><br>';
433  print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
434  }
435  }
436 }
437 
438 // End of page
439 llxFooter();
440 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
Definition: admin.lib.php:575
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass)
Show button test LDAP synchro.
Definition: ldap.lib.php:108
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
Class to manage members of a foundation.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
Class to manage LDAP features.
Definition: ldap.class.php:30
print
Draft customers invoices.
Definition: index.php:89
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
ldap_prepare_head()
Initialize the array of tabs for customer invoice.
Definition: ldap.lib.php:31
llxFooter()
Empty footer.
Definition: wrapper.php:59
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.