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