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