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