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