dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 // Load Dolibarr environment
27 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
32 
33 $langs->loadLangs(array("members", "companies"));
34 
35 $action = GETPOST('action', 'aZ09');
36 $massaction = GETPOST('massaction', 'alpha');
37 $confirm = GETPOST('confirm', 'alpha');
38 $toselect = GETPOST('toselect', 'array');
39 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search
40 
41 $statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
42 $search_ref = GETPOST('search_ref', 'alpha');
43 $search_type = GETPOST('search_type', 'alpha');
44 $search_lastname = GETPOST('search_lastname', 'alpha');
45 $search_firstname = GETPOST('search_firstname', 'alpha');
46 $search_login = GETPOST('search_login', 'alpha');
47 $search_note = GETPOST('search_note', 'alpha');
48 $search_account = GETPOST('search_account', 'int');
49 $search_amount = GETPOST('search_amount', 'alpha');
50 $optioncss = GETPOST('optioncss', 'alpha');
51 $sall = '';
52 
53 $date_select = GETPOST("date_select", 'alpha');
54 
55 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
56 $sortfield = GETPOST('sortfield', 'aZ09comma');
57 $sortorder = GETPOST('sortorder', 'aZ09comma');
58 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
59 if (empty($page) || $page == -1) {
60  $page = 0;
61 } // If $page is not defined, or '' or -1
62 $offset = $limit * $page;
63 $pageprev = $page - 1;
64 $pagenext = $page + 1;
65 if (!$sortorder) {
66  $sortorder = "DESC";
67 }
68 if (!$sortfield) {
69  $sortfield = "c.dateadh";
70 }
71 
72 $object = new Subscription($db);
73 
74 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
75 $hookmanager->initHooks(array('subscriptionlist'));
76 $extrafields = new ExtraFields($db);
77 
78 // fetch optionals attributes and labels
79 $extrafields->fetch_name_optionals_label($object->table_element);
80 
81 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
82 
83 // List of fields to search into when doing a "search in all"
84 $fieldstosearchall = array(
85 );
86 $arrayfields = array(
87  'd.ref'=>array('label'=>"Ref", 'checked'=>1),
88  'd.fk_type'=>array('label'=>"Type", 'checked'=>1),
89  'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
90  'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
91  'd.login'=>array('label'=>"Login", 'checked'=>1),
92  't.libelle'=>array('label'=>"Label", 'checked'=>1),
93  'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('banque'))),
94  /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
95  'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
96  'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
97  'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101),
98  'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102),
99  'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
100  'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
101 // 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
102 );
103 
104 // Security check
105 $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
106 
107 
108 /*
109  * Actions
110  */
111 
112 if (GETPOST('cancel', 'alpha')) {
113  $action = 'list'; $massaction = '';
114 }
115 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
116  $massaction = '';
117 }
118 
119 $parameters = array('socid'=>isset($socid) ? $socid : null);
120 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
121 if ($reshook < 0) {
122  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
123 }
124 
125 if (empty($reshook)) {
126  // Selection of new fields
127  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
128 
129  // Purge search criteria
130  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
131  $search_type = "";
132  $search_ref = "";
133  $search_lastname = "";
134  $search_firstname = "";
135  $search_login = "";
136  $search_note = "";
137  $search_amount = "";
138  $search_account = "";
139  $toselect = array();
140  $search_array_options = array();
141  }
142 }
143 
144 
145 /*
146  * View
147  */
148 
149 $form = new Form($db);
150 $subscription = new Subscription($db);
151 $adherent = new Adherent($db);
152 $accountstatic = new Account($db);
153 
154 $now = dol_now();
155 
156 // List of subscriptions
157 $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.statut,";
158 $sql .= " d.gender, d.email, d.morphy,";
159 $sql .= " c.rowid as crowid, c.fk_type, c.subscription,";
160 $sql .= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
161 $sql .= " c.fk_bank as bank, c.note as note_private,";
162 $sql .= " b.fk_account";
163 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
164 $sql .= " JOIN ".MAIN_DB_PREFIX."subscription as c on d.rowid = c.fk_adherent";
165 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
166 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
167 $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
168 if (isset($date_select) && $date_select != '') {
169  $sql .= " AND c.dateadh >= '".((int) $date_select)."-01-01 00:00:00'";
170  $sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'";
171 }
172 if ($search_ref) {
173  if (is_numeric($search_ref)) {
174  $sql .= " AND c.rowid = ".((int) $search_ref);
175  } else {
176  $sql .= " AND 1 = 2"; // Always wrong
177  }
178 }
179 if ($search_type) {
180  $sql .= natural_search(array('c.fk_type'), $search_type);
181 }
182 if ($search_lastname) {
183  $sql .= natural_search(array('d.lastname', 'd.societe'), $search_lastname);
184 }
185 if ($search_firstname) {
186  $sql .= natural_search(array('d.firstname'), $search_firstname);
187 }
188 if ($search_login) {
189  $sql .= natural_search('d.login', $search_login);
190 }
191 if ($search_note) {
192  $sql .= natural_search('c.note', $search_note);
193 }
194 if ($search_account > 0) {
195  $sql .= " AND b.fk_account = ".((int) $search_account);
196 }
197 if ($search_amount) {
198  $sql .= natural_search('c.subscription', $search_amount, 1);
199 }
200 
201 // Add where from extra fields
202 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
203 
204 // Add where from hooks
205 $parameters = array();
206 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
207 $sql .= $hookmanager->resPrint;
208 
209 $sql .= $db->order($sortfield, $sortorder);
210 
211 // Count total nb of records with no order and no limits
212 $nbtotalofrecords = '';
213 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
214  $resql = $db->query($sql);
215  if ($resql) {
216  $nbtotalofrecords = $db->num_rows($resql);
217  } else {
218  dol_print_error($db);
219  }
220  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
221  $page = 0;
222  $offset = 0;
223  }
224 }
225 // Add limit
226 $sql .= $db->plimit($limit + 1, $offset);
227 
228 $result = $db->query($sql);
229 if (!$result) {
230  dol_print_error($db);
231  exit;
232 }
233 
234 $num = $db->num_rows($result);
235 
236 $arrayofselected = is_array($toselect) ? $toselect : array();
237 
238 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
239  $obj = $db->fetch_object($resql);
240  $id = $obj->rowid;
241  header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
242  exit;
243 }
244 
245 $title = $langs->trans("Subscriptions");
246 if (!empty($date_select)) {
247  $title .= ' ('.$langs->trans("Year").' '.$date_select.')';
248 }
249 
250 $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
251 llxHeader('', $title, $help_url);
252 
253 $i = 0;
254 
255 $param = '';
256 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
257  $param .= '&contextpage='.urlencode($contextpage);
258 }
259 if ($limit > 0 && $limit != $conf->liste_limit) {
260  $param .= '&limit='.urlencode($limit);
261 }
262 if ($statut != '') {
263  $param .= "&statut=".urlencode($statut);
264 }
265 if ($search_type) {
266  $param .= "&search_type=".urlencode($search_type);
267 }
268 if ($date_select) {
269  $param .= "&date_select=".urlencode($date_select);
270 }
271 if ($search_lastname) {
272  $param .= "&search_lastname=".urlencode($search_lastname);
273 }
274 if ($search_login) {
275  $param .= "&search_login=".urlencode($search_login);
276 }
277 if ($search_account) {
278  $param .= "&search_account=".urlencode($search_account);
279 }
280 if ($search_amount) {
281  $param .= "&search_amount=".urlencode($search_amount);
282 }
283 if ($optioncss != '') {
284  $param .= '&optioncss='.urlencode($optioncss);
285 }
286 // Add $param from extra fields
287 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
288 
289 // List of mass actions available
290 $arrayofmassactions = array(
291  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
292  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
293 );
294 //if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
295 if (in_array($massaction, array('presend', 'predelete'))) {
296  $arrayofmassactions = array();
297 }
298 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
299 
300 $newcardbutton = '';
301 if ($user->rights->adherent->cotisation->creer) {
302  $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
303 }
304 
305 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
306 if ($optioncss != '') {
307  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
308 }
309 print '<input type="hidden" name="token" value="'.newToken().'">';
310 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
311 print '<input type="hidden" name="action" value="list">';
312 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
313 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
314 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
315 print '<input type="hidden" name="date_select" value="'.$date_select.'">';
316 
317 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
318 
319 $topicmail = "Information";
320 $modelmail = "subscription";
321 $objecttmp = new Subscription($db);
322 $trackid = 'sub'.$object->id;
323 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
324 
325 if ($sall) {
326  foreach ($fieldstosearchall as $key => $val) {
327  $fieldstosearchall[$key] = $langs->trans($val);
328  }
329  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
330 }
331 
332 $moreforfilter = '';
333 
334 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
335 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
336 if ($massactionbutton) {
337  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
338 }
339 
340 print '<div class="div-table-responsive">';
341 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
342 
343 
344 // Line for filters fields
345 print '<tr class="liste_titre_filter">';
346 
347 // Line numbering
348 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
349  print '<td class="liste_titre">&nbsp;</td>';
350 }
351 
352 // Ref
353 if (!empty($arrayfields['d.ref']['checked'])) {
354  print '<td class="liste_titre left">';
355  print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
356 }
357 
358 // Type
359 if (!empty($arrayfields['d.fk_type']['checked'])) {
360  print '<td class="liste_titre left">';
361  print '<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
362  print'</td>';
363 }
364 
365 if (!empty($arrayfields['d.lastname']['checked'])) {
366  print '<td class="liste_titre left">';
367  print '<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
368 }
369 
370 if (!empty($arrayfields['d.firstname']['checked'])) {
371  print '<td class="liste_titre left">';
372  print '<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
373 }
374 
375 if (!empty($arrayfields['d.login']['checked'])) {
376  print '<td class="liste_titre left">';
377  print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
378 }
379 
380 if (!empty($arrayfields['t.libelle']['checked'])) {
381  print '<td class="liste_titre">';
382  print '';
383  print '</td>';
384 }
385 
386 if (!empty($arrayfields['d.bank']['checked'])) {
387  print '<td class="liste_titre">';
388  $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100');
389  print '</td>';
390 }
391 
392 if (!empty($arrayfields['c.dateadh']['checked'])) {
393  print '<td class="liste_titre">&nbsp;</td>';
394 }
395 
396 if (!empty($arrayfields['c.datef']['checked'])) {
397  print '<td class="liste_titre">&nbsp;</td>';
398 }
399 
400 if (!empty($arrayfields['d.amount']['checked'])) {
401  print '<td class="liste_titre right">';
402  print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
403  print '</td>';
404 }
405 // Extra fields
406 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
407 
408 // Fields from hook
409 $parameters = array('arrayfields'=>$arrayfields);
410 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
411 print $hookmanager->resPrint;
412 // Date creation
413 if (!empty($arrayfields['c.datec']['checked'])) {
414  print '<td class="liste_titre">';
415  print '</td>';
416 }
417 // Date modification
418 if (!empty($arrayfields['c.tms']['checked'])) {
419  print '<td class="liste_titre">';
420  print '</td>';
421 }
422 
423 // Action column
424 print '<td class="liste_titre right">';
425 $searchpicto = $form->showFilterButtons();
426 print $searchpicto;
427 print '</td>';
428 
429 print "</tr>\n";
430 
431 
432 print '<tr class="liste_titre">';
433 if (!empty($arrayfields['d.ref']['checked'])) {
434  print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
435 }
436 if (!empty($arrayfields['d.fk_type']['checked'])) {
437  print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
438 }
439 if (!empty($arrayfields['d.lastname']['checked'])) {
440  print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
441 }
442 if (!empty($arrayfields['d.firstname']['checked'])) {
443  print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
444 }
445 if (!empty($arrayfields['d.login']['checked'])) {
446  print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
447 }
448 if (!empty($arrayfields['t.libelle']['checked'])) {
449  print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
450 }
451 if (!empty($arrayfields['d.bank']['checked'])) {
452  print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
453 }
454 if (!empty($arrayfields['c.dateadh']['checked'])) {
455  print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
456 }
457 if (!empty($arrayfields['c.datef']['checked'])) {
458  print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
459 }
460 if (!empty($arrayfields['d.amount']['checked'])) {
461  print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
462 }
463 
464 // Extra fields
465 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
466 
467 // Hook fields
468 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
469 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
470 print $hookmanager->resPrint;
471 if (!empty($arrayfields['c.datec']['checked'])) {
472  print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
473 }
474 if (!empty($arrayfields['c.tms']['checked'])) {
475  print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
476 }
477 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
478 print "</tr>\n";
479 
480 
481 $totalarray = array();
482 $totalarray['nbfield'] = 0;
483 while ($i < min($num, $limit)) {
484  $obj = $db->fetch_object($result);
485 
486  $subscription->ref = $obj->crowid;
487  $subscription->id = $obj->crowid;
488  $subscription->dateh = $db->jdate($obj->dateadh);
489  $subscription->datef = $db->jdate($obj->datef);
490 
491  $adherent->lastname = $obj->lastname;
492  $adherent->firstname = $obj->firstname;
493  $adherent->ref = $obj->rowid;
494  $adherent->id = $obj->rowid;
495  $adherent->statut = $obj->statut;
496  $adherent->login = $obj->login;
497  $adherent->photo = $obj->photo;
498  $adherent->gender = $obj->gender;
499  $adherent->morphy = $obj->morphy;
500  $adherent->email = $obj->email;
501  $adherent->typeid = $obj->fk_type;
502  $adherent->datefin = $db->jdate($obj->datef);
503 
504  $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
505  $adht = new AdherentType($db);
506  $adht->fetch($typeid);
507 
508  $adherent->need_subscription = $adht->subscription;
509 
510  print '<tr class="oddeven">';
511 
512  // Ref
513  if (!empty($arrayfields['d.ref']['checked'])) {
514  print '<td>'.$subscription->getNomUrl(1).'</td>';
515  if (!$i) {
516  $totalarray['nbfield']++;
517  }
518  }
519  // Type
520  if (!empty($arrayfields['d.fk_type']['checked'])) {
521  print '<td class="nowraponall">';
522  if ($typeid > 0) {
523  print $adht->getNomUrl(1);
524  }
525  print '</td>';
526  if (!$i) {
527  $totalarray['nbfield']++;
528  }
529  }
530 
531  // Lastname
532  if (!empty($arrayfields['d.lastname']['checked'])) {
533  print '<td class="tdoverflowmax125">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
534  if (!$i) {
535  $totalarray['nbfield']++;
536  }
537  }
538  // Firstname
539  if (!empty($arrayfields['d.firstname']['checked'])) {
540  print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($adherent->firstname).'">'.dol_escape_htmltag($adherent->firstname).'</td>';
541  if (!$i) {
542  $totalarray['nbfield']++;
543  }
544  }
545 
546  // Login
547  if (!empty($arrayfields['d.login']['checked'])) {
548  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.dol_escape_htmltag($adherent->login).'</td>';
549  if (!$i) {
550  $totalarray['nbfield']++;
551  }
552  }
553 
554  // Label
555  if (!empty($arrayfields['t.libelle']['checked'])) {
556  print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note_private).'" class="tooltip">';
557  print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private));
558  print '</td>';
559  if (!$i) {
560  $totalarray['nbfield']++;
561  }
562  }
563 
564  // Banque
565  if (!empty($arrayfields['d.bank']['checked'])) {
566  print '<td class="tdmaxoverflow100">';
567  if ($obj->fk_account > 0) {
568  $accountstatic->id = $obj->fk_account;
569  $accountstatic->fetch($obj->fk_account);
570  //$accountstatic->label=$obj->label;
571  print $accountstatic->getNomUrl(1);
572  }
573  print "</td>\n";
574  if (!$i) {
575  $totalarray['nbfield']++;
576  }
577  }
578 
579  // Date start
580  if (!empty($arrayfields['c.dateadh']['checked'])) {
581  print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
582  if (!$i) {
583  $totalarray['nbfield']++;
584  }
585  }
586  // Date end
587  if (!empty($arrayfields['c.datef']['checked'])) {
588  print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
589  if (!$i) {
590  $totalarray['nbfield']++;
591  }
592  }
593  // Price
594  if (!empty($arrayfields['d.amount']['checked'])) {
595  print '<td class="right amount">'.price($obj->subscription).'</td>';
596  if (!$i) {
597  $totalarray['nbfield']++;
598  }
599  if (!$i) {
600  $totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
601  }
602  if (empty($totalarray['val']['d.amount'])) {
603  $totalarray['val']['d.amount'] = $obj->subscription;
604  } else {
605  $totalarray['val']['d.amount'] += $obj->subscription;
606  }
607  }
608  // Extra fields
609  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
610  // Fields from hook
611  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
612  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
613  print $hookmanager->resPrint;
614  // Date creation
615  if (!empty($arrayfields['c.datec']['checked'])) {
616  print '<td class="nowrap center">';
617  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
618  print '</td>';
619  if (!$i) {
620  $totalarray['nbfield']++;
621  }
622  }
623  // Date modification
624  if (!empty($arrayfields['c.tms']['checked'])) {
625  print '<td class="nowrap center">';
626  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
627  print '</td>';
628  if (!$i) {
629  $totalarray['nbfield']++;
630  }
631  }
632  // Action column
633  print '<td class="center">';
634  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
635  $selected = 0;
636  if (in_array($obj->crowid, $arrayofselected)) {
637  $selected = 1;
638  }
639  print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.((int) $obj->crowid).'"'.($selected ? ' checked="checked"' : '').'>';
640  }
641  print '</td>';
642  if (!$i) {
643  $totalarray['nbfield']++;
644  }
645 
646  print "</tr>\n";
647  $i++;
648 }
649 
650 // Show total line
651 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
652 
653 
654 // If no record found
655 if ($num == 0) {
656  $colspan = 1;
657  foreach ($arrayfields as $key => $val) {
658  if (!empty($val['checked'])) {
659  $colspan++;
660  }
661  }
662  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
663 }
664 
665 $db->free($resql);
666 
667 $parameters = array('sql' => $sql);
668 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
669 print $hookmanager->resPrint;
670 
671 print "</table>";
672 print '</div>';
673 print '</form>';
674 
675 
676 // End of page
677 llxFooter();
678 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage bank accounts.
Class to manage members of a foundation.
Class to manage members type.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage subscriptions of foundation members.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
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.