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