dolibarr 21.0.0-beta
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
6 * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2018-2024 Alexandre Spangaro <aspangaro@open-dsi.fr>
8 * Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
11 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
34// Load Dolibarr environment
35require '../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
37require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
40
41
50// Load translation files required by the page
51$langs->loadLangs(array("members", "companies", "categories"));
52
53
54// Get parameters
55$action = GETPOST('action', 'aZ09');
56$massaction = GETPOST('massaction', 'alpha');
57$show_files = GETPOSTINT('show_files');
58$confirm = GETPOST('confirm', 'alpha');
59$cancel = GETPOST('cancel', 'alpha');
60$toselect = GETPOST('toselect', 'array');
61$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
62$backtopage = GETPOST('backtopage', 'alpha');
63$optioncss = GETPOST('optioncss', 'aZ');
64$mode = GETPOST('mode', 'alpha');
65$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
66
67// Search fields
68$search = GETPOST("search", 'alpha');
69$search_id = GETPOST('search_id', 'int');
70$search_ref = GETPOST("search_ref", 'alpha');
71$search_lastname = GETPOST("search_lastname", 'alpha');
72$search_firstname = GETPOST("search_firstname", 'alpha');
73$search_gender = GETPOST("search_gender", 'alpha');
74$search_civility = GETPOST("search_civility", 'alpha');
75$search_company = GETPOST('search_company', 'alphanohtml');
76$search_login = GETPOST("search_login", 'alpha');
77$search_address = GETPOST("search_address", 'alpha');
78$search_zip = GETPOST("search_zip", 'alpha');
79$search_town = GETPOST("search_town", 'alpha');
80$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
81$search_country = GETPOST("search_country", 'alpha');
82$search_phone = GETPOST("search_phone", 'alpha');
83$search_phone_perso = GETPOST("search_phone_perso", 'alpha');
84$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
85$search_type = GETPOST("search_type", 'alpha');
86$search_email = GETPOST("search_email", 'alpha');
87$search_categ = GETPOST("search_categ", 'intcomma');
88$search_morphy = GETPOST("search_morphy", 'alpha');
89$search_import_key = trim(GETPOST("search_import_key", 'alpha'));
90
91$socid = GETPOSTINT('socid');
92if (GETPOSTINT('catid') && empty($search_categ)) {
93 $search_categ = GETPOSTINT('catid');
94}
95
96$search_filter = GETPOST("search_filter", 'alpha');
97$search_status = GETPOST("search_status", 'intcomma'); // status
98$search_datec_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datec_start_month'), GETPOSTINT('search_datec_start_day'), GETPOSTINT('search_datec_start_year'));
99$search_datec_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datec_end_month'), GETPOSTINT('search_datec_end_day'), GETPOSTINT('search_datec_end_year'));
100$search_datem_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datem_start_month'), GETPOSTINT('search_datem_start_day'), GETPOSTINT('search_datem_start_year'));
101$search_datem_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datem_end_month'), GETPOSTINT('search_datem_end_day'), GETPOSTINT('search_datem_end_year'));
102
103$filter = GETPOST("filter", 'alpha');
104if ($filter) {
105 $search_filter = $filter; // For backward compatibility
106}
107
108$statut = GETPOST("statut", 'alpha');
109if ($statut != '') {
110 $search_status = $statut; // For backward compatibility
111}
112
113$search_all = trim(GETPOST('search_all', 'alphanohtml'));
114
115if ($search_status < -2) {
116 $search_status = '';
117}
118
119// Load variable for pagination
120$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
121$sortfield = GETPOST('sortfield', 'aZ09comma');
122$sortorder = GETPOST('sortorder', 'aZ09comma');
123$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
124if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
125 // If $page is not defined, or '' or -1 or if we click on clear filters
126 $page = 0;
127}
128$offset = $limit * $page;
129$pageprev = $page - 1;
130$pagenext = $page + 1;
131if (!$sortorder) {
132 $sortorder = ($filter == 'outofdate' ? "DESC" : "ASC");
133}
134if (!$sortfield) {
135 $sortfield = ($filter == 'outofdate' ? "d.datefin" : "d.lastname");
136}
137
138$object = new Adherent($db);
139
140// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
141$hookmanager->initHooks(array('memberlist'));
142$extrafields = new ExtraFields($db);
143
144// Fetch optionals attributes and labels
145$extrafields->fetch_name_optionals_label($object->table_element);
146
147$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
148
149// List of fields to search into when doing a "search in all"
150$fieldstosearchall = array(
151 'd.ref' => 'Ref',
152 'd.login' => 'Login',
153 'd.lastname' => 'Lastname',
154 'd.firstname' => 'Firstname',
155 'd.societe' => "Company",
156 'd.email' => 'EMail',
157 'd.address' => 'Address',
158 'd.zip' => 'Zip',
159 'd.town' => 'Town',
160 'd.phone' => "Phone",
161 'd.phone_perso' => "PhonePerso",
162 'd.phone_mobile' => "PhoneMobile",
163 'd.note_public' => 'NotePublic',
164 'd.note_private' => 'NotePrivate',
165);
166
167$arrayfields = array(
168 'd.rowid' => array('label' => 'ID', 'checked' => 1, 'enabled' => getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID'), 'position' => 1),
169 'd.ref' => array('label' => "Ref", 'checked' => 1),
170 'd.civility' => array('label' => "Civility", 'checked' => 0),
171 'd.lastname' => array('label' => "Lastname", 'checked' => 1),
172 'd.firstname' => array('label' => "Firstname", 'checked' => 1),
173 'd.gender' => array('label' => "Gender", 'checked' => 0),
174 'd.company' => array('label' => "Company", 'checked' => 1, 'position' => 70),
175 'd.login' => array('label' => "Login", 'checked' => 1),
176 'd.morphy' => array('label' => "MemberNature", 'checked' => 1),
177 't.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 55),
178 'd.address' => array('label' => "Address", 'checked' => 0),
179 'd.zip' => array('label' => "Zip", 'checked' => 0),
180 'd.town' => array('label' => "Town", 'checked' => 0),
181 'd.phone' => array('label' => "Phone", 'checked' => 0),
182 'd.phone_perso' => array('label' => "PhonePerso", 'checked' => 0),
183 'd.phone_mobile' => array('label' => "PhoneMobile", 'checked' => 0),
184 'd.email' => array('label' => "Email", 'checked' => 1),
185 'state.nom' => array('label' => "State", 'checked' => 0, 'position' => 90),
186 'country.code_iso' => array('label' => "Country", 'checked' => 0, 'position' => 95),
187 /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
188 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
189 'd.datefin' => array('label' => "EndSubscription"),
190 'd.datec' => array('label' => "DateCreation"),
191 'd.birth' => array('label' => "Birthday"),
192 'd.tms' => array('label' => "DateModificationShort"),
193 'd.statut' => array('label' => "Status"),
194 'd.import_key' => array('label' => "ImportId"),
195);
196
197// Complete array of fields for columns
198$tableprefix = 'd';
199foreach ($object->fields as $key => $val) {
200 // If $val['visible']==0, then we never show the field
201 if (!empty($val['visible'])) {
202 $visible = (int) dol_eval((string) $val['visible'], 1);
203 $arrayfields[$tableprefix.'.'.$key] = array(
204 'label' => $val['label'],
205 'checked' => (($visible < 0) ? 0 : 1),
206 'enabled' => (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
207 'position' => (int) $val['position'],
208 'help' => isset($val['help']) ? $val['help'] : ''
209 );
210 }
211}
212
213// Extra fields
214include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
215
216$object->fields = dol_sort_array($object->fields, 'position');
217//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
218
219$arrayfields = dol_sort_array($arrayfields, 'position');
220'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
221
222// Security check
223$result = restrictedArea($user, 'adherent');
224
225
226/*
227 * Actions
228 */
229
230if (GETPOST('cancel', 'alpha')) {
231 $action = 'list';
232 $massaction = '';
233}
234if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
235 $massaction = '';
236}
237
238$permissiontoread = ($user->hasRight('adherent', 'lire') == 1);
239$permissiontodelete = ($user->hasRight('adherent', 'supprimer') == 1);
240$permissiontoadd = ($user->hasRight('adherent', 'creer') == 1);
241$uploaddir = $conf->adherent->dir_output;
242$error = 0;
243
244$parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields);
245$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
246if ($reshook < 0) {
247 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
248}
249
250if (empty($reshook)) {
251 // Selection of new fields
252 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
253
254 // Purge search criteria
255 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
256 $statut = '';
257 $filter = '';
258
259 $search = "";
260 $search_id = '';
261 $search_ref = "";
262 $search_lastname = "";
263 $search_firstname = "";
264 $search_gender = "";
265 $search_civility = "";
266 $search_login = "";
267 $search_company = "";
268 $search_type = "";
269 $search_email = "";
270 $search_address = "";
271 $search_zip = "";
272 $search_town = "";
273 $search_state = "";
274 $search_country = '';
275 $search_phone = '';
276 $search_phone_perso = '';
277 $search_phone_mobile = '';
278 $search_morphy = "";
279 $search_categ = "";
280 $search_filter = "";
281 $search_status = "";
282 $search_import_key = '';
283 $search_all = "";
284 $toselect = array();
285 $search_datec_start = '';
286 $search_datec_end = '';
287 $search_datem_start = '';
288 $search_datem_end = '';
289 $search_array_options = array();
290 }
291
292 // Close
293 if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) {
294 $tmpmember = new Adherent($db);
295 $nbclose = 0;
296
297 $db->begin();
298
299 foreach ($toselect as $idtoclose) {
300 $tmpmember->fetch($idtoclose);
301 $result = $tmpmember->resiliate($user);
302
303 if ($result < 0 && !count($tmpmember->errors)) {
304 setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
305 } else {
306 if ($result > 0) {
307 $nbclose++;
308 }
309 }
310 }
311
312 if (!$error) {
313 setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
314
315 $db->commit();
316 } else {
317 $db->rollback();
318 }
319 }
320
321 // Create external user
322 if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
323 $tmpmember = new Adherent($db);
324 $nbcreated = 0;
325
326 $db->begin();
327
328 foreach ($toselect as $idtoclose) {
329 $tmpmember->fetch($idtoclose);
330
331 if (!empty($tmpmember->socid)) {
332 $nuser = new User($db);
333 $tmpuser = dol_clone($tmpmember, 2);
334
335 $result = $nuser->create_from_member($tmpuser, $tmpmember->login);
336
337 if ($result < 0 && !count($tmpmember->errors)) {
338 setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
339 } else {
340 if ($result > 0) {
341 $nbcreated++;
342 }
343 }
344 }
345 }
346
347 if (!$error) {
348 setEventMessages($langs->trans("XExternalUserCreated", $nbcreated), null, 'mesgs');
349
350 $db->commit();
351 } else {
352 $db->rollback();
353 }
354 }
355
356 // Create external user
357 if ($action == 'createsubscription_confirm' && $confirm == "yes" && $user->hasRight('adherent', 'creer')) {
358 $tmpmember = new Adherent($db);
359 $adht = new AdherentType($db);
360 $nbcreated = 0;
361 $now = dol_now();
362 $amount = price2num(GETPOST('amount', 'alpha'));
363 $db->begin();
364 foreach ($toselect as $id) {
365 $res = $tmpmember->fetch($id);
366 if ($res > 0) {
367 $result = $tmpmember->subscription($now, $amount);
368 if ($result < 0) {
369 $error++;
370 } else {
371 $nbcreated++;
372 }
373 } else {
374 $error++;
375 }
376 }
377
378 if (!$error) {
379 setEventMessages($langs->trans("XSubsriptionCreated", $nbcreated), null, 'mesgs');
380 $db->commit();
381 } else {
382 setEventMessages($langs->trans("XSubsriptionError", $error), null, 'mesgs');
383 $db->rollback();
384 }
385 }
386
387 // Mass actions
388 $objectclass = 'Adherent';
389 $objectlabel = 'Members';
390 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
391}
392
393
394/*
395 * View
396 */
397
398$form = new Form($db);
399$formother = new FormOther($db);
400$membertypestatic = new AdherentType($db);
401$memberstatic = new Adherent($db);
402
403$now = dol_now();
404
405// Page Header
406$title = $langs->trans("Members")." - ".$langs->trans("List");
407$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
408$morejs = array();
409$morecss = array();
410
411
412// Build and execute select
413// --------------------------------------------------------------------
414$sql = "SELECT";
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";
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("d.lastname", $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(array("s.nom", "d.societe"), $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 && getDolGlobalInt('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 ($groupby != '') {
659 $param .= '&groupby='.urlencode($groupby);
660}
661if ($search_all != "") {
662 $param .= "&search_all=".urlencode($search_all);
663}
664if ($search_ref) {
665 $param .= "&search_ref=".urlencode($search_ref);
666}
667if ($search_civility) {
668 $param .= "&search_civility=".urlencode($search_civility);
669}
670if ($search_firstname) {
671 $param .= "&search_firstname=".urlencode($search_firstname);
672}
673if ($search_lastname) {
674 $param .= "&search_lastname=".urlencode($search_lastname);
675}
676if ($search_gender) {
677 $param .= "&search_gender=".urlencode($search_gender);
678}
679if ($search_login) {
680 $param .= "&search_login=".urlencode($search_login);
681}
682if ($search_email) {
683 $param .= "&search_email=".urlencode($search_email);
684}
685if ($search_categ > 0 || $search_categ == -2) {
686 $param .= "&search_categ=".urlencode((string) ($search_categ));
687}
688if ($search_company) {
689 $param .= "&search_company=".urlencode($search_company);
690}
691if ($search_address != '') {
692 $param .= "&search_address=".urlencode($search_address);
693}
694if ($search_town != '') {
695 $param .= "&search_town=".urlencode($search_town);
696}
697if ($search_zip != '') {
698 $param .= "&search_zip=".urlencode($search_zip);
699}
700if ($search_state != '') {
701 $param .= "&search_state=".urlencode($search_state);
702}
703if ($search_country != '') {
704 $param .= "&search_country=".urlencode($search_country);
705}
706if ($search_phone != '') {
707 $param .= "&search_phone=".urlencode($search_phone);
708}
709if ($search_phone_perso != '') {
710 $param .= "&search_phone_perso=".urlencode($search_phone_perso);
711}
712if ($search_phone_mobile != '') {
713 $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
714}
715if ($search_filter && $search_filter != '-1') {
716 $param .= "&search_filter=".urlencode($search_filter);
717}
718if ($search_status != "" && $search_status != -3) {
719 $param .= "&search_status=".urlencode($search_status);
720}
721if ($search_import_key != '') {
722 $param .= '&search_import_key='.urlencode($search_import_key);
723}
724if ($search_type > 0) {
725 $param .= "&search_type=".urlencode($search_type);
726}
727if ($search_datec_start) {
728 $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');
729}
730if ($search_datem_end) {
731 $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');
732}
733
734// Add $param from extra fields
735include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
736
737// List of mass actions available
738$arrayofmassactions = array(
739 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
740 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
741);
742if ($user->hasRight('adherent', 'creer')) {
743 $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
744}
745if ($user->hasRight('adherent', 'supprimer')) {
746 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
747}
748if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) {
749 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
750}
751if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
752 $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
753}
754if ($user->hasRight('adherent', 'creer')) {
755 $arrayofmassactions['createsubscription'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("CreateSubscription");
756}
757if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
758 $arrayofmassactions = array();
759}
760$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
761
762print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
763if ($optioncss != '') {
764 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
765}
766print '<input type="hidden" name="token" value="'.newToken().'">';
767print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
768print '<input type="hidden" name="action" value="list">';
769print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
770print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
771print '<input type="hidden" name="page" value="'.$page.'">';
772print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
773print '<input type="hidden" name="page_y" value="">';
774print '<input type="hidden" name="mode" value="'.$mode.'">';
775
776
777$newcardbutton = '';
778$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'));
779$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'));
780$newcardbutton .= dolGetButtonTitleSeparator();
781$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create', '', $user->hasRight('adherent', 'creer'));
782
783print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
784
785// Add code for pre mass action (confirmation or email presend form)
786$topicmail = "Information";
787$modelmail = "member";
788$objecttmp = new Adherent($db);
789$trackid = 'mem'.$object->id;
790if ($massaction == 'createsubscription') {
791 $tmpmember = new Adherent($db);
792 $adht = new AdherentType($db);
793 $amount = 0;
794 foreach ($toselect as $id) {
795 $now = dol_now();
796 $tmpmember->fetch($id);
797 $res = $adht->fetch($tmpmember->typeid);
798 if ($res > 0) {
799 $amounttmp = $adht->amount;
800 if (!empty($tmpmember->last_subscription_amount) && !GETPOSTISSET('newamount') && is_numeric($amounttmp)) {
801 $amounttmp = max($tmpmember->last_subscription_amount, $amount);
802 }
803 $amount = max(0, $amounttmp, $amount);
804 } else {
805 $error++;
806 }
807 }
808
809 $date = dol_print_date(dol_now(), "%d/%m/%Y");
810 $formquestion = array(
811 array('label' => $langs->trans("DateSubscription"), 'type' => 'other', 'value' => $date),
812 array('label' => $langs->trans("Amount"), 'type' => 'text', 'value' => price($amount, 0, '', 0), 'name' => 'amount'),
813 array('type' => 'separator'),
814 array('label' => $langs->trans("MoreActions"), 'type' => 'other', 'value' => $langs->trans("None").' '.img_warning($langs->trans("WarningNoComplementaryActionDone"))),
815 );
816 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSubsriptionCreation"), $langs->trans("ConfirmMassSubsriptionCreationQuestion", count($toselect)), "createsubscription_confirm", $formquestion, '', 0, 200, 500, 1);
817}
818include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
819
820if ($search_all) {
821 $setupstring = '';
822 foreach ($fieldstosearchall as $key => $val) {
823 $fieldstosearchall[$key] = $langs->trans($val);
824 $setupstring .= $key."=".$val.";";
825 }
826 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
827 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
828}
829
830$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
831$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
832$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
833$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
834
835$moreforfilter = '';
836// Filter on categories
837if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
838 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
839 $moreforfilter .= '<div class="divsearchfield">';
840 $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
841 $moreforfilter .= '</div>';
842}
843$parameters = array(
844 'arrayfields' => &$arrayfields,
845);
846$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
847if (empty($reshook)) {
848 $moreforfilter .= $hookmanager->resPrint;
849} else {
850 $moreforfilter = $hookmanager->resPrint;
851}
852if (!empty($moreforfilter)) {
853 print '<div class="liste_titre liste_titre_bydiv centpercent">';
854 print $moreforfilter;
855 print '</div>';
856}
857
858print '<div class="div-table-responsive">';
859print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
860
861// Fields title search
862// --------------------------------------------------------------------
863print '<tr class="liste_titre_filter">';
864
865// Action column
866if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
867 print '<td class="liste_titre center maxwidthsearch">';
868 $searchpicto = $form->showFilterButtons('left');
869 print $searchpicto;
870 print '</td>';
871}
872
873// Line numbering
874if (!empty($arrayfields['d.rowid']['checked'])) {
875 print '<td class="liste_titre">';
876 print '<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).'">';
877 print '</td>';
878}
879
880// Ref
881if (!empty($arrayfields['d.ref']['checked'])) {
882 print '<td class="liste_titre">';
883 print '<input type="text" class="flat maxwidth75imp" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
884 print '</td>';
885}
886
887// Civility
888if (!empty($arrayfields['d.civility']['checked'])) {
889 print '<td class="liste_titre left">';
890 print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
891}
892
893// First Name
894if (!empty($arrayfields['d.firstname']['checked'])) {
895 print '<td class="liste_titre left">';
896 print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
897}
898
899// Last Name
900if (!empty($arrayfields['d.lastname']['checked'])) {
901 print '<td class="liste_titre left">';
902 print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
903}
904
905// Gender
906if (!empty($arrayfields['d.gender']['checked'])) {
907 print '<td class="liste_titre">';
908 $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother"));
909 print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
910 print '</td>';
911}
912
913// Company
914if (!empty($arrayfields['d.company']['checked'])) {
915 print '<td class="liste_titre left">';
916 print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
917}
918
919// Login
920if (!empty($arrayfields['d.login']['checked'])) {
921 print '<td class="liste_titre left">';
922 print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
923}
924
925// Nature
926if (!empty($arrayfields['d.morphy']['checked'])) {
927 print '<td class="liste_titre center">';
928 $arraymorphy = array('mor' => $langs->trans("Moral"), 'phy' => $langs->trans("Physical"));
929 print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
930 print '</td>';
931}
932
933// Member Type
934if (!empty($arrayfields['t.libelle']['checked'])) {
935 print '</td>';
936}
937if (!empty($arrayfields['t.libelle']['checked'])) {
938 print '<td class="liste_titre">';
939 $listetype = $membertypestatic->liste_array();
940 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
941 print $form->selectarray("search_type", $listetype, $search_type, 1, 0, 0, '', 0, 32);
942 print '</td>';
943}
944
945// Address - Street
946if (!empty($arrayfields['d.address']['checked'])) {
947 print '<td class="liste_titre left">';
948 print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>';
949}
950
951// ZIP
952if (!empty($arrayfields['d.zip']['checked'])) {
953 print '<td class="liste_titre left">';
954 print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
955}
956
957// Town/City
958if (!empty($arrayfields['d.town']['checked'])) {
959 print '<td class="liste_titre left">';
960 print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
961}
962
963// State / County / Departement
964if (!empty($arrayfields['state.nom']['checked'])) {
965 print '<td class="liste_titre">';
966 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
967 print '</td>';
968}
969
970// Country
971if (!empty($arrayfields['country.code_iso']['checked'])) {
972 print '<td class="liste_titre center">';
973 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
974 print '</td>';
975}
976
977// Phone pro
978if (!empty($arrayfields['d.phone']['checked'])) {
979 print '<td class="liste_titre left">';
980 print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>';
981}
982
983// Phone perso
984if (!empty($arrayfields['d.phone_perso']['checked'])) {
985 print '<td class="liste_titre left">';
986 print '<input class="flat maxwidth75imp" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
987}
988
989// Phone mobile
990if (!empty($arrayfields['d.phone_mobile']['checked'])) {
991 print '<td class="liste_titre left">';
992 print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>';
993}
994
995// Email
996if (!empty($arrayfields['d.email']['checked'])) {
997 print '<td class="liste_titre left">';
998 print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
999}
1000
1001// End of subscription date
1002if (!empty($arrayfields['d.datefin']['checked'])) {
1003 print '<td class="liste_titre center">';
1004 //$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
1005 $selectarray = array('-1' => '', 'waitingsubscription' => $langs->trans("WaitingSubscription"), 'uptodate' => $langs->trans("UpToDate"), 'outofdate' => $langs->trans("OutOfDate"));
1006 print $form->selectarray('search_filter', $selectarray, $search_filter);
1007 print '</td>';
1008}
1009
1010// Extra fields
1011include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1012
1013// Fields from hook
1014$parameters = array('arrayfields' => $arrayfields);
1015$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1016print $hookmanager->resPrint;
1017
1018// Date creation
1019if (!empty($arrayfields['d.datec']['checked'])) {
1020 print '<td class="liste_titre">';
1021 print '<div class="nowrapfordate">';
1022 print $form->selectDate($search_datec_start ? $search_datec_start : -1, 'search_datec_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1023 print '</div>';
1024 print '<div class="nowrapfordate">';
1025 print $form->selectDate($search_datec_end ? $search_datec_end : -1, 'search_datec_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1026 print '</div>';
1027 print '</td>';
1028}
1029
1030// Birthday
1031if (!empty($arrayfields['d.birth']['checked'])) {
1032 print '<td class="liste_titre">';
1033 print '</td>';
1034}
1035
1036// Date modification
1037if (!empty($arrayfields['d.tms']['checked'])) {
1038 print '<td class="liste_titre">';
1039 print '<div class="nowrapfordate">';
1040 print $form->selectDate($search_datem_start ? $search_datem_start : -1, 'search_datem_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1041 print '</div>';
1042 print '<div class="nowrapfordate">';
1043 print $form->selectDate($search_datem_end ? $search_datem_end : -1, 'search_datem_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1044 print '</div>';
1045 print '</td>';
1046}
1047
1048// Import Key
1049if (!empty($arrayfields['d.import_key']['checked'])) {
1050 print '<td class="liste_titre center">';
1051 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1052 print '</td>';
1053}
1054
1055// Status
1056if (!empty($arrayfields['d.statut']['checked'])) {
1057 print '<td class="liste_titre center parentonrightofpage">';
1058 $liststatus = array(
1059 Adherent::STATUS_DRAFT => $langs->trans("Draft"),
1060 Adherent::STATUS_VALIDATED => $langs->trans("Validated"),
1061 Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
1062 Adherent::STATUS_EXCLUDED => $langs->trans("MemberStatusExcludedShort")
1063 );
1064 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1065 print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
1066 print '</td>';
1067}
1068
1069// Action column
1070if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1071 print '<td class="liste_titre center maxwidthsearch">';
1072 $searchpicto = $form->showFilterButtons();
1073 print $searchpicto;
1074 print '</td>';
1075}
1076print '</tr>'."\n";
1077
1078$totalarray = array();
1079$totalarray['nbfield'] = 0;
1080
1081// Fields title label
1082// --------------------------------------------------------------------
1083print '<tr class="liste_titre">';
1084// Action column
1085if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1086 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
1087 $totalarray['nbfield']++;
1088}
1089if (!empty($arrayfields['d.rowid']['checked'])) {
1090 // @phan-suppress-next-line PhanTypeInvalidDimOffset
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 } else {
1242 $companyname = null;
1243 $companynametoshow = null;
1244 }
1245 } else {
1246 $companyname = $obj->company;
1247 $companynametoshow = $obj->company;
1248 }
1249 $memberstatic->company = (string) $companyname;
1250
1251 $object = $memberstatic;
1252
1253 if ($mode == 'kanban') {
1254 if ($i == 0) {
1255 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1256 print '<div class="box-flex-container kanban">';
1257 }
1258 $membertypestatic->id = $obj->type_id;
1259 $membertypestatic->label = $obj->type;
1260
1261 $memberstatic->type = $membertypestatic->label;
1262 $memberstatic->photo = $obj->photo;
1263
1264 // Output Kanban
1265 print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
1266 if ($i == (min($num, $limit) - 1)) {
1267 print '</div>';
1268 print '</td></tr>';
1269 }
1270 } else {
1271 // Show line of result
1272 $j = 0;
1273 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
1274
1275 // Action column
1276 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1277 print '<td class="nowrap center">';
1278 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1279 $selected = 0;
1280 if (in_array($obj->rowid, $arrayofselected)) {
1281 $selected = 1;
1282 }
1283 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1284 }
1285 print '</td>';
1286 if (!$i) {
1287 $totalarray['nbfield']++;
1288 }
1289 }
1290 // Technical ID
1291 if (!empty($arrayfields['d.rowid']['checked'])) {
1292 print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
1293 if (!$i) {
1294 $totalarray['nbfield']++;
1295 }
1296 }
1297 // Ref
1298 if (!empty($arrayfields['d.ref']['checked'])) {
1299 print "<td>";
1300 print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
1301 print "</td>\n";
1302 if (!$i) {
1303 $totalarray['nbfield']++;
1304 }
1305 }
1306 // Title/Civility
1307 if (!empty($arrayfields['d.civility']['checked'])) {
1308 print "<td>";
1309 print dol_escape_htmltag($obj->civility);
1310 print "</td>\n";
1311 if (!$i) {
1312 $totalarray['nbfield']++;
1313 }
1314 }
1315 // Firstname
1316 if (!empty($arrayfields['d.firstname']['checked'])) {
1317 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->firstname).'">';
1318 print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
1319 //print $obj->firstname;
1320 print "</td>\n";
1321 if (!$i) {
1322 $totalarray['nbfield']++;
1323 }
1324 }
1325 // Lastname
1326 if (!empty($arrayfields['d.lastname']['checked'])) {
1327 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->lastname).'">';
1328 print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
1329 //print $obj->lastname;
1330 print "</td>\n";
1331 if (!$i) {
1332 $totalarray['nbfield']++;
1333 }
1334 }
1335 // Gender
1336 if (!empty($arrayfields['d.gender']['checked'])) {
1337 print '<td>';
1338 if ($obj->gender) {
1339 print $langs->trans("Gender".$obj->gender);
1340 }
1341 print '</td>';
1342 if (!$i) {
1343 $totalarray['nbfield']++;
1344 }
1345 }
1346 // Company
1347 if (!empty($arrayfields['d.company']['checked'])) {
1348 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
1349 print $companynametoshow;
1350 print "</td>\n";
1351 }
1352 // Login
1353 if (!empty($arrayfields['d.login']['checked'])) {
1354 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
1355 if (!$i) {
1356 $totalarray['nbfield']++;
1357 }
1358 }
1359 // Nature (Moral/Physical)
1360 if (!empty($arrayfields['d.morphy']['checked'])) {
1361 print '<td class="center">';
1362 print $memberstatic->getmorphylib('', 2);
1363 print "</td>\n";
1364 if (!$i) {
1365 $totalarray['nbfield']++;
1366 }
1367 }
1368 // Type label
1369 if (!empty($arrayfields['t.libelle']['checked'])) {
1370 $membertypestatic->id = $obj->type_id;
1371 $membertypestatic->label = $obj->type;
1372 print '<td class="nowraponall">';
1373 print $membertypestatic->getNomUrl(1, 32);
1374 print '</td>';
1375 if (!$i) {
1376 $totalarray['nbfield']++;
1377 }
1378 }
1379 // Address
1380 if (!empty($arrayfields['d.address']['checked'])) {
1381 print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
1382 print dol_escape_htmltag($obj->address);
1383 print '</td>';
1384 if (!$i) {
1385 $totalarray['nbfield']++;
1386 }
1387 }
1388 // Zip
1389 if (!empty($arrayfields['d.zip']['checked'])) {
1390 print '<td class="nocellnopadd">';
1391 print dol_escape_htmltag($obj->zip);
1392 print '</td>';
1393 if (!$i) {
1394 $totalarray['nbfield']++;
1395 }
1396 }
1397 // Town
1398 if (!empty($arrayfields['d.town']['checked'])) {
1399 print '<td class="nocellnopadd">';
1400 print dol_escape_htmltag($obj->town);
1401 print '</td>';
1402 if (!$i) {
1403 $totalarray['nbfield']++;
1404 }
1405 }
1406 // State / County / Departement
1407 if (!empty($arrayfields['state.nom']['checked'])) {
1408 print "<td>";
1409 print dol_escape_htmltag($obj->state_name);
1410 print "</td>\n";
1411 if (!$i) {
1412 $totalarray['nbfield']++;
1413 }
1414 }
1415 // Country
1416 if (!empty($arrayfields['country.code_iso']['checked'])) {
1417 $tmparray = getCountry($obj->country, 'all');
1418 print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
1419 print dol_escape_htmltag($tmparray['label']);
1420 print '</td>';
1421 if (!$i) {
1422 $totalarray['nbfield']++;
1423 }
1424 }
1425 // Phone pro
1426 if (!empty($arrayfields['d.phone']['checked'])) {
1427 print '<td class="nocellnopadd">';
1428 print dol_print_phone($obj->phone);
1429 print '</td>';
1430 if (!$i) {
1431 $totalarray['nbfield']++;
1432 }
1433 }
1434 // Phone perso
1435 if (!empty($arrayfields['d.phone_perso']['checked'])) {
1436 print '<td class="nocellnopadd">';
1437 print dol_print_phone($obj->phone_perso);
1438 print '</td>';
1439 if (!$i) {
1440 $totalarray['nbfield']++;
1441 }
1442 }
1443 // Phone mobile
1444 if (!empty($arrayfields['d.phone_mobile']['checked'])) {
1445 print '<td class="nocellnopadd">';
1446 print dol_print_phone($obj->phone_mobile);
1447 print '</td>';
1448 if (!$i) {
1449 $totalarray['nbfield']++;
1450 }
1451 }
1452 // EMail
1453 if (!empty($arrayfields['d.email']['checked'])) {
1454 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
1455 print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
1456 print "</td>\n";
1457 if (!$i) {
1458 $totalarray['nbfield']++;
1459 }
1460 }
1461 // End of subscription date
1462 $datefin = $db->jdate($obj->datefin);
1463 if (!empty($arrayfields['d.datefin']['checked'])) {
1464 $s = '';
1465 if ($datefin) {
1466 $s .= dol_print_date($datefin, 'day');
1467 if ($memberstatic->hasDelay()) {
1468 $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").')';
1469 $s .= " ".img_warning($langs->trans("SubscriptionLate").$textlate);
1470 }
1471 } else {
1472 if (!empty($obj->subscription)) {
1473 $s .= '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
1474 if ($obj->status > 0) {
1475 $s .= " ".img_warning();
1476 }
1477 } else {
1478 $s .= '<span class="opacitymedium">'.$langs->trans("SubscriptionNotNeeded").'</span>';
1479 }
1480 }
1481 print '<td class="nowraponall center tdoverflowmax150" title="'.dolPrintHTMLForAttribute(dol_string_nohtmltag($s)).'">';
1482 print $s;
1483 print '</td>';
1484 if (!$i) {
1485 $totalarray['nbfield']++;
1486 }
1487 }
1488 // Extra fields
1489 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1490 // Fields from hook
1491 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1492 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1493 print $hookmanager->resPrint;
1494 // Date creation
1495 if (!empty($arrayfields['d.datec']['checked'])) {
1496 print '<td class="nowrap center">';
1497 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1498 print '</td>';
1499 if (!$i) {
1500 $totalarray['nbfield']++;
1501 }
1502 }
1503 // Birth
1504 if (!empty($arrayfields['d.birth']['checked'])) {
1505 print '<td class="nowrap center">';
1506 print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
1507 print '</td>';
1508 if (!$i) {
1509 $totalarray['nbfield']++;
1510 }
1511 }
1512 // Date modification
1513 if (!empty($arrayfields['d.tms']['checked'])) {
1514 print '<td class="nowrap center">';
1515 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1516 print '</td>';
1517 if (!$i) {
1518 $totalarray['nbfield']++;
1519 }
1520 }
1521 // Import key
1522 if (!empty($arrayfields['d.import_key']['checked'])) {
1523 print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
1524 print dol_escape_htmltag($obj->import_key);
1525 print "</td>\n";
1526 if (!$i) {
1527 $totalarray['nbfield']++;
1528 }
1529 }
1530 // Status
1531 if (!empty($arrayfields['d.statut']['checked'])) {
1532 print '<td class="nowrap center">';
1533 print $memberstatic->LibStatut($obj->status, $obj->subscription, $datefin, 5);
1534 print '</td>';
1535 if (!$i) {
1536 $totalarray['nbfield']++;
1537 }
1538 }
1539 // Action column
1540 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1541 print '<td class="center">';
1542 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1543 $selected = 0;
1544 if (in_array($obj->rowid, $arrayofselected)) {
1545 $selected = 1;
1546 }
1547 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1548 }
1549 print '</td>';
1550 if (!$i) {
1551 $totalarray['nbfield']++;
1552 }
1553 }
1554
1555 print '</tr>'."\n";
1556 }
1557 $i++;
1558}
1559
1560// Show total line
1561include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1562
1563
1564// If no record found
1565if ($num == 0) {
1566 $colspan = 1;
1567 foreach ($arrayfields as $key => $val) {
1568 if (!empty($val['checked'])) {
1569 $colspan++;
1570 }
1571 }
1572 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1573}
1574
1575$db->free($resql);
1576
1577$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1578$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1579print $hookmanager->resPrint;
1580
1581print '</table>'."\n";
1582print '</div>'."\n";
1583
1584print '</form>'."\n";
1585
1586if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1587 $hidegeneratedfilelistifempty = 1;
1588 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1589 $hidegeneratedfilelistifempty = 0;
1590 }
1591
1592 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1593 $formfile = new FormFile($db);
1594
1595 // Show list of available documents
1596 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1597 $urlsource .= str_replace('&amp;', '&', $param);
1598
1599 $filedir = $diroutputmassaction;
1600 $genallowed = $permissiontoread;
1601 $delallowed = $permissiontoadd;
1602
1603 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1604}
1605
1606// End of page
1607llxFooter();
1608$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage members of a foundation.
const STATUS_EXCLUDED
Excluded.
const STATUS_DRAFT
Draft status.
const STATUS_RESILIATED
Resiliated.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.