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