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