dolibarr  18.0.0-alpha
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
6  * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
8  * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
31 // Load Dolibarr environment
32 require '../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
37 
38 
39 // Load translation files required by the page
40 $langs->loadLangs(array("members", "companies", "categories"));
41 
42 
43 // Get parameters
44 $action = GETPOST('action', 'aZ09');
45 $massaction = GETPOST('massaction', 'alpha');
46 $show_files = GETPOST('show_files', 'int');
47 $confirm = GETPOST('confirm', 'alpha');
48 $cancel = GETPOST('cancel', 'alpha');
49 $toselect = GETPOST('toselect', 'array');
50 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
51 $backtopage = GETPOST('backtopage', 'alpha');
52 $optioncss = GETPOST('optioncss', 'aZ');
53 $mode = GETPOST('mode', 'alpha');
54 
55 // Search fields
56 $search = GETPOST("search", 'alpha');
57 $search_ref = GETPOST("search_ref", 'alpha');
58 $search_lastname = GETPOST("search_lastname", 'alpha');
59 $search_firstname = GETPOST("search_firstname", 'alpha');
60 $search_gender = GETPOST("search_gender", 'alpha');
61 $search_civility = GETPOST("search_civility", 'alpha');
62 $search_company = GETPOST('search_company', 'alphanohtml');
63 $search_login = GETPOST("search_login", 'alpha');
64 $search_address = GETPOST("search_address", 'alpha');
65 $search_zip = GETPOST("search_zip", 'alpha');
66 $search_town = GETPOST("search_town", 'alpha');
67 $search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
68 $search_country = GETPOST("search_country", 'alpha');
69 $search_phone = GETPOST("search_phone", 'alpha');
70 $search_phone_perso = GETPOST("search_phone_perso", 'alpha');
71 $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
72 $search_type = GETPOST("search_type", 'alpha');
73 $search_email = GETPOST("search_email", 'alpha');
74 $search_categ = GETPOST("search_categ", 'int');
75 $search_morphy = GETPOST("search_morphy", 'alpha');
76 $search_import_key = trim(GETPOST("search_import_key", 'alpha'));
77 
78 $catid = GETPOST("catid", 'int');
79 $socid = GETPOST('socid', 'int');
80 
81 $search_filter = GETPOST("search_filter", 'alpha');
82 $search_status = GETPOST("search_status", 'intcomma'); // statut
83 
84 $filter = GETPOST("filter", 'alpha');
85 if ($filter) {
86  $search_filter = $filter; // For backward compatibility
87 }
88 
89 $statut = GETPOST("statut", 'alpha');
90 if ($statut != '') {
91  $search_status = $statut; // For backward compatibility
92 }
93 
94 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
95 
96 if ($search_status < -2) {
97  $search_status = '';
98 }
99 
100 // Pagination parameters
101 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
102 $sortfield = GETPOST('sortfield', 'aZ09comma');
103 $sortorder = GETPOST('sortorder', 'aZ09comma');
104 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
105 if (empty($page) || $page == -1) {
106  $page = 0;
107 } // If $page is not defined, or '' or -1
108 $offset = $limit * $page;
109 $pageprev = $page - 1;
110 $pagenext = $page + 1;
111 if (!$sortorder) {
112  $sortorder = ($filter == 'outofdate' ? "DESC" : "ASC");
113 }
114 if (!$sortfield) {
115  $sortfield = ($filter == 'outofdate' ? "d.datefin" : "d.lastname");
116 }
117 
118 $object = new Adherent($db);
119 
120 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
121 $hookmanager->initHooks(array('memberlist'));
122 $extrafields = new ExtraFields($db);
123 
124 // fetch optionals attributes and labels
125 $extrafields->fetch_name_optionals_label($object->table_element);
126 
127 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
128 
129 // List of fields to search into when doing a "search in all"
130 $fieldstosearchall = array(
131  'd.ref'=>'Ref',
132  'd.login'=>'Login',
133  'd.lastname'=>'Lastname',
134  'd.firstname'=>'Firstname',
135  'd.societe'=>"Company",
136  'd.email'=>'EMail',
137  'd.address'=>'Address',
138  'd.zip'=>'Zip',
139  'd.town'=>'Town',
140  'd.phone'=>"Phone",
141  'd.phone_perso'=>"PhonePerso",
142  'd.phone_mobile'=>"PhoneMobile",
143  'd.note_public'=>'NotePublic',
144  'd.note_private'=>'NotePrivate',
145 );
146 if ($db->type == 'pgsql') {
147  unset($fieldstosearchall['d.rowid']);
148 }
149 
150 $arrayfields = array(
151  'd.ref'=>array('label'=>"Ref", 'checked'=>1),
152  'd.civility'=>array('label'=>"Civility", 'checked'=>0),
153  'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
154  'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
155  'd.gender'=>array('label'=>"Gender", 'checked'=>0),
156  'd.company'=>array('label'=>"Company", 'checked'=>1),
157  'd.login'=>array('label'=>"Login", 'checked'=>1),
158  'd.morphy'=>array('label'=>"MemberNature", 'checked'=>1),
159  't.libelle'=>array('label'=>"Type", 'checked'=>1),
160  'd.email'=>array('label'=>"Email", 'checked'=>1),
161  'd.address'=>array('label'=>"Address", 'checked'=>0),
162  'd.zip'=>array('label'=>"Zip", 'checked'=>0),
163  'd.town'=>array('label'=>"Town", 'checked'=>0),
164  'd.phone'=>array('label'=>"Phone", 'checked'=>0),
165  'd.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
166  'd.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>0),
167  'state.nom'=>array('label'=>"State", 'checked'=>0),
168  'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
169  /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
170  'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
171  'd.datefin'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>500),
172  'd.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
173  'd.birth'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>500),
174  'd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
175  'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
176  'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
177 );
178 
179 // Extra fields
180 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
181 
182 // Security check
183 $result = restrictedArea($user, 'adherent');
184 
185 
186 /*
187  * Actions
188  */
189 
190 if (GETPOST('cancel', 'alpha')) {
191  $action = 'list'; $massaction = '';
192 }
193 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
194  $massaction = '';
195 }
196 
197 $parameters = array('socid'=>isset($socid) ? $socid : null);
198 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
199 if ($reshook < 0) {
200  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
201 }
202 
203 if (empty($reshook)) {
204  // Selection of new fields
205  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
206 
207  // Purge search criteria
208  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
209  $statut = '';
210  $filter = '';
211 
212  $search = "";
213  $search_ref = "";
214  $search_lastname = "";
215  $search_firstname = "";
216  $search_gender = "";
217  $search_civility = "";
218  $search_login = "";
219  $search_company = "";
220  $search_type = "";
221  $search_email = "";
222  $search_address = "";
223  $search_zip = "";
224  $search_town = "";
225  $search_state = "";
226  $search_country = '';
227  $search_phone = '';
228  $search_phone_perso = '';
229  $search_phone_mobile = '';
230  $search_morphy = "";
231  $search_categ = "";
232  $search_filter = "";
233  $search_status = "";
234  $search_import_key = '';
235  $catid = "";
236  $sall = "";
237  $toselect = array();
238  $search_array_options = array();
239  }
240 
241  // Close
242  if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) {
243  $tmpmember = new Adherent($db);
244  $error = 0;
245  $nbclose = 0;
246 
247  $db->begin();
248 
249  foreach ($toselect as $idtoclose) {
250  $tmpmember->fetch($idtoclose);
251  $result = $tmpmember->resiliate($user);
252 
253  if ($result < 0 && !count($tmpmember->errors)) {
254  setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
255  } else {
256  if ($result > 0) {
257  $nbclose++;
258  }
259  }
260  }
261 
262  if (!$error) {
263  setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
264 
265  $db->commit();
266  } else {
267  $db->rollback();
268  }
269  }
270 
271  // Create external user
272  if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
273  $tmpmember = new Adherent($db);
274  $error = 0;
275  $nbcreated = 0;
276 
277  $db->begin();
278 
279  foreach ($toselect as $idtoclose) {
280  $tmpmember->fetch($idtoclose);
281 
282  if (!empty($tmpmember->fk_soc)) {
283  $nuser = new User($db);
284  $tmpuser = dol_clone($tmpmember);
285 
286  $result = $nuser->create_from_member($tmpuser, $tmpmember->login);
287 
288  if ($result < 0 && !count($tmpmember->errors)) {
289  setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
290  } else {
291  if ($result > 0) {
292  $nbcreated++;
293  }
294  }
295  }
296  }
297 
298  if (!$error) {
299  setEventMessages($langs->trans("XExternalUserCreated", $nbcreated), null, 'mesgs');
300 
301  $db->commit();
302  } else {
303  $db->rollback();
304  }
305  }
306 
307  // Mass actions
308  $objectclass = 'Adherent';
309  $objectlabel = 'Members';
310  $permissiontoread = $user->hasRight('adherent', 'lire');
311  $permissiontodelete = $user->hasRight('adherent', 'supprimer');
312  $permissiontoadd = $user->hasRight('adherent', 'creer');
313  $uploaddir = $conf->adherent->dir_output;
314  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
315 }
316 
317 
318 /*
319  * View
320  */
321 
322 $form = new Form($db);
323 $formother = new FormOther($db);
324 $membertypestatic = new AdherentType($db);
325 $memberstatic = new Adherent($db);
326 
327 // Page Header
328 $title = $langs->trans("Members")." - ".$langs->trans("List");
329 $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
330 llxHeader('', $title, $help_url);
331 
332 
333 $now = dol_now();
334 
335 if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
336  $sql = "SELECT DISTINCT";
337 } else {
338  $sql = "SELECT";
339 }
340 $sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
341 $sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
342 $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
343 $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
344 $sql .= " d.note_private, d.note_public, d.import_key,";
345 $sql .= " s.nom,";
346 $sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
347 $sql .= " t.libelle as type, t.subscription,";
348 $sql .= " state.code_departement as state_code, state.nom as state_name,";
349 
350 // Add fields from extrafields
351 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
352  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
353  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
354  }
355 }
356 
357 // Add fields from hooks
358 $parameters = array();
359 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
360 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
361 $sql = preg_replace('/,\s*$/', '', $sql);
362 
363 $sqlfields = $sql; // $sql fields to remove for count total
364 
365 // SQL Aliase adherent
366 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d
367 if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
368  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
369 }
370 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
371 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
372 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
373 
374 // SQL Aliase adherent_type
375 $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
376 $sql .= " WHERE d.fk_adherent_type = t.rowid";
377 
378 if ($catid && empty($search_categ)) {
379  $search_categ = $catid;
380 }
381 
382 $searchCategoryContactList = $search_categ ? array($search_categ) : array();
383 $searchCategoryContactOperator = 0;
384 // Search for tag/category ($searchCategoryContactList is an array of ID)
385 if (!empty($searchCategoryContactList)) {
386  $searchCategoryContactSqlList = array();
387  $listofcategoryid = '';
388  foreach ($searchCategoryContactList as $searchCategoryContact) {
389  if (intval($searchCategoryContact) == -2) {
390  $searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
391  } elseif (intval($searchCategoryContact) > 0) {
392  if ($searchCategoryContactOperator == 0) {
393  $searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = ".((int) $searchCategoryContact).")";
394  } else {
395  $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
396  }
397  }
398  }
399  if ($listofcategoryid) {
400  $searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
401  }
402  if ($searchCategoryContactOperator == 1) {
403  if (!empty($searchCategoryContactSqlList)) {
404  $sql .= " AND (".implode(' OR ', $searchCategoryContactSqlList).")";
405  }
406  } else {
407  if (!empty($searchCategoryContactSqlList)) {
408  $sql .= " AND (".implode(' AND ', $searchCategoryContactSqlList).")";
409  }
410  }
411 }
412 
413 $sql .= " AND d.entity IN (".getEntity('adherent').")";
414 if ($sall) {
415  $sql .= natural_search(array_keys($fieldstosearchall), $sall);
416 }
417 if ($search_type > 0) {
418  $sql .= " AND t.rowid=".((int) $search_type);
419 }
420 if ($search_filter == 'withoutsubscription') {
421  $sql .= " AND (datefin IS NULL)";
422 }
423 if ($search_filter == 'waitingsubscription') {
424  $sql .= " AND (datefin IS NULL AND t.subscription = '1')";
425 }
426 if ($search_filter == 'uptodate') {
427  $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = '0')";
428 }
429 if ($search_filter == 'outofdate') {
430  $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = '1')";
431 }
432 if ($search_status != '') {
433  // Peut valoir un nombre ou liste de nombre separes par virgules
434  $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
435 }
436 if ($search_morphy != '' && $search_morphy != '-1') {
437  $sql .= natural_search("d.morphy", $search_morphy);
438 }
439 if ($search_ref) {
440  $sql .= natural_search("d.ref", $search_ref);
441 }
442 if ($search_civility) {
443  $sql .= natural_search("d.civility", $search_civility);
444 }
445 if ($search_firstname) {
446  $sql .= natural_search("d.firstname", $search_firstname);
447 }
448 if ($search_lastname) {
449  $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
450 }
451 if ($search_gender != '' && $search_gender != '-1') {
452  $sql .= natural_search("d.gender", $search_gender);
453 }
454 if ($search_login) {
455  $sql .= natural_search("d.login", $search_login);
456 }
457 if ($search_company) {
458  $sql .= natural_search("s.nom", $search_company);
459 }
460 if ($search_email) {
461  $sql .= natural_search("d.email", $search_email);
462 }
463 if ($search_address) {
464  $sql .= natural_search("d.address", $search_address);
465 }
466 if ($search_town) {
467  $sql .= natural_search("d.town", $search_town);
468 }
469 if ($search_zip) {
470  $sql .= natural_search("d.zip", $search_zip);
471 }
472 if ($search_state) {
473  $sql .= natural_search("state.nom", $search_state);
474 }
475 if ($search_phone) {
476  $sql .= natural_search("d.phone", $search_phone);
477 }
478 if ($search_phone_perso) {
479  $sql .= natural_search("d.phone_perso", $search_phone_perso);
480 }
481 if ($search_phone_mobile) {
482  $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
483 }
484 if ($search_country) {
485  $sql .= " AND d.country IN (".$db->sanitize($search_country).')';
486 }
487 if ($search_import_key) {
488  $sql .= natural_search("d.import_key", $search_import_key);
489 }
490 
491 // Add where from extra fields
492 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
493 
494 // Add where from hooks
495 $parameters = array();
496 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
497 $sql .= $hookmanager->resPrint;
498 
499 // Count total nb of records with no order and no limits
500 $nbtotalofrecords = '';
501 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
502  /* The fast and low memory method to get and count full list converts the sql into a sql count */
503  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
504  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
505  $resql = $db->query($sqlforcount);
506  if ($resql) {
507  $objforcount = $db->fetch_object($resql);
508  $nbtotalofrecords = $objforcount->nbtotalofrecords;
509  } else {
510  dol_print_error($db);
511  }
512 
513  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
514  $page = 0;
515  $offset = 0;
516  }
517  $db->free($resql);
518 }
519 
520 // Complete request and execute it with limit
521 $sql .= $db->order($sortfield, $sortorder);
522 if ($limit) {
523  $sql .= $db->plimit($limit + 1, $offset);
524 }
525 
526 $resql = $db->query($sql);
527 if (!$resql) {
528  dol_print_error($db);
529  exit;
530 }
531 
532 $num = $db->num_rows($resql);
533 
534 
535 $arrayofselected = is_array($toselect) ? $toselect : array();
536 
537 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
538  $obj = $db->fetch_object($resql);
539  $id = $obj->rowid;
540  header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
541  exit;
542 }
543 
544 
545 if ($search_type > 0) {
546  $membertype = new AdherentType($db);
547  $result = $membertype->fetch($search_type);
548  $title .= " (".$membertype->label.")";
549 }
550 
551 // $parameters
552 $param = '';
553 if (!empty($mode)) {
554  $param .= '&mode='.urlencode($mode);
555 }
556 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
557  $param .= '&contextpage='.urlencode($contextpage);
558 }
559 if ($limit > 0 && $limit != $conf->liste_limit) {
560  $param .= '&limit='.urlencode($limit);
561 }
562 if ($sall != "") {
563  $param .= "&sall=".urlencode($sall);
564 }
565 if ($search_ref) {
566  $param .= "&search_ref=".urlencode($search_ref);
567 }
568 if ($search_civility) {
569  $param .= "&search_civility=".urlencode($search_civility);
570 }
571 if ($search_firstname) {
572  $param .= "&search_firstname=".urlencode($search_firstname);
573 }
574 if ($search_lastname) {
575  $param .= "&search_lastname=".urlencode($search_lastname);
576 }
577 if ($search_gender) {
578  $param .= "&search_gender=".urlencode($search_gender);
579 }
580 if ($search_login) {
581  $param .= "&search_login=".urlencode($search_login);
582 }
583 if ($search_email) {
584  $param .= "&search_email=".urlencode($search_email);
585 }
586 if ($search_categ > 0 || $search_categ == -2) {
587  $param .= "&search_categ=".urlencode($search_categ);
588 }
589 if ($search_company) {
590  $param .= "&search_company=".urlencode($search_company);
591 }
592 if ($search_address != '') {
593  $param .= "&search_address=".urlencode($search_address);
594 }
595 if ($search_town != '') {
596  $param .= "&search_town=".urlencode($search_town);
597 }
598 if ($search_zip != '') {
599  $param .= "&search_zip=".urlencode($search_zip);
600 }
601 if ($search_state != '') {
602  $param .= "&search_state=".urlencode($search_state);
603 }
604 if ($search_country != '') {
605  $param .= "&search_country=".urlencode($search_country);
606 }
607 if ($search_phone != '') {
608  $param .= "&search_phone=".urlencode($search_phone);
609 }
610 if ($search_phone_perso != '') {
611  $param .= "&search_phone_perso=".urlencode($search_phone_perso);
612 }
613 if ($search_phone_mobile != '') {
614  $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
615 }
616 if ($search_filter && $search_filter != '-1') {
617  $param .= "&search_filter=".urlencode($search_filter);
618 }
619 if ($search_status != "" && $search_status != -3) {
620  $param .= "&search_status=".urlencode($search_status);
621 }
622 if ($search_import_key != '') {
623  $param .= '&search_import_key='.urlencode($search_import_key);
624 }
625 if ($search_type > 0) {
626  $param .= "&search_type=".urlencode($search_type);
627 }
628 if ($optioncss != '') {
629  $param .= '&optioncss='.urlencode($optioncss);
630 }
631 
632 // Add $param from extra fields
633 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
634 
635 // List of mass actions available
636 $arrayofmassactions = array(
637  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
638  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
639 );
640 if ($user->hasRight('adherent', 'creer')) {
641  $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
642 }
643 if ($user->hasRight('adherent', 'supprimer')) {
644  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
645 }
646 if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) {
647  $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
648 }
649 if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
650  $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
651 }
652 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
653  $arrayofmassactions = array();
654 }
655 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
656 
657 $newcardbutton = '';
658 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
659 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
660 if ($user->hasRight('adherent', 'creer')) {
661  $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
662 }
663 
664 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
665 if ($optioncss != '') {
666  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
667 }
668 print '<input type="hidden" name="token" value="'.newToken().'">';
669 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
670 print '<input type="hidden" name="action" value="list">';
671 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
672 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
673 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
674 print '<input type="hidden" name="mode" value="'.$mode.'">';
675 
676 
677 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
678 
679 $topicmail = "Information";
680 $modelmail = "member";
681 $objecttmp = new Adherent($db);
682 $trackid = 'mem'.$object->id;
683 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
684 
685 if ($sall) {
686  foreach ($fieldstosearchall as $key => $val) {
687  $fieldstosearchall[$key] = $langs->trans($val);
688  }
689  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
690 }
691 
692 // Filter on categories
693 $moreforfilter = '';
694 if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
695  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
696  $moreforfilter .= '<div class="divsearchfield">';
697  $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
698  $moreforfilter .= '</div>';
699 }
700 $parameters = array();
701 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
702 if (empty($reshook)) {
703  $moreforfilter .= $hookmanager->resPrint;
704 } else {
705  $moreforfilter = $hookmanager->resPrint;
706 }
707 if (!empty($moreforfilter)) {
708  print '<div class="liste_titre liste_titre_bydiv centpercent">';
709  print $moreforfilter;
710  print '</div>';
711 }
712 
713 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
714 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
715 if ($massactionbutton) {
716  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
717 }
718 
719 print '<div class="div-table-responsive">';
720 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
721 
722 // Line for filters fields
723 print '<tr class="liste_titre_filter">';
724 
725 // Action column
726 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
727  print '<td class="liste_titre middle">';
728  $searchpicto = $form->showFilterButtons('left');
729  print $searchpicto;
730  print '</td>';
731 }
732 
733 // Line numbering
734 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
735  print '<td class="liste_titre">&nbsp;</td>';
736 }
737 
738 // Ref
739 if (!empty($arrayfields['d.ref']['checked'])) {
740  print '<td class="liste_titre">';
741  print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
742  print '</td>';
743 }
744 
745 // Civility
746 if (!empty($arrayfields['d.civility']['checked'])) {
747  print '<td class="liste_titre left">';
748  print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
749 }
750 
751 // First Name
752 if (!empty($arrayfields['d.firstname']['checked'])) {
753  print '<td class="liste_titre left">';
754  print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
755 }
756 
757 // Last Name
758 if (!empty($arrayfields['d.lastname']['checked'])) {
759  print '<td class="liste_titre left">';
760  print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
761 }
762 
763 // Gender
764 if (!empty($arrayfields['d.gender']['checked'])) {
765  print '<td class="liste_titre">';
766  $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
767  print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
768  print '</td>';
769 }
770 
771 // Company
772 if (!empty($arrayfields['d.company']['checked'])) {
773  print '<td class="liste_titre left">';
774  print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
775 }
776 
777 // Login
778 if (!empty($arrayfields['d.login']['checked'])) {
779  print '<td class="liste_titre left">';
780  print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
781 }
782 
783 // Nature
784 if (!empty($arrayfields['d.morphy']['checked'])) {
785  print '<td class="liste_titre center">';
786  $arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical"));
787  print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
788  print '</td>';
789 }
790 
791 // Member Type
792 if (!empty($arrayfields['t.libelle']['checked'])) {
793  print '</td>';
794 }
795 if (!empty($arrayfields['t.libelle']['checked'])) {
796  print '<td class="liste_titre">';
797  $listetype = $membertypestatic->liste_array();
798  print $form->selectarray("search_type", $listetype, $search_type, 1, 0, 0, '', 0, 32);
799  print '</td>';
800 }
801 
802 // Address - Street
803 if (!empty($arrayfields['d.address']['checked'])) {
804  print '<td class="liste_titre left">';
805  print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>';
806 }
807 
808 // ZIP
809 if (!empty($arrayfields['d.zip']['checked'])) {
810  print '<td class="liste_titre left">';
811  print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
812 }
813 
814 // Town/City
815 if (!empty($arrayfields['d.town']['checked'])) {
816  print '<td class="liste_titre left">';
817  print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
818 }
819 
820 // State / County / Departement
821 if (!empty($arrayfields['state.nom']['checked'])) {
822  print '<td class="liste_titre">';
823  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
824  print '</td>';
825 }
826 
827 // Country
828 if (!empty($arrayfields['country.code_iso']['checked'])) {
829  print '<td class="liste_titre center">';
830  print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
831  print '</td>';
832 }
833 
834 // Phone pro
835 if (!empty($arrayfields['d.phone']['checked'])) {
836  print '<td class="liste_titre left">';
837  print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>';
838 }
839 
840 // Phone perso
841 if (!empty($arrayfields['d.phone_perso']['checked'])) {
842  print '<td class="liste_titre left">';
843  print '<input class="flat maxwidth75imp" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
844 }
845 
846 // Phone mobile
847 if (!empty($arrayfields['d.phone_mobile']['checked'])) {
848  print '<td class="liste_titre left">';
849  print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>';
850 }
851 
852 // Email
853 if (!empty($arrayfields['d.email']['checked'])) {
854  print '<td class="liste_titre left">';
855  print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
856 }
857 
858 // End of subscription date
859 if (!empty($arrayfields['d.datefin']['checked'])) {
860  print '<td class="liste_titre center">';
861  //$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
862  $selectarray = array('-1'=>'', 'waitingsubscription'=>$langs->trans("WaitingSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
863  print $form->selectarray('search_filter', $selectarray, $search_filter);
864  print '</td>';
865 }
866 
867 // Extra fields
868 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
869 
870 // Fields from hook
871 $parameters = array('arrayfields'=>$arrayfields);
872 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
873 print $hookmanager->resPrint;
874 
875 // Date creation
876 if (!empty($arrayfields['d.datec']['checked'])) {
877  print '<td class="liste_titre">';
878  print '</td>';
879 }
880 
881 // Birthday
882 if (!empty($arrayfields['d.birth']['checked'])) {
883  print '<td class="liste_titre">';
884  print '</td>';
885 }
886 
887 // Date modification
888 if (!empty($arrayfields['d.tms']['checked'])) {
889  print '<td class="liste_titre">';
890  print '</td>';
891 }
892 
893 // Status
894 if (!empty($arrayfields['d.statut']['checked'])) {
895  print '<td class="liste_titre right parentonrightofpage">';
896  $liststatus = array(
897  Adherent::STATUS_DRAFT => $langs->trans("Draft"),
898  Adherent::STATUS_VALIDATED => $langs->trans("Validated"),
899  Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
900  Adherent::STATUS_EXCLUDED =>$langs->trans("MemberStatusExcludedShort")
901  );
902  print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
903  print '</td>';
904 }
905 
906 // Import Key
907 if (!empty($arrayfields['d.import_key']['checked'])) {
908  print '<td class="liste_titre center">';
909  print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
910  print '</td>';
911 }
912 
913 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
914  // Action column
915  print '<td class="liste_titre middle">';
916  $searchpicto = $form->showFilterButtons();
917  print $searchpicto;
918  print '</td>';
919 }
920 print "</tr>\n";
921 
922 print '<tr class="liste_titre">';
923 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
924  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
925 }
926 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
927  print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
928 }
929 if (!empty($arrayfields['d.ref']['checked'])) {
930  print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
931 }
932 if (!empty($arrayfields['d.civility']['checked'])) {
933  print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder);
934 }
935 if (!empty($arrayfields['d.firstname']['checked'])) {
936  print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], 'd.firstname', '', $param, '', $sortfield, $sortorder);
937 }
938 if (!empty($arrayfields['d.lastname']['checked'])) {
939  print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], 'd.lastname', '', $param, '', $sortfield, $sortorder);
940 }
941 if (!empty($arrayfields['d.gender']['checked'])) {
942  print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
943 }
944 if (!empty($arrayfields['d.company']['checked'])) {
945  print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder);
946 }
947 if (!empty($arrayfields['d.login']['checked'])) {
948  print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
949 }
950 if (!empty($arrayfields['d.morphy']['checked'])) {
951  print_liste_field_titre($arrayfields['d.morphy']['label'], $_SERVER["PHP_SELF"], 'd.morphy', '', $param, '', $sortfield, $sortorder);
952 }
953 if (!empty($arrayfields['t.libelle']['checked'])) {
954  print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], 't.libelle', '', $param, '', $sortfield, $sortorder);
955 }
956 if (!empty($arrayfields['d.address']['checked'])) {
957  print_liste_field_titre($arrayfields['d.address']['label'], $_SERVER["PHP_SELF"], 'd.address', '', $param, '', $sortfield, $sortorder);
958 }
959 if (!empty($arrayfields['d.zip']['checked'])) {
960  print_liste_field_titre($arrayfields['d.zip']['label'], $_SERVER["PHP_SELF"], 'd.zip', '', $param, '', $sortfield, $sortorder);
961 }
962 if (!empty($arrayfields['d.town']['checked'])) {
963  print_liste_field_titre($arrayfields['d.town']['label'], $_SERVER["PHP_SELF"], 'd.town', '', $param, '', $sortfield, $sortorder);
964 }
965 if (!empty($arrayfields['state.nom']['checked'])) {
966  print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
967 }
968 if (!empty($arrayfields['country.code_iso']['checked'])) {
969  print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
970 }
971 if (!empty($arrayfields['d.phone']['checked'])) {
972  print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
973 }
974 if (!empty($arrayfields['d.phone_perso']['checked'])) {
975  print_liste_field_titre($arrayfields['d.phone_perso']['label'], $_SERVER["PHP_SELF"], 'd.phone_perso', '', $param, '', $sortfield, $sortorder);
976 }
977 if (!empty($arrayfields['d.phone_mobile']['checked'])) {
978  print_liste_field_titre($arrayfields['d.phone_mobile']['label'], $_SERVER["PHP_SELF"], 'd.phone_mobile', '', $param, '', $sortfield, $sortorder);
979 }
980 if (!empty($arrayfields['d.email']['checked'])) {
981  print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
982 }
983 if (!empty($arrayfields['d.datefin']['checked'])) {
984  print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin,t.subscription', '', $param, '', $sortfield, $sortorder, 'center ');
985 }
986 // Extra fields
987 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
988 
989 // Hook fields
990 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
991 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
992 print $hookmanager->resPrint;
993 
994 if (!empty($arrayfields['d.datec']['checked'])) {
995  print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
996 }
997 if (!empty($arrayfields['d.birth']['checked'])) {
998  print_liste_field_titre($arrayfields['d.birth']['label'], $_SERVER["PHP_SELF"], "d.birth", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
999 }
1000 if (!empty($arrayfields['d.tms']['checked'])) {
1001  print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
1002 }
1003 if (!empty($arrayfields['d.statut']['checked'])) {
1004  print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut,t.subscription,d.datefin", "", $param, 'class="right"', $sortfield, $sortorder);
1005 }
1006 if (!empty($arrayfields['d.import_key']['checked'])) {
1007  print_liste_field_titre($arrayfields['d.import_key']['label'], $_SERVER["PHP_SELF"], "d.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1008 }
1009 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1010  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
1011 }
1012 print "</tr>\n";
1013 
1014 $i = 0;
1015 $totalarray = array();
1016 $totalarray['nbfield'] = 0;
1017 while ($i < min($num, $limit)) {
1018  $obj = $db->fetch_object($resql);
1019 
1020  $datefin = $db->jdate($obj->datefin);
1021 
1022  $memberstatic->id = $obj->rowid;
1023  $memberstatic->ref = $obj->ref;
1024  $memberstatic->civility_id = $obj->civility;
1025  $memberstatic->login = $obj->login;
1026  $memberstatic->lastname = $obj->lastname;
1027  $memberstatic->firstname = $obj->firstname;
1028  $memberstatic->gender = $obj->gender;
1029  $memberstatic->statut = $obj->statut;
1030  $memberstatic->datefin = $datefin;
1031  $memberstatic->socid = $obj->fk_soc;
1032  $memberstatic->photo = $obj->photo;
1033  $memberstatic->email = $obj->email;
1034  $memberstatic->morphy = $obj->morphy;
1035  $memberstatic->note_public = $obj->note_public;
1036  $memberstatic->note_private = $obj->note_private;
1037  $memberstatic->need_subscription = $obj->subscription;
1038 
1039  if (!empty($obj->fk_soc)) {
1040  $memberstatic->fetch_thirdparty();
1041  if ($memberstatic->thirdparty->id > 0) {
1042  $companyname = $memberstatic->thirdparty->name;
1043  $companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
1044  }
1045  } else {
1046  $companyname = $obj->company;
1047  $companynametoshow = $obj->company;
1048  }
1049  $memberstatic->company = $companyname;
1050 
1051  if ($mode == 'kanban') {
1052  if ($i == 0) {
1053  print '<tr><td colspan="12">';
1054  print '<div class="box-flex-container kanban">';
1055  }
1056  $membertypestatic->id = $obj->type_id;
1057  $membertypestatic->label = $obj->type;
1058  $memberstatic->type = $membertypestatic->label;
1059  $memberstatic->photo = $obj->photo;
1060  // Output Kanban
1061  print $memberstatic->getKanbanView('');
1062  if ($i == (min($num, $limit) - 1)) {
1063  print '</div>';
1064  print '</td></tr>';
1065  }
1066  } else {
1067  print '<tr class="oddeven">';
1068 
1069  // Action column
1070  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1071  print '<td class="center">';
1072  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1073  $selected = 0;
1074  if (in_array($obj->rowid, $arrayofselected)) {
1075  $selected = 1;
1076  }
1077  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1078  }
1079  print '</td>';
1080  }
1081  // Technical ID
1082  if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
1083  print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
1084  if (!$i) {
1085  $totalarray['nbfield']++;
1086  }
1087  }
1088  // Ref
1089  if (!empty($arrayfields['d.ref']['checked'])) {
1090  print "<td>";
1091  print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
1092  print "</td>\n";
1093  if (!$i) {
1094  $totalarray['nbfield']++;
1095  }
1096  }
1097  // Civility
1098  if (!empty($arrayfields['d.civility']['checked'])) {
1099  print "<td>";
1100  print $obj->civility;
1101  print "</td>\n";
1102  if (!$i) {
1103  $totalarray['nbfield']++;
1104  }
1105  }
1106  // Firstname
1107  if (!empty($arrayfields['d.firstname']['checked'])) {
1108  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
1109  print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
1110  //print $obj->firstname;
1111  print "</td>\n";
1112  if (!$i) {
1113  $totalarray['nbfield']++;
1114  }
1115  }
1116  // Lastname
1117  if (!empty($arrayfields['d.lastname']['checked'])) {
1118  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">';
1119  print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
1120  //print $obj->lastname;
1121  print "</td>\n";
1122  if (!$i) {
1123  $totalarray['nbfield']++;
1124  }
1125  }
1126  // Gender
1127  if (!empty($arrayfields['d.gender']['checked'])) {
1128  print '<td>';
1129  if ($obj->gender) {
1130  print $langs->trans("Gender".$obj->gender);
1131  }
1132  print '</td>';
1133  if (!$i) {
1134  $totalarray['nbfield']++;
1135  }
1136  }
1137  // Company
1138  if (!empty($arrayfields['d.company']['checked'])) {
1139  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
1140  print $companynametoshow;
1141  print "</td>\n";
1142  }
1143  // Login
1144  if (!empty($arrayfields['d.login']['checked'])) {
1145  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
1146  if (!$i) {
1147  $totalarray['nbfield']++;
1148  }
1149  }
1150  // Nature (Moral/Physical)
1151  if (!empty($arrayfields['d.morphy']['checked'])) {
1152  print '<td class="center">';
1153  print $memberstatic->getmorphylib('', 2);
1154  print "</td>\n";
1155  if (!$i) {
1156  $totalarray['nbfield']++;
1157  }
1158  }
1159  // Type label
1160  if (!empty($arrayfields['t.libelle']['checked'])) {
1161  $membertypestatic->id = $obj->type_id;
1162  $membertypestatic->label = $obj->type;
1163  print '<td class="nowraponall">';
1164  print $membertypestatic->getNomUrl(1, 32);
1165  print '</td>';
1166  if (!$i) {
1167  $totalarray['nbfield']++;
1168  }
1169  }
1170  // Address
1171  if (!empty($arrayfields['d.address']['checked'])) {
1172  print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
1173  print $obj->address;
1174  print '</td>';
1175  if (!$i) {
1176  $totalarray['nbfield']++;
1177  }
1178  }
1179  // Zip
1180  if (!empty($arrayfields['d.zip']['checked'])) {
1181  print '<td class="nocellnopadd">';
1182  print $obj->zip;
1183  print '</td>';
1184  if (!$i) {
1185  $totalarray['nbfield']++;
1186  }
1187  }
1188  // Town
1189  if (!empty($arrayfields['d.town']['checked'])) {
1190  print '<td class="nocellnopadd">';
1191  print $obj->town;
1192  print '</td>';
1193  if (!$i) {
1194  $totalarray['nbfield']++;
1195  }
1196  }
1197  // State / County / Departement
1198  if (!empty($arrayfields['state.nom']['checked'])) {
1199  print "<td>".$obj->state_name."</td>\n";
1200  if (!$i) {
1201  $totalarray['nbfield']++;
1202  }
1203  }
1204  // Country
1205  if (!empty($arrayfields['country.code_iso']['checked'])) {
1206  $tmparray = getCountry($obj->country, 'all');
1207  print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
1208  print dol_escape_htmltag($tmparray['label']);
1209  print '</td>';
1210  if (!$i) {
1211  $totalarray['nbfield']++;
1212  }
1213  }
1214  // Phone pro
1215  if (!empty($arrayfields['d.phone']['checked'])) {
1216  print '<td class="nocellnopadd">';
1217  print $obj->phone;
1218  print '</td>';
1219  if (!$i) {
1220  $totalarray['nbfield']++;
1221  }
1222  }
1223  // Phone perso
1224  if (!empty($arrayfields['d.phone_perso']['checked'])) {
1225  print '<td class="nocellnopadd">';
1226  print $obj->phone_perso;
1227  print '</td>';
1228  if (!$i) {
1229  $totalarray['nbfield']++;
1230  }
1231  }
1232  // Phone mobile
1233  if (!empty($arrayfields['d.phone_mobile']['checked'])) {
1234  print '<td class="nocellnopadd">';
1235  print $obj->phone_mobile;
1236  print '</td>';
1237  if (!$i) {
1238  $totalarray['nbfield']++;
1239  }
1240  }
1241  // EMail
1242  if (!empty($arrayfields['d.email']['checked'])) {
1243  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
1244  print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
1245  print "</td>\n";
1246  }
1247  // End of subscription date
1248  $datefin = $db->jdate($obj->datefin);
1249  if (!empty($arrayfields['d.datefin']['checked'])) {
1250  print '<td class="nowrap center">';
1251  if ($datefin) {
1252  print dol_print_date($datefin, 'day');
1253  if ($memberstatic->hasDelay()) {
1254  $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
1255  print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
1256  }
1257  } else {
1258  if (!empty($obj->subscription)) {
1259  print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
1260  if ($obj->statut > 0) {
1261  print " ".img_warning();
1262  }
1263  } else {
1264  print '&nbsp;';
1265  }
1266  }
1267  print '</td>';
1268  }
1269  // Extra fields
1270  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1271  // Fields from hook
1272  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1273  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1274  print $hookmanager->resPrint;
1275  // Date creation
1276  if (!empty($arrayfields['d.datec']['checked'])) {
1277  print '<td class="nowrap center">';
1278  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1279  print '</td>';
1280  if (!$i) {
1281  $totalarray['nbfield']++;
1282  }
1283  }
1284  // Birth
1285  if (!empty($arrayfields['d.birth']['checked'])) {
1286  print '<td class="nowrap center">';
1287  print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
1288  print '</td>';
1289  if (!$i) {
1290  $totalarray['nbfield']++;
1291  }
1292  }
1293  // Date modification
1294  if (!empty($arrayfields['d.tms']['checked'])) {
1295  print '<td class="nowrap center">';
1296  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1297  print '</td>';
1298  if (!$i) {
1299  $totalarray['nbfield']++;
1300  }
1301  }
1302  // Status
1303  if (!empty($arrayfields['d.statut']['checked'])) {
1304  print '<td class="nowrap right">';
1305  print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
1306  print '</td>';
1307  if (!$i) {
1308  $totalarray['nbfield']++;
1309  }
1310  }
1311  if (!empty($arrayfields['d.import_key']['checked'])) {
1312  print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
1313  print dol_escape_htmltag($obj->import_key);
1314  print "</td>\n";
1315  if (!$i) {
1316  $totalarray['nbfield']++;
1317  }
1318  }
1319  // Action column
1320  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1321  print '<td class="center">';
1322  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1323  $selected = 0;
1324  if (in_array($obj->rowid, $arrayofselected)) {
1325  $selected = 1;
1326  }
1327  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1328  }
1329  print '</td>';
1330  }
1331  if (!$i) {
1332  $totalarray['nbfield']++;
1333  }
1334 
1335  print '</tr>'."\n";
1336  }
1337  $i++;
1338 }
1339 
1340 // Show total line
1341 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1342 
1343 
1344 // If no record found
1345 if ($num == 0) {
1346  $colspan = 1;
1347  foreach ($arrayfields as $key => $val) {
1348  if (!empty($val['checked'])) {
1349  $colspan++;
1350  }
1351  }
1352  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1353 }
1354 
1355 $db->free($resql);
1356 
1357 $parameters = array('sql' => $sql);
1358 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1359 print $hookmanager->resPrint;
1360 
1361 print "</table>\n";
1362 print "</div>";
1363 print '</form>';
1364 
1365 // End of page
1366 llxFooter();
1367 $db->close();
Adherent\STATUS_RESILIATED
const STATUS_RESILIATED
Resiliated.
Definition: adherent.class.php:404
AdherentType
Class to manage members type.
Definition: adherent_type.class.php:35
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1504
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
$sql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:745
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:530
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4994
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
dol_clone
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
Definition: functions.lib.php:1168
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2566
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4025
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
Adherent\STATUS_VALIDATED
const STATUS_VALIDATED
Validated status.
Definition: adherent.class.php:400
dolGetButtonTitle
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Definition: functions.lib.php:11044
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5416
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:46
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:82
Adherent\STATUS_EXCLUDED
const STATUS_EXCLUDED
Excluded.
Definition: adherent.class.php:408
restrictedArea
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:341
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
Adherent\STATUS_DRAFT
const STATUS_DRAFT
Draft status.
Definition: adherent.class.php:396
User
Class to manage Dolibarr users.
Definition: user.class.php:44
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:431
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5181
natural_search
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
Definition: functions.lib.php:9823
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_print_email
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
Definition: functions.lib.php:3068
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2947
getCountry
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
Definition: company.lib.php:515
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
$nbtotalofrecords
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329