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