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