dolibarr  20.0.0-beta
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-2023 Frédéric France <frederic.france@free.fr>
9  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10  * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
33 // Load Dolibarr environment
34 require '../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39 
40 
41 // Load translation files required by the page
42 $langs->loadLangs(array("members", "companies", "categories"));
43 
44 
45 // Get parameters
46 $action = GETPOST('action', 'aZ09');
47 $massaction = GETPOST('massaction', 'alpha');
48 $show_files = GETPOSTINT('show_files');
49 $confirm = GETPOST('confirm', 'alpha');
50 $cancel = GETPOST('cancel', 'alpha');
51 $toselect = GETPOST('toselect', 'array');
52 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
53 $backtopage = GETPOST('backtopage', 'alpha');
54 $optioncss = GETPOST('optioncss', 'aZ');
55 $mode = GETPOST('mode', 'alpha');
56 
57 // Search fields
58 $search = GETPOST("search", 'alpha');
59 $search_ref = GETPOST("search_ref", 'alpha');
60 $search_lastname = GETPOST("search_lastname", 'alpha');
61 $search_firstname = GETPOST("search_firstname", 'alpha');
62 $search_gender = GETPOST("search_gender", 'alpha');
63 $search_civility = GETPOST("search_civility", 'alpha');
64 $search_company = GETPOST('search_company', 'alphanohtml');
65 $search_login = GETPOST("search_login", 'alpha');
66 $search_address = GETPOST("search_address", 'alpha');
67 $search_zip = GETPOST("search_zip", 'alpha');
68 $search_town = GETPOST("search_town", 'alpha');
69 $search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
70 $search_country = GETPOST("search_country", 'alpha');
71 $search_phone = GETPOST("search_phone", 'alpha');
72 $search_phone_perso = GETPOST("search_phone_perso", 'alpha');
73 $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
74 $search_type = GETPOST("search_type", 'alpha');
75 $search_email = GETPOST("search_email", 'alpha');
76 $search_categ = GETPOST("search_categ", 'intcomma');
77 $search_morphy = GETPOST("search_morphy", 'alpha');
78 $search_import_key = trim(GETPOST("search_import_key", 'alpha'));
79 
80 $socid = GETPOSTINT('socid');
81 if (GETPOSTINT('catid') && empty($search_categ)) {
82  $search_categ = GETPOSTINT('catid');
83 }
84 
85 $search_filter = GETPOST("search_filter", 'alpha');
86 $search_status = GETPOST("search_status", 'intcomma'); // status
87 $search_datec_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datec_start_month'), GETPOSTINT('search_datec_start_day'), GETPOSTINT('search_datec_start_year'));
88 $search_datec_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datec_end_month'), GETPOSTINT('search_datec_end_day'), GETPOSTINT('search_datec_end_year'));
89 $search_datem_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datem_start_month'), GETPOSTINT('search_datem_start_day'), GETPOSTINT('search_datem_start_year'));
90 $search_datem_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datem_end_month'), GETPOSTINT('search_datem_end_day'), GETPOSTINT('search_datem_end_year'));
91 
92 $filter = GETPOST("filter", 'alpha');
93 if ($filter) {
94  $search_filter = $filter; // For backward compatibility
95 }
96 
97 $statut = GETPOST("statut", 'alpha');
98 if ($statut != '') {
99  $search_status = $statut; // For backward compatibility
100 }
101 
102 $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
103 
104 if ($search_status < -2) {
105  $search_status = '';
106 }
107 
108 // Pagination parameters
109 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
110 $sortfield = GETPOST('sortfield', 'aZ09comma');
111 $sortorder = GETPOST('sortorder', 'aZ09comma');
112 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
113 if (empty($page) || $page == -1) {
114  $page = 0;
115 } // If $page is not defined, or '' or -1
116 $offset = $limit * $page;
117 $pageprev = $page - 1;
118 $pagenext = $page + 1;
119 if (!$sortorder) {
120  $sortorder = ($filter == 'outofdate' ? "DESC" : "ASC");
121 }
122 if (!$sortfield) {
123  $sortfield = ($filter == 'outofdate' ? "d.datefin" : "d.lastname");
124 }
125 
126 $object = new Adherent($db);
127 
128 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
129 $hookmanager->initHooks(array('memberlist'));
130 $extrafields = new ExtraFields($db);
131 
132 // fetch optionals attributes and labels
133 $extrafields->fetch_name_optionals_label($object->table_element);
134 
135 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
136 
137 // List of fields to search into when doing a "search in all"
138 $fieldstosearchall = array(
139  'd.ref' => 'Ref',
140  'd.login' => 'Login',
141  'd.lastname' => 'Lastname',
142  'd.firstname' => 'Firstname',
143  'd.societe' => "Company",
144  'd.email' => 'EMail',
145  'd.address' => 'Address',
146  'd.zip' => 'Zip',
147  'd.town' => 'Town',
148  'd.phone' => "Phone",
149  'd.phone_perso' => "PhonePerso",
150  'd.phone_mobile' => "PhoneMobile",
151  'd.note_public' => 'NotePublic',
152  'd.note_private' => 'NotePrivate',
153 );
154 
155 $arrayfields = array(
156  'd.ref' => array('label' => "Ref", 'checked' => 1),
157  'd.civility' => array('label' => "Civility", 'checked' => 0),
158  'd.lastname' => array('label' => "Lastname", 'checked' => 1),
159  'd.firstname' => array('label' => "Firstname", 'checked' => 1),
160  'd.gender' => array('label' => "Gender", 'checked' => 0),
161  'd.company' => array('label' => "Company", 'checked' => 1, 'position' => 70),
162  'd.login' => array('label' => "Login", 'checked' => 1),
163  'd.morphy' => array('label' => "MemberNature", 'checked' => 1),
164  't.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 55),
165  'd.address' => array('label' => "Address", 'checked' => 0),
166  'd.zip' => array('label' => "Zip", 'checked' => 0),
167  'd.town' => array('label' => "Town", 'checked' => 0),
168  'd.phone' => array('label' => "Phone", 'checked' => 0),
169  'd.phone_perso' => array('label' => "PhonePerso", 'checked' => 0),
170  'd.phone_mobile' => array('label' => "PhoneMobile", 'checked' => 0),
171  'd.email' => array('label' => "Email", 'checked' => 1),
172  'state.nom' => array('label' => "State", 'checked' => 0, 'position' => 90),
173  'country.code_iso' => array('label' => "Country", 'checked' => 0, 'position' => 95),
174  /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
175  'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
176  'd.datefin' => array('label' => "EndSubscription"),
177  'd.datec' => array('label' => "DateCreation"),
178  'd.birth' => array('label' => "Birthday"),
179  'd.tms' => array('label' => "DateModificationShort"),
180  'd.statut' => array('label' => "Status"),
181  'd.import_key' => array('label' => "ImportId"),
182 );
183 
184 // Extra fields
185 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
186 
187 $object->fields = dol_sort_array($object->fields, 'position');
188 //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
189 
190 // Complete array of fields for columns
191 $tableprefix = 'd';
192 foreach ($object->fields as $key => $val) {
193  if (!array_key_exists($tableprefix.'.'.$key, $arrayfields)) { // Discard record not into $arrayfields
194  continue;
195  }
196  // If $val['visible']==0, then we never show the field
197 
198  if (!empty($val['visible'])) {
199  $visible = (int) dol_eval($val['visible'], 1);
200  $arrayfields[$tableprefix.'.'.$key] = array(
201  'label' => $val['label'],
202  'checked' => (($visible < 0) ? 0 : 1),
203  'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
204  'position' => $val['position'],
205  'help' => isset($val['help']) ? $val['help'] : ''
206  );
207  }
208 }
209 $arrayfields = dol_sort_array($arrayfields, 'position');
210 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
211 //var_dump($arrayfields);exit;
212 
213 // Security check
214 $result = restrictedArea($user, 'adherent');
215 
216 
217 /*
218  * Actions
219  */
220 
221 if (GETPOST('cancel', 'alpha')) {
222  $action = 'list';
223  $massaction = '';
224 }
225 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
226  $massaction = '';
227 }
228 
229 $parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields);
230 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
231 if ($reshook < 0) {
232  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
233 }
234 
235 if (empty($reshook)) {
236  // Selection of new fields
237  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
238 
239  // Purge search criteria
240  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
241  $statut = '';
242  $filter = '';
243 
244  $search = "";
245  $search_ref = "";
246  $search_lastname = "";
247  $search_firstname = "";
248  $search_gender = "";
249  $search_civility = "";
250  $search_login = "";
251  $search_company = "";
252  $search_type = "";
253  $search_email = "";
254  $search_address = "";
255  $search_zip = "";
256  $search_town = "";
257  $search_state = "";
258  $search_country = '';
259  $search_phone = '';
260  $search_phone_perso = '';
261  $search_phone_mobile = '';
262  $search_morphy = "";
263  $search_categ = "";
264  $search_filter = "";
265  $search_status = "";
266  $search_import_key = '';
267  $catid = "";
268  $search_all = "";
269  $toselect = array();
270  $search_datec_start = '';
271  $search_datec_end = '';
272  $search_datem_start = '';
273  $search_datem_end = '';
274  $search_array_options = array();
275  }
276 
277  // Close
278  if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) {
279  $tmpmember = new Adherent($db);
280  $error = 0;
281  $nbclose = 0;
282 
283  $db->begin();
284 
285  foreach ($toselect as $idtoclose) {
286  $tmpmember->fetch($idtoclose);
287  $result = $tmpmember->resiliate($user);
288 
289  if ($result < 0 && !count($tmpmember->errors)) {
290  setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
291  } else {
292  if ($result > 0) {
293  $nbclose++;
294  }
295  }
296  }
297 
298  if (!$error) {
299  setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
300 
301  $db->commit();
302  } else {
303  $db->rollback();
304  }
305  }
306 
307  // Create external user
308  if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
309  $tmpmember = new Adherent($db);
310  $error = 0;
311  $nbcreated = 0;
312 
313  $db->begin();
314 
315  foreach ($toselect as $idtoclose) {
316  $tmpmember->fetch($idtoclose);
317 
318  if (!empty($tmpmember->socid)) {
319  $nuser = new User($db);
320  $tmpuser = dol_clone($tmpmember, 2);
321 
322  $result = $nuser->create_from_member($tmpuser, $tmpmember->login);
323 
324  if ($result < 0 && !count($tmpmember->errors)) {
325  setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
326  } else {
327  if ($result > 0) {
328  $nbcreated++;
329  }
330  }
331  }
332  }
333 
334  if (!$error) {
335  setEventMessages($langs->trans("XExternalUserCreated", $nbcreated), null, 'mesgs');
336 
337  $db->commit();
338  } else {
339  $db->rollback();
340  }
341  }
342 
343  // Create external user
344  if ($action == 'createsubscription_confirm' && $confirm == "yes" && $user->hasRight('adherent', 'creer')) {
345  $tmpmember = new Adherent($db);
346  $adht = new AdherentType($db);
347  $error = 0;
348  $nbcreated = 0;
349  $now = dol_now();
350  $amount = price2num(GETPOST('amount', 'alpha'));
351  $db->begin();
352  foreach ($toselect as $id) {
353  $res = $tmpmember->fetch($id);
354  if ($res > 0) {
355  $result = $tmpmember->subscription($now, $amount);
356  if ($result < 0) {
357  $error++;
358  } else {
359  $nbcreated++;
360  }
361  } else {
362  $error++;
363  }
364  }
365 
366  if (!$error) {
367  setEventMessages($langs->trans("XSubsriptionCreated", $nbcreated), null, 'mesgs');
368  $db->commit();
369  } else {
370  setEventMessages($langs->trans("XSubsriptionError", $error), null, 'mesgs');
371  $db->rollback();
372  }
373  }
374 
375  // Mass actions
376  $objectclass = 'Adherent';
377  $objectlabel = 'Members';
378  $permissiontoread = $user->hasRight('adherent', 'lire');
379  $permissiontodelete = $user->hasRight('adherent', 'supprimer');
380  $permissiontoadd = $user->hasRight('adherent', 'creer');
381  $uploaddir = $conf->adherent->dir_output;
382  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
383 }
384 
385 
386 /*
387  * View
388  */
389 
390 $form = new Form($db);
391 $formother = new FormOther($db);
392 $membertypestatic = new AdherentType($db);
393 $memberstatic = new Adherent($db);
394 
395 $now = dol_now();
396 
397 // Page Header
398 $title = $langs->trans("Members")." - ".$langs->trans("List");
399 $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
400 $morejs = array();
401 $morecss = array();
402 
403 
404 // Build and execute select
405 // --------------------------------------------------------------------
406 if (!empty($search_categ) && $search_categ > 0) {
407  $sql = "SELECT DISTINCT";
408 } else {
409  $sql = "SELECT";
410 }
411 $sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
412 $sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
413 $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
414 $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut as status, d.datec as date_creation, d.tms as date_modification,";
415 $sql .= " d.note_private, d.note_public, d.import_key,";
416 $sql .= " s.nom,";
417 $sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
418 $sql .= " t.libelle as type, t.subscription,";
419 $sql .= " state.code_departement as state_code, state.nom as state_name";
420 
421 // Add fields from extrafields
422 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
423  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
424  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
425  }
426 }
427 
428 // Add fields from hooks
429 $parameters = array();
430 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
431 $sql .= $hookmanager->resPrint;
432 $sql = preg_replace('/,\s*$/', '', $sql);
433 
434 $sqlfields = $sql; // $sql fields to remove for count total
435 
436 // SQL Alias adherent
437 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead of d
438 if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
439  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
440 }
441 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
442 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
443 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
444 
445 // SQL Alias adherent_type
446 $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
447 $sql .= " WHERE d.fk_adherent_type = t.rowid";
448 
449 $searchCategoryContactList = $search_categ ? array($search_categ) : array();
450 $searchCategoryContactOperator = 0;
451 // Search for tag/category ($searchCategoryContactList is an array of ID)
452 if (!empty($searchCategoryContactList)) {
453  $searchCategoryContactSqlList = array();
454  $listofcategoryid = '';
455  foreach ($searchCategoryContactList as $searchCategoryContact) {
456  if (intval($searchCategoryContact) == -2) {
457  $searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
458  } elseif (intval($searchCategoryContact) > 0) {
459  if ($searchCategoryContactOperator == 0) {
460  $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).")";
461  } else {
462  $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
463  }
464  }
465  }
466  if ($listofcategoryid) {
467  $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)."))";
468  }
469  if ($searchCategoryContactOperator == 1) {
470  if (!empty($searchCategoryContactSqlList)) {
471  $sql .= " AND (".implode(' OR ', $searchCategoryContactSqlList).")";
472  }
473  } else {
474  if (!empty($searchCategoryContactSqlList)) {
475  $sql .= " AND (".implode(' AND ', $searchCategoryContactSqlList).")";
476  }
477  }
478 }
479 
480 $sql .= " AND d.entity IN (".getEntity('adherent').")";
481 if ($search_all) {
482  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
483 }
484 if ($search_type > 0) {
485  $sql .= " AND t.rowid=".((int) $search_type);
486 }
487 if ($search_filter == 'withoutsubscription') {
488  $sql .= " AND (datefin IS NULL)";
489 }
490 if ($search_filter == 'waitingsubscription') {
491  $sql .= " AND (datefin IS NULL AND t.subscription = '1')";
492 }
493 if ($search_filter == 'uptodate') {
494  //$sql .= " AND (datefin >= '".$db->idate($now)."')";
495  // Up to date subscription OR no subscription required
496  $sql .= " AND (datefin >= '".$db->idate($now)."' OR (datefin IS NULL AND t.subscription = '0'))";
497 }
498 if ($search_filter == 'outofdate') {
499  $sql .= " AND (datefin < '".$db->idate($now)."')";
500 }
501 if ($search_status != '') {
502  // Peut valoir un nombre ou liste de nombre separates par virgules
503  $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
504 }
505 if ($search_morphy != '' && $search_morphy != '-1') {
506  $sql .= natural_search("d.morphy", $search_morphy);
507 }
508 if ($search_ref) {
509  $sql .= natural_search("d.ref", $search_ref);
510 }
511 if ($search_civility) {
512  $sql .= natural_search("d.civility", $search_civility);
513 }
514 if ($search_firstname) {
515  $sql .= natural_search("d.firstname", $search_firstname);
516 }
517 if ($search_lastname) {
518  $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
519 }
520 if ($search_gender != '' && $search_gender != '-1') {
521  $sql .= natural_search("d.gender", $search_gender);
522 }
523 if ($search_login) {
524  $sql .= natural_search("d.login", $search_login);
525 }
526 if ($search_company) {
527  $sql .= natural_search("s.nom", $search_company);
528 }
529 if ($search_email) {
530  $sql .= natural_search("d.email", $search_email);
531 }
532 if ($search_address) {
533  $sql .= natural_search("d.address", $search_address);
534 }
535 if ($search_town) {
536  $sql .= natural_search("d.town", $search_town);
537 }
538 if ($search_zip) {
539  $sql .= natural_search("d.zip", $search_zip);
540 }
541 if ($search_state) {
542  $sql .= natural_search("state.nom", $search_state);
543 }
544 if ($search_phone) {
545  $sql .= natural_search("d.phone", $search_phone);
546 }
547 if ($search_phone_perso) {
548  $sql .= natural_search("d.phone_perso", $search_phone_perso);
549 }
550 if ($search_phone_mobile) {
551  $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
552 }
553 if ($search_country) {
554  $sql .= " AND d.country IN (".$db->sanitize($search_country).')';
555 }
556 if ($search_import_key) {
557  $sql .= natural_search("d.import_key", $search_import_key);
558 }
559 if ($search_datec_start) {
560  $sql .= " AND d.datec >= '".$db->idate($search_datec_start)."'";
561 }
562 if ($search_datec_end) {
563  $sql .= " AND d.datec <= '".$db->idate($search_datec_end)."'";
564 }
565 if ($search_datem_start) {
566  $sql .= " AND d.tms >= '".$db->idate($search_datem_start)."'";
567 }
568 if ($search_datem_end) {
569  $sql .= " AND d.tms <= '".$db->idate($search_datem_end)."'";
570 }
571 // Add where from extra fields
572 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
573 // Add where from hooks
574 $parameters = array();
575 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
576 $sql .= $hookmanager->resPrint;
577 
578 // Count total nb of records
579 $nbtotalofrecords = '';
580 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
581  /* The fast and low memory method to get and count full list converts the sql into a sql count */
582  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
583  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
584  $resql = $db->query($sqlforcount);
585  if ($resql) {
586  $objforcount = $db->fetch_object($resql);
587  $nbtotalofrecords = $objforcount->nbtotalofrecords;
588  } else {
589  dol_print_error($db);
590  }
591 
592  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
593  $page = 0;
594  $offset = 0;
595  }
596  $db->free($resql);
597 }
598 //print $sql;
599 
600 // Complete request and execute it with limit
601 $sql .= $db->order($sortfield, $sortorder);
602 if ($limit) {
603  $sql .= $db->plimit($limit + 1, $offset);
604 }
605 
606 $resql = $db->query($sql);
607 if (!$resql) {
608  dol_print_error($db);
609  exit;
610 }
611 
612 $num = $db->num_rows($resql);
613 
614 
615 // Direct jump if only one record found
616 if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
617  $obj = $db->fetch_object($resql);
618  $id = $obj->rowid;
619  header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
620  exit;
621 }
622 
623 // Output page
624 // --------------------------------------------------------------------
625 
626 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
627 
628 $arrayofselected = is_array($toselect) ? $toselect : array();
629 
630 
631 if ($search_type > 0) {
632  $membertype = new AdherentType($db);
633  $result = $membertype->fetch($search_type);
634  $title .= " (".$membertype->label.")";
635 }
636 
637 // $parameters
638 $param = '';
639 if (!empty($mode)) {
640  $param .= '&mode='.urlencode($mode);
641 }
642 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
643  $param .= '&contextpage='.urlencode($contextpage);
644 }
645 if ($limit > 0 && $limit != $conf->liste_limit) {
646  $param .= '&limit='.((int) $limit);
647 }
648 if ($optioncss != '') {
649  $param .= '&optioncss='.urlencode($optioncss);
650 }
651 if ($search_all != "") {
652  $param .= "&search_all=".urlencode($search_all);
653 }
654 if ($search_ref) {
655  $param .= "&search_ref=".urlencode($search_ref);
656 }
657 if ($search_civility) {
658  $param .= "&search_civility=".urlencode($search_civility);
659 }
660 if ($search_firstname) {
661  $param .= "&search_firstname=".urlencode($search_firstname);
662 }
663 if ($search_lastname) {
664  $param .= "&search_lastname=".urlencode($search_lastname);
665 }
666 if ($search_gender) {
667  $param .= "&search_gender=".urlencode($search_gender);
668 }
669 if ($search_login) {
670  $param .= "&search_login=".urlencode($search_login);
671 }
672 if ($search_email) {
673  $param .= "&search_email=".urlencode($search_email);
674 }
675 if ($search_categ > 0 || $search_categ == -2) {
676  $param .= "&search_categ=".urlencode((string) ($search_categ));
677 }
678 if ($search_company) {
679  $param .= "&search_company=".urlencode($search_company);
680 }
681 if ($search_address != '') {
682  $param .= "&search_address=".urlencode($search_address);
683 }
684 if ($search_town != '') {
685  $param .= "&search_town=".urlencode($search_town);
686 }
687 if ($search_zip != '') {
688  $param .= "&search_zip=".urlencode($search_zip);
689 }
690 if ($search_state != '') {
691  $param .= "&search_state=".urlencode($search_state);
692 }
693 if ($search_country != '') {
694  $param .= "&search_country=".urlencode($search_country);
695 }
696 if ($search_phone != '') {
697  $param .= "&search_phone=".urlencode($search_phone);
698 }
699 if ($search_phone_perso != '') {
700  $param .= "&search_phone_perso=".urlencode($search_phone_perso);
701 }
702 if ($search_phone_mobile != '') {
703  $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
704 }
705 if ($search_filter && $search_filter != '-1') {
706  $param .= "&search_filter=".urlencode($search_filter);
707 }
708 if ($search_status != "" && $search_status != -3) {
709  $param .= "&search_status=".urlencode($search_status);
710 }
711 if ($search_import_key != '') {
712  $param .= '&search_import_key='.urlencode($search_import_key);
713 }
714 if ($search_type > 0) {
715  $param .= "&search_type=".urlencode($search_type);
716 }
717 if ($search_datec_start) {
718  $param .= '&search_datec_start_day='.dol_print_date($search_datec_start, '%d').'&search_datec_start_month='.dol_print_date($search_datec_start, '%m').'&search_datec_start_year='.dol_print_date($search_datec_start, '%Y');
719 }
720 if ($search_datem_end) {
721  $param .= '&search_datem_end_day='.dol_print_date($search_datem_end, '%d').'&search_datem_end_month='.dol_print_date($search_datem_end, '%m').'&search_datem_end_year='.dol_print_date($search_datem_end, '%Y');
722 }
723 
724 // Add $param from extra fields
725 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
726 
727 // List of mass actions available
728 $arrayofmassactions = array(
729  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
730  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
731 );
732 if ($user->hasRight('adherent', 'creer')) {
733  $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
734 }
735 if ($user->hasRight('adherent', 'supprimer')) {
736  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
737 }
738 if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) {
739  $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
740 }
741 if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
742  $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
743 }
744 if ($user->hasRight('adherent', 'creer')) {
745  $arrayofmassactions['createsubscription'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("CreateSubscription");
746 }
747 if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
748  $arrayofmassactions = array();
749 }
750 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
751 
752 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
753 if ($optioncss != '') {
754  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
755 }
756 print '<input type="hidden" name="token" value="'.newToken().'">';
757 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
758 print '<input type="hidden" name="action" value="list">';
759 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
760 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
761 print '<input type="hidden" name="page" value="'.$page.'">';
762 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
763 print '<input type="hidden" name="page_y" value="">';
764 print '<input type="hidden" name="mode" value="'.$mode.'">';
765 
766 
767 $newcardbutton = '';
768 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
769 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
770 if ($user->hasRight('adherent', 'creer')) {
771  $newcardbutton .= dolGetButtonTitleSeparator();
772  $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
773 }
774 
775 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
776 
777 $topicmail = "Information";
778 $modelmail = "member";
779 $objecttmp = new Adherent($db);
780 $trackid = 'mem'.$object->id;
781 if ($massaction == 'createsubscription') {
782  $tmpmember = new Adherent($db);
783  $adht = new AdherentType($db);
784  $amount = 0;
785  foreach ($toselect as $id) {
786  $now = dol_now();
787  $tmpmember->fetch($id);
788  $res = $adht->fetch($tmpmember->typeid);
789  if ($res > 0) {
790  $amounttmp = $adht->amount;
791  if (!empty($tmpmember->last_subscription_amount) && !GETPOSTISSET('newamount') && is_numeric($amounttmp)) {
792  $amounttmp = max($tmpmember->last_subscription_amount, $amount);
793  }
794  $amount = max(0, $amounttmp, $amount);
795  } else {
796  $error++;
797  }
798  }
799 
800  $date = dol_print_date(dol_now(), "%d/%m/%Y");
801  $formquestion = array(
802  array('label' => $langs->trans("DateSubscription"), 'type' => 'other', 'value' => $date),
803  array('label' => $langs->trans("Amount"), 'type' => 'text', 'value' => price($amount, 0, '', 0), 'name' => 'amount'),
804  array('type' => 'separator'),
805  array('label' => $langs->trans("MoreActions"), 'type' => 'other', 'value' => $langs->trans("None").' '.img_warning($langs->trans("WarningNoComplementaryActionDone"))),
806  );
807  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSubsriptionCreation"), $langs->trans("ConfirmMassSubsriptionCreationQuestion", count($toselect)), "createsubscription_confirm", $formquestion, '', 0, 200, 500, 1);
808 }
809 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
810 
811 if ($search_all) {
812  $setupstring = '';
813  foreach ($fieldstosearchall as $key => $val) {
814  $fieldstosearchall[$key] = $langs->trans($val);
815  $setupstring .= $key."=".$val.";";
816  }
817  print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
818  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
819 }
820 
821 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
822 $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
823 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
824 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
825 
826 $moreforfilter = '';
827 // Filter on categories
828 if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
829  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
830  $moreforfilter .= '<div class="divsearchfield">';
831  $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
832  $moreforfilter .= '</div>';
833 }
834 $parameters = array(
835  'arrayfields' => &$arrayfields,
836 );
837 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
838 if (empty($reshook)) {
839  $moreforfilter .= $hookmanager->resPrint;
840 } else {
841  $moreforfilter = $hookmanager->resPrint;
842 }
843 if (!empty($moreforfilter)) {
844  print '<div class="liste_titre liste_titre_bydiv centpercent">';
845  print $moreforfilter;
846  $parameters = array();
847  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
848  print $hookmanager->resPrint;
849  print '</div>';
850 }
851 
852 print '<div class="div-table-responsive">';
853 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
854 
855 // Fields title search
856 // --------------------------------------------------------------------
857 print '<tr class="liste_titre_filter">';
858 
859 // Action column
860 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
861  print '<td class="liste_titre center maxwidthsearch">';
862  $searchpicto = $form->showFilterButtons('left');
863  print $searchpicto;
864  print '</td>';
865 }
866 
867 // Line numbering
868 if (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) {
869  print '<td class="liste_titre">&nbsp;</td>';
870 }
871 
872 // Ref
873 if (!empty($arrayfields['d.ref']['checked'])) {
874  print '<td class="liste_titre">';
875  print '<input type="text" class="flat maxwidth75imp" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
876  print '</td>';
877 }
878 
879 // Civility
880 if (!empty($arrayfields['d.civility']['checked'])) {
881  print '<td class="liste_titre left">';
882  print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
883 }
884 
885 // First Name
886 if (!empty($arrayfields['d.firstname']['checked'])) {
887  print '<td class="liste_titre left">';
888  print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
889 }
890 
891 // Last Name
892 if (!empty($arrayfields['d.lastname']['checked'])) {
893  print '<td class="liste_titre left">';
894  print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
895 }
896 
897 // Gender
898 if (!empty($arrayfields['d.gender']['checked'])) {
899  print '<td class="liste_titre">';
900  $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother"));
901  print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
902  print '</td>';
903 }
904 
905 // Company
906 if (!empty($arrayfields['d.company']['checked'])) {
907  print '<td class="liste_titre left">';
908  print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
909 }
910 
911 // Login
912 if (!empty($arrayfields['d.login']['checked'])) {
913  print '<td class="liste_titre left">';
914  print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
915 }
916 
917 // Nature
918 if (!empty($arrayfields['d.morphy']['checked'])) {
919  print '<td class="liste_titre center">';
920  $arraymorphy = array('mor' => $langs->trans("Moral"), 'phy' => $langs->trans("Physical"));
921  print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
922  print '</td>';
923 }
924 
925 // Member Type
926 if (!empty($arrayfields['t.libelle']['checked'])) {
927  print '</td>';
928 }
929 if (!empty($arrayfields['t.libelle']['checked'])) {
930  print '<td class="liste_titre">';
931  $listetype = $membertypestatic->liste_array();
932  // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
933  print $form->selectarray("search_type", $listetype, $search_type, 1, 0, 0, '', 0, 32);
934  print '</td>';
935 }
936 
937 // Address - Street
938 if (!empty($arrayfields['d.address']['checked'])) {
939  print '<td class="liste_titre left">';
940  print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>';
941 }
942 
943 // ZIP
944 if (!empty($arrayfields['d.zip']['checked'])) {
945  print '<td class="liste_titre left">';
946  print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
947 }
948 
949 // Town/City
950 if (!empty($arrayfields['d.town']['checked'])) {
951  print '<td class="liste_titre left">';
952  print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
953 }
954 
955 // State / County / Departement
956 if (!empty($arrayfields['state.nom']['checked'])) {
957  print '<td class="liste_titre">';
958  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
959  print '</td>';
960 }
961 
962 // Country
963 if (!empty($arrayfields['country.code_iso']['checked'])) {
964  print '<td class="liste_titre center">';
965  print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
966  print '</td>';
967 }
968 
969 // Phone pro
970 if (!empty($arrayfields['d.phone']['checked'])) {
971  print '<td class="liste_titre left">';
972  print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>';
973 }
974 
975 // Phone perso
976 if (!empty($arrayfields['d.phone_perso']['checked'])) {
977  print '<td class="liste_titre left">';
978  print '<input class="flat maxwidth75imp" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
979 }
980 
981 // Phone mobile
982 if (!empty($arrayfields['d.phone_mobile']['checked'])) {
983  print '<td class="liste_titre left">';
984  print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>';
985 }
986 
987 // Email
988 if (!empty($arrayfields['d.email']['checked'])) {
989  print '<td class="liste_titre left">';
990  print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
991 }
992 
993 // End of subscription date
994 if (!empty($arrayfields['d.datefin']['checked'])) {
995  print '<td class="liste_titre center">';
996  //$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
997  $selectarray = array('-1' => '', 'waitingsubscription' => $langs->trans("WaitingSubscription"), 'uptodate' => $langs->trans("UpToDate"), 'outofdate' => $langs->trans("OutOfDate"));
998  print $form->selectarray('search_filter', $selectarray, $search_filter);
999  print '</td>';
1000 }
1001 
1002 // Extra fields
1003 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1004 
1005 // Fields from hook
1006 $parameters = array('arrayfields' => $arrayfields);
1007 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1008 print $hookmanager->resPrint;
1009 
1010 // Date creation
1011 if (!empty($arrayfields['d.datec']['checked'])) {
1012  print '<td class="liste_titre">';
1013  print '<div class="nowrapfordate">';
1014  print $form->selectDate($search_datec_start ? $search_datec_start : -1, 'search_datec_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1015  print '</div>';
1016  print '<div class="nowrapfordate">';
1017  print $form->selectDate($search_datec_end ? $search_datec_end : -1, 'search_datec_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1018  print '</div>';
1019  print '</td>';
1020 }
1021 
1022 // Birthday
1023 if (!empty($arrayfields['d.birth']['checked'])) {
1024  print '<td class="liste_titre">';
1025  print '</td>';
1026 }
1027 
1028 // Date modification
1029 if (!empty($arrayfields['d.tms']['checked'])) {
1030  print '<td class="liste_titre">';
1031  print '<div class="nowrapfordate">';
1032  print $form->selectDate($search_datem_start ? $search_datem_start : -1, 'search_datem_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1033  print '</div>';
1034  print '<div class="nowrapfordate">';
1035  print $form->selectDate($search_datem_end ? $search_datem_end : -1, 'search_datem_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1036  print '</div>';
1037  print '</td>';
1038 }
1039 
1040 // Import Key
1041 if (!empty($arrayfields['d.import_key']['checked'])) {
1042  print '<td class="liste_titre center">';
1043  print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1044  print '</td>';
1045 }
1046 
1047 // Status
1048 if (!empty($arrayfields['d.statut']['checked'])) {
1049  print '<td class="liste_titre center parentonrightofpage">';
1050  $liststatus = array(
1051  Adherent::STATUS_DRAFT => $langs->trans("Draft"),
1052  Adherent::STATUS_VALIDATED => $langs->trans("Validated"),
1053  Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
1054  Adherent::STATUS_EXCLUDED => $langs->trans("MemberStatusExcludedShort")
1055  );
1056  // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1057  print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
1058  print '</td>';
1059 }
1060 
1061 // Action column
1062 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1063  print '<td class="liste_titre center maxwidthsearch">';
1064  $searchpicto = $form->showFilterButtons();
1065  print $searchpicto;
1066  print '</td>';
1067 }
1068 print '</tr>'."\n";
1069 
1070 $totalarray = array();
1071 $totalarray['nbfield'] = 0;
1072 
1073 // Fields title label
1074 // --------------------------------------------------------------------
1075 print '<tr class="liste_titre">';
1076 // Action column
1077 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1078  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
1079  $totalarray['nbfield']++;
1080 }
1081 if (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) {
1082  print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
1083  $totalarray['nbfield']++;
1084 }
1085 if (!empty($arrayfields['d.ref']['checked'])) {
1086  print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
1087  $totalarray['nbfield']++;
1088 }
1089 if (!empty($arrayfields['d.civility']['checked'])) {
1090  print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder);
1091  $totalarray['nbfield']++;
1092 }
1093 if (!empty($arrayfields['d.firstname']['checked'])) {
1094  print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], 'd.firstname', '', $param, '', $sortfield, $sortorder);
1095  $totalarray['nbfield']++;
1096 }
1097 if (!empty($arrayfields['d.lastname']['checked'])) {
1098  print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], 'd.lastname', '', $param, '', $sortfield, $sortorder);
1099  $totalarray['nbfield']++;
1100 }
1101 if (!empty($arrayfields['d.gender']['checked'])) {
1102  print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
1103  $totalarray['nbfield']++;
1104 }
1105 if (!empty($arrayfields['d.company']['checked'])) {
1106  print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder);
1107  $totalarray['nbfield']++;
1108 }
1109 if (!empty($arrayfields['d.login']['checked'])) {
1110  print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
1111  $totalarray['nbfield']++;
1112 }
1113 if (!empty($arrayfields['d.morphy']['checked'])) {
1114  print_liste_field_titre($arrayfields['d.morphy']['label'], $_SERVER["PHP_SELF"], 'd.morphy', '', $param, '', $sortfield, $sortorder);
1115  $totalarray['nbfield']++;
1116 }
1117 if (!empty($arrayfields['t.libelle']['checked'])) {
1118  print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], 't.libelle', '', $param, '', $sortfield, $sortorder);
1119  $totalarray['nbfield']++;
1120 }
1121 if (!empty($arrayfields['d.address']['checked'])) {
1122  print_liste_field_titre($arrayfields['d.address']['label'], $_SERVER["PHP_SELF"], 'd.address', '', $param, '', $sortfield, $sortorder);
1123  $totalarray['nbfield']++;
1124 }
1125 if (!empty($arrayfields['d.zip']['checked'])) {
1126  print_liste_field_titre($arrayfields['d.zip']['label'], $_SERVER["PHP_SELF"], 'd.zip', '', $param, '', $sortfield, $sortorder);
1127  $totalarray['nbfield']++;
1128 }
1129 if (!empty($arrayfields['d.town']['checked'])) {
1130  print_liste_field_titre($arrayfields['d.town']['label'], $_SERVER["PHP_SELF"], 'd.town', '', $param, '', $sortfield, $sortorder);
1131  $totalarray['nbfield']++;
1132 }
1133 if (!empty($arrayfields['state.nom']['checked'])) {
1134  print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1135  $totalarray['nbfield']++;
1136 }
1137 if (!empty($arrayfields['country.code_iso']['checked'])) {
1138  print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1139  $totalarray['nbfield']++;
1140 }
1141 if (!empty($arrayfields['d.phone']['checked'])) {
1142  print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
1143  $totalarray['nbfield']++;
1144 }
1145 if (!empty($arrayfields['d.phone_perso']['checked'])) {
1146  print_liste_field_titre($arrayfields['d.phone_perso']['label'], $_SERVER["PHP_SELF"], 'd.phone_perso', '', $param, '', $sortfield, $sortorder);
1147  $totalarray['nbfield']++;
1148 }
1149 if (!empty($arrayfields['d.phone_mobile']['checked'])) {
1150  print_liste_field_titre($arrayfields['d.phone_mobile']['label'], $_SERVER["PHP_SELF"], 'd.phone_mobile', '', $param, '', $sortfield, $sortorder);
1151  $totalarray['nbfield']++;
1152 }
1153 if (!empty($arrayfields['d.email']['checked'])) {
1154  print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
1155  $totalarray['nbfield']++;
1156 }
1157 if (!empty($arrayfields['d.datefin']['checked'])) {
1158  print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin,t.subscription', '', $param, '', $sortfield, $sortorder, 'center ');
1159  $totalarray['nbfield']++;
1160 }
1161 // Extra fields
1162 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1163 
1164 // Hook fields
1165 $parameters = array('arrayfields' => $arrayfields, 'totalarray' => &$totalarray, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
1166 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
1167 print $hookmanager->resPrint;
1168 
1169 if (!empty($arrayfields['d.datec']['checked'])) {
1170  print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1171  $totalarray['nbfield']++;
1172 }
1173 if (!empty($arrayfields['d.birth']['checked'])) {
1174  print_liste_field_titre($arrayfields['d.birth']['label'], $_SERVER["PHP_SELF"], "d.birth", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1175  $totalarray['nbfield']++;
1176 }
1177 if (!empty($arrayfields['d.tms']['checked'])) {
1178  print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1179  $totalarray['nbfield']++;
1180 }
1181 if (!empty($arrayfields['d.import_key']['checked'])) {
1182  print_liste_field_titre($arrayfields['d.import_key']['label'], $_SERVER["PHP_SELF"], "d.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1183  $totalarray['nbfield']++;
1184 }
1185 if (!empty($arrayfields['d.statut']['checked'])) {
1186  print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut,t.subscription,d.datefin", "", $param, '', $sortfield, $sortorder, 'center ');
1187  $totalarray['nbfield']++;
1188 }
1189 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1190  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
1191  $totalarray['nbfield']++;
1192 }
1193 print "</tr>\n";
1194 
1195 // Loop on record
1196 // --------------------------------------------------------------------
1197 $i = 0;
1198 $savnbfield = $totalarray['nbfield'];
1199 $totalarray = array();
1200 $totalarray['nbfield'] = 0;
1201 $imaxinloop = ($limit ? min($num, $limit) : $num);
1202 while ($i < $imaxinloop) {
1203  $obj = $db->fetch_object($resql);
1204  if (empty($obj)) {
1205  break; // Should not happen
1206  }
1207 
1208  $datefin = $db->jdate($obj->datefin);
1209 
1210  $memberstatic->id = $obj->rowid;
1211  $memberstatic->ref = $obj->ref;
1212  $memberstatic->civility_code = $obj->civility;
1213  $memberstatic->login = $obj->login;
1214  $memberstatic->lastname = $obj->lastname;
1215  $memberstatic->firstname = $obj->firstname;
1216  $memberstatic->gender = $obj->gender;
1217  $memberstatic->status = $obj->status;
1218  $memberstatic->datefin = $datefin;
1219  $memberstatic->socid = $obj->fk_soc;
1220  $memberstatic->photo = $obj->photo;
1221  $memberstatic->email = $obj->email;
1222  $memberstatic->morphy = $obj->morphy;
1223  $memberstatic->note_public = $obj->note_public;
1224  $memberstatic->note_private = $obj->note_private;
1225  $memberstatic->need_subscription = $obj->subscription;
1226 
1227  if (!empty($obj->fk_soc)) {
1228  $memberstatic->fetch_thirdparty();
1229  if ($memberstatic->thirdparty->id > 0) {
1230  $companyname = $memberstatic->thirdparty->name;
1231  $companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
1232  }
1233  } else {
1234  $companyname = $obj->company;
1235  $companynametoshow = $obj->company;
1236  }
1237  $memberstatic->company = $companyname;
1238 
1239  $object = $memberstatic;
1240 
1241  if ($mode == 'kanban') {
1242  if ($i == 0) {
1243  print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1244  print '<div class="box-flex-container kanban">';
1245  }
1246  $membertypestatic->id = $obj->type_id;
1247  $membertypestatic->label = $obj->type;
1248  $memberstatic->type = $membertypestatic->label;
1249  $memberstatic->photo = $obj->photo;
1250  // Output Kanban
1251  print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
1252  if ($i == (min($num, $limit) - 1)) {
1253  print '</div>';
1254  print '</td></tr>';
1255  }
1256  } else {
1257  // Show line of result
1258  $j = 0;
1259  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
1260 
1261  // Action column
1262  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1263  print '<td class="nowrap center">';
1264  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1265  $selected = 0;
1266  if (in_array($obj->rowid, $arrayofselected)) {
1267  $selected = 1;
1268  }
1269  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1270  }
1271  print '</td>';
1272  if (!$i) {
1273  $totalarray['nbfield']++;
1274  }
1275  }
1276  // Technical ID
1277  if (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) {
1278  print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
1279  if (!$i) {
1280  $totalarray['nbfield']++;
1281  }
1282  }
1283  // Ref
1284  if (!empty($arrayfields['d.ref']['checked'])) {
1285  print "<td>";
1286  print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
1287  print "</td>\n";
1288  if (!$i) {
1289  $totalarray['nbfield']++;
1290  }
1291  }
1292  // Title/Civility
1293  if (!empty($arrayfields['d.civility']['checked'])) {
1294  print "<td>";
1295  print dol_escape_htmltag($obj->civility);
1296  print "</td>\n";
1297  if (!$i) {
1298  $totalarray['nbfield']++;
1299  }
1300  }
1301  // Firstname
1302  if (!empty($arrayfields['d.firstname']['checked'])) {
1303  print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->firstname).'">';
1304  print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
1305  //print $obj->firstname;
1306  print "</td>\n";
1307  if (!$i) {
1308  $totalarray['nbfield']++;
1309  }
1310  }
1311  // Lastname
1312  if (!empty($arrayfields['d.lastname']['checked'])) {
1313  print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->lastname).'">';
1314  print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
1315  //print $obj->lastname;
1316  print "</td>\n";
1317  if (!$i) {
1318  $totalarray['nbfield']++;
1319  }
1320  }
1321  // Gender
1322  if (!empty($arrayfields['d.gender']['checked'])) {
1323  print '<td>';
1324  if ($obj->gender) {
1325  print $langs->trans("Gender".$obj->gender);
1326  }
1327  print '</td>';
1328  if (!$i) {
1329  $totalarray['nbfield']++;
1330  }
1331  }
1332  // Company
1333  if (!empty($arrayfields['d.company']['checked'])) {
1334  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
1335  print $companynametoshow;
1336  print "</td>\n";
1337  }
1338  // Login
1339  if (!empty($arrayfields['d.login']['checked'])) {
1340  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
1341  if (!$i) {
1342  $totalarray['nbfield']++;
1343  }
1344  }
1345  // Nature (Moral/Physical)
1346  if (!empty($arrayfields['d.morphy']['checked'])) {
1347  print '<td class="center">';
1348  print $memberstatic->getmorphylib('', 2);
1349  print "</td>\n";
1350  if (!$i) {
1351  $totalarray['nbfield']++;
1352  }
1353  }
1354  // Type label
1355  if (!empty($arrayfields['t.libelle']['checked'])) {
1356  $membertypestatic->id = $obj->type_id;
1357  $membertypestatic->label = $obj->type;
1358  print '<td class="nowraponall">';
1359  print $membertypestatic->getNomUrl(1, 32);
1360  print '</td>';
1361  if (!$i) {
1362  $totalarray['nbfield']++;
1363  }
1364  }
1365  // Address
1366  if (!empty($arrayfields['d.address']['checked'])) {
1367  print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
1368  print dol_escape_htmltag($obj->address);
1369  print '</td>';
1370  if (!$i) {
1371  $totalarray['nbfield']++;
1372  }
1373  }
1374  // Zip
1375  if (!empty($arrayfields['d.zip']['checked'])) {
1376  print '<td class="nocellnopadd">';
1377  print dol_escape_htmltag($obj->zip);
1378  print '</td>';
1379  if (!$i) {
1380  $totalarray['nbfield']++;
1381  }
1382  }
1383  // Town
1384  if (!empty($arrayfields['d.town']['checked'])) {
1385  print '<td class="nocellnopadd">';
1386  print dol_escape_htmltag($obj->town);
1387  print '</td>';
1388  if (!$i) {
1389  $totalarray['nbfield']++;
1390  }
1391  }
1392  // State / County / Departement
1393  if (!empty($arrayfields['state.nom']['checked'])) {
1394  print "<td>";
1395  print dol_escape_htmltag($obj->state_name);
1396  print "</td>\n";
1397  if (!$i) {
1398  $totalarray['nbfield']++;
1399  }
1400  }
1401  // Country
1402  if (!empty($arrayfields['country.code_iso']['checked'])) {
1403  $tmparray = getCountry($obj->country, 'all');
1404  print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
1405  print dol_escape_htmltag($tmparray['label']);
1406  print '</td>';
1407  if (!$i) {
1408  $totalarray['nbfield']++;
1409  }
1410  }
1411  // Phone pro
1412  if (!empty($arrayfields['d.phone']['checked'])) {
1413  print '<td class="nocellnopadd">';
1414  print dol_print_phone($obj->phone);
1415  print '</td>';
1416  if (!$i) {
1417  $totalarray['nbfield']++;
1418  }
1419  }
1420  // Phone perso
1421  if (!empty($arrayfields['d.phone_perso']['checked'])) {
1422  print '<td class="nocellnopadd">';
1423  print dol_print_phone($obj->phone_perso);
1424  print '</td>';
1425  if (!$i) {
1426  $totalarray['nbfield']++;
1427  }
1428  }
1429  // Phone mobile
1430  if (!empty($arrayfields['d.phone_mobile']['checked'])) {
1431  print '<td class="nocellnopadd">';
1432  print dol_print_phone($obj->phone_mobile);
1433  print '</td>';
1434  if (!$i) {
1435  $totalarray['nbfield']++;
1436  }
1437  }
1438  // EMail
1439  if (!empty($arrayfields['d.email']['checked'])) {
1440  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
1441  print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
1442  print "</td>\n";
1443  if (!$i) {
1444  $totalarray['nbfield']++;
1445  }
1446  }
1447  // End of subscription date
1448  $datefin = $db->jdate($obj->datefin);
1449  if (!empty($arrayfields['d.datefin']['checked'])) {
1450  $s = '';
1451  if ($datefin) {
1452  $s .= dol_print_date($datefin, 'day');
1453  if ($memberstatic->hasDelay()) {
1454  $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").')';
1455  $s .= " ".img_warning($langs->trans("SubscriptionLate").$textlate);
1456  }
1457  } else {
1458  if (!empty($obj->subscription)) {
1459  $s .= '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
1460  if ($obj->status > 0) {
1461  $s .= " ".img_warning();
1462  }
1463  } else {
1464  $s .= '<span class="opacitymedium">'.$langs->trans("SubscriptionNotNeeded").'</span>';
1465  }
1466  }
1467  print '<td class="nowraponall center tdoverflowmax150" title="'.dolPrintHTMLForAttribute(dol_string_nohtmltag($s)).'">';
1468  print $s;
1469  print '</td>';
1470  if (!$i) {
1471  $totalarray['nbfield']++;
1472  }
1473  }
1474  // Extra fields
1475  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1476  // Fields from hook
1477  $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1478  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1479  print $hookmanager->resPrint;
1480  // Date creation
1481  if (!empty($arrayfields['d.datec']['checked'])) {
1482  print '<td class="nowrap center">';
1483  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1484  print '</td>';
1485  if (!$i) {
1486  $totalarray['nbfield']++;
1487  }
1488  }
1489  // Birth
1490  if (!empty($arrayfields['d.birth']['checked'])) {
1491  print '<td class="nowrap center">';
1492  print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
1493  print '</td>';
1494  if (!$i) {
1495  $totalarray['nbfield']++;
1496  }
1497  }
1498  // Date modification
1499  if (!empty($arrayfields['d.tms']['checked'])) {
1500  print '<td class="nowrap center">';
1501  print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1502  print '</td>';
1503  if (!$i) {
1504  $totalarray['nbfield']++;
1505  }
1506  }
1507  // Import key
1508  if (!empty($arrayfields['d.import_key']['checked'])) {
1509  print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
1510  print dol_escape_htmltag($obj->import_key);
1511  print "</td>\n";
1512  if (!$i) {
1513  $totalarray['nbfield']++;
1514  }
1515  }
1516  // Status
1517  if (!empty($arrayfields['d.statut']['checked'])) {
1518  print '<td class="nowrap center">';
1519  print $memberstatic->LibStatut($obj->status, $obj->subscription, $datefin, 5);
1520  print '</td>';
1521  if (!$i) {
1522  $totalarray['nbfield']++;
1523  }
1524  }
1525  // Action column
1526  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1527  print '<td class="center">';
1528  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1529  $selected = 0;
1530  if (in_array($obj->rowid, $arrayofselected)) {
1531  $selected = 1;
1532  }
1533  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1534  }
1535  print '</td>';
1536  if (!$i) {
1537  $totalarray['nbfield']++;
1538  }
1539  }
1540 
1541  print '</tr>'."\n";
1542  }
1543  $i++;
1544 }
1545 
1546 // Show total line
1547 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1548 
1549 
1550 // If no record found
1551 if ($num == 0) {
1552  $colspan = 1;
1553  foreach ($arrayfields as $key => $val) {
1554  if (!empty($val['checked'])) {
1555  $colspan++;
1556  }
1557  }
1558  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1559 }
1560 
1561 $db->free($resql);
1562 
1563 $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1564 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1565 print $hookmanager->resPrint;
1566 
1567 print '</table>'."\n";
1568 print '</div>'."\n";
1569 
1570 print '</form>'."\n";
1571 
1572 if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1573  $hidegeneratedfilelistifempty = 1;
1574  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1575  $hidegeneratedfilelistifempty = 0;
1576  }
1577 
1578  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1579  $formfile = new FormFile($db);
1580 
1581  // Show list of available documents
1582  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1583  $urlsource .= str_replace('&amp;', '&', $param);
1584 
1585  $filedir = $diroutputmassaction;
1586  $genallowed = $permissiontoread;
1587  $delallowed = $permissiontoadd;
1588 
1589  print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1590 }
1591 
1592 // End of page
1593 llxFooter();
1594 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
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 offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
Class to manage Dolibarr users.
Definition: user.class.php:50
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:745
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ="&nbsp;", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.