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