dolibarr  18.0.0-alpha
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|DE:Modul_Mitglieder';
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, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // 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 // Action column
357 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
358  print '<td class="liste_titre right">';
359  $searchpicto = $form->showFilterButtons('left');
360  print $searchpicto;
361  print '</td>';
362 }
363 // Line numbering
364 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
365  print '<td class="liste_titre">&nbsp;</td>';
366 }
367 
368 // Ref
369 if (!empty($arrayfields['d.ref']['checked'])) {
370  print '<td class="liste_titre left">';
371  print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
372 }
373 
374 // Type
375 if (!empty($arrayfields['d.fk_type']['checked'])) {
376  print '<td class="liste_titre left">';
377  print '<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
378  print'</td>';
379 }
380 
381 if (!empty($arrayfields['d.lastname']['checked'])) {
382  print '<td class="liste_titre left">';
383  print '<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
384 }
385 
386 if (!empty($arrayfields['d.firstname']['checked'])) {
387  print '<td class="liste_titre left">';
388  print '<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
389 }
390 
391 if (!empty($arrayfields['d.login']['checked'])) {
392  print '<td class="liste_titre left">';
393  print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
394 }
395 
396 if (!empty($arrayfields['t.libelle']['checked'])) {
397  print '<td class="liste_titre">';
398  print '';
399  print '</td>';
400 }
401 
402 if (!empty($arrayfields['d.bank']['checked'])) {
403  print '<td class="liste_titre">';
404  $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
405  print '</td>';
406 }
407 
408 if (!empty($arrayfields['c.dateadh']['checked'])) {
409  print '<td class="liste_titre">&nbsp;</td>';
410 }
411 
412 if (!empty($arrayfields['c.datef']['checked'])) {
413  print '<td class="liste_titre">&nbsp;</td>';
414 }
415 
416 if (!empty($arrayfields['d.amount']['checked'])) {
417  print '<td class="liste_titre right">';
418  print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
419  print '</td>';
420 }
421 // Extra fields
422 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
423 
424 // Fields from hook
425 $parameters = array('arrayfields'=>$arrayfields);
426 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
427 print $hookmanager->resPrint;
428 // Date creation
429 if (!empty($arrayfields['c.datec']['checked'])) {
430  print '<td class="liste_titre">';
431  print '</td>';
432 }
433 // Date modification
434 if (!empty($arrayfields['c.tms']['checked'])) {
435  print '<td class="liste_titre">';
436  print '</td>';
437 }
438 
439 // Action column
440 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
441  print '<td class="liste_titre right">';
442  $searchpicto = $form->showFilterButtons();
443  print $searchpicto;
444  print '</td>';
445 }
446 print "</tr>\n";
447 
448 
449 print '<tr class="liste_titre">';
450 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
451  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
452 }
453 if (!empty($arrayfields['d.ref']['checked'])) {
454  print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
455 }
456 if (!empty($arrayfields['d.fk_type']['checked'])) {
457  print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
458 }
459 if (!empty($arrayfields['d.lastname']['checked'])) {
460  print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
461 }
462 if (!empty($arrayfields['d.firstname']['checked'])) {
463  print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
464 }
465 if (!empty($arrayfields['d.login']['checked'])) {
466  print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
467 }
468 if (!empty($arrayfields['t.libelle']['checked'])) {
469  print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
470 }
471 if (!empty($arrayfields['d.bank']['checked'])) {
472  print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
473 }
474 if (!empty($arrayfields['c.dateadh']['checked'])) {
475  print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
476 }
477 if (!empty($arrayfields['c.datef']['checked'])) {
478  print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
479 }
480 if (!empty($arrayfields['d.amount']['checked'])) {
481  print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
482 }
483 
484 // Extra fields
485 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
486 
487 // Hook fields
488 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
489 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
490 print $hookmanager->resPrint;
491 if (!empty($arrayfields['c.datec']['checked'])) {
492  print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
493 }
494 if (!empty($arrayfields['c.tms']['checked'])) {
495  print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
496 }
497 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
498  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
499 }
500 print "</tr>\n";
501 
502 
503 $totalarray = array();
504 $totalarray['nbfield'] = 0;
505 while ($i < min($num, $limit)) {
506  $obj = $db->fetch_object($result);
507 
508  $subscription->ref = $obj->crowid;
509  $subscription->id = $obj->crowid;
510  $subscription->dateh = $db->jdate($obj->dateadh);
511  $subscription->datef = $db->jdate($obj->datef);
512 
513  $adherent->lastname = $obj->lastname;
514  $adherent->firstname = $obj->firstname;
515  $adherent->ref = $obj->rowid;
516  $adherent->id = $obj->rowid;
517  $adherent->statut = $obj->statut;
518  $adherent->login = $obj->login;
519  $adherent->photo = $obj->photo;
520  $adherent->gender = $obj->gender;
521  $adherent->morphy = $obj->morphy;
522  $adherent->email = $obj->email;
523  $adherent->typeid = $obj->fk_type;
524  $adherent->datefin = $db->jdate($obj->datef);
525 
526  $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
527  $adht = new AdherentType($db);
528  $adht->fetch($typeid);
529 
530  $adherent->need_subscription = $adht->subscription;
531 
532  if ($mode == 'kanban') {
533  if ($i == 0) {
534  print '<tr><td colspan="12">';
535  print '<div class="box-flex-container kanban">';
536  }
537 
538  //fetch informations needs on this mode
539  $subscription->fk_adherent = $adherent->getNomUrl(1);
540  $subscription->fk_type = $adht->getNomUrl(1);
541  $subscription->amount = $obj->subscription;
542  if ($obj->fk_account > 0) {
543  $accountstatic->id = $obj->fk_account;
544  $accountstatic->fetch($obj->fk_account);
545  $subscription->fk_bank = $accountstatic->getNomUrl(1);
546  }
547  // Output Kanban
548  print $subscription->getKanbanView('');
549  if ($i == (min($num, $limit) - 1)) {
550  print '</div>';
551  print '</td></tr>';
552  }
553  } else {
554  print '<tr class="oddeven">';
555  // Action column
556  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
557  print '<td class="center">';
558  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
559  $selected = 0;
560  if (in_array($obj->crowid, $arrayofselected)) {
561  $selected = 1;
562  }
563  print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
564  }
565  print '</td>';
566  if (!$i) {
567  $totalarray['nbfield']++;
568  }
569  }
570  // Ref
571  if (!empty($arrayfields['d.ref']['checked'])) {
572  print '<td>'.$subscription->getNomUrl(1).'</td>';
573  if (!$i) {
574  $totalarray['nbfield']++;
575  }
576  }
577  // Type
578  if (!empty($arrayfields['d.fk_type']['checked'])) {
579  print '<td class="nowraponall">';
580  if ($typeid > 0) {
581  print $adht->getNomUrl(1);
582  }
583  print '</td>';
584  if (!$i) {
585  $totalarray['nbfield']++;
586  }
587  }
588 
589  // Lastname
590  if (!empty($arrayfields['d.lastname']['checked'])) {
591  print '<td class="tdoverflowmax150">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
592  if (!$i) {
593  $totalarray['nbfield']++;
594  }
595  }
596  // Firstname
597  if (!empty($arrayfields['d.firstname']['checked'])) {
598  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
599  if (!$i) {
600  $totalarray['nbfield']++;
601  }
602  }
603 
604  // Login
605  if (!empty($arrayfields['d.login']['checked'])) {
606  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
607  if (!$i) {
608  $totalarray['nbfield']++;
609  }
610  }
611 
612  // Label
613  if (!empty($arrayfields['t.libelle']['checked'])) {
614  print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
615  print $obj->note;
616  print '</td>';
617  if (!$i) {
618  $totalarray['nbfield']++;
619  }
620  }
621 
622  // Banque
623  if (!empty($arrayfields['d.bank']['checked'])) {
624  print '<td class="tdmaxoverflow150">';
625  if ($obj->fk_account > 0) {
626  $accountstatic->id = $obj->fk_account;
627  $accountstatic->fetch($obj->fk_account);
628  //$accountstatic->label=$obj->label;
629  print $accountstatic->getNomUrl(1);
630  }
631  print "</td>\n";
632  if (!$i) {
633  $totalarray['nbfield']++;
634  }
635  }
636 
637  // Date start
638  if (!empty($arrayfields['c.dateadh']['checked'])) {
639  print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
640  if (!$i) {
641  $totalarray['nbfield']++;
642  }
643  }
644  // Date end
645  if (!empty($arrayfields['c.datef']['checked'])) {
646  print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
647  if (!$i) {
648  $totalarray['nbfield']++;
649  }
650  }
651  // Price
652  if (!empty($arrayfields['d.amount']['checked'])) {
653  print '<td class="right amount">'.price($obj->subscription).'</td>';
654  if (!$i) {
655  $totalarray['nbfield']++;
656  }
657  if (!$i) {
658  $totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
659  }
660  if (empty($totalarray['val']['d.amount'])) {
661  $totalarray['val']['d.amount'] = $obj->subscription;
662  } else {
663  $totalarray['val']['d.amount'] += $obj->subscription;
664  }
665  }
666  // Extra fields
667  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
668  // Fields from hook
669  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
670  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
671  print $hookmanager->resPrint;
672  // Date creation
673  if (!empty($arrayfields['c.datec']['checked'])) {
674  print '<td class="nowrap center">';
675  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
676  print '</td>';
677  if (!$i) {
678  $totalarray['nbfield']++;
679  }
680  }
681  // Date modification
682  if (!empty($arrayfields['c.tms']['checked'])) {
683  print '<td class="nowrap center">';
684  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
685  print '</td>';
686  if (!$i) {
687  $totalarray['nbfield']++;
688  }
689  }
690  // Action column
691  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
692  print '<td class="center">';
693  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
694  $selected = 0;
695  if (in_array($obj->crowid, $arrayofselected)) {
696  $selected = 1;
697  }
698  print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
699  }
700  print '</td>';
701  if (!$i) {
702  $totalarray['nbfield']++;
703  }
704  }
705  print "</tr>\n";
706  }
707  $i++;
708 }
709 
710 // Show total line
711 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
712 
713 
714 // If no record found
715 if ($num == 0) {
716  $colspan = 1;
717  foreach ($arrayfields as $key => $val) {
718  if (!empty($val['checked'])) {
719  $colspan++;
720  }
721  }
722  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
723 }
724 
725 $db->free($resql);
726 
727 $parameters = array('sql' => $sql);
728 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
729 print $hookmanager->resPrint;
730 
731 print "</table>";
732 print '</div>';
733 print '</form>';
734 
735 
736 // End of page
737 llxFooter();
738 $db->close();
AdherentType
Class to manage members type.
Definition: adherent_type.class.php:35
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
$sql
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)) $sql
Social contributions to pay.
Definition: index.php:745
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:530
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:4994
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
$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:118
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:2566
llxHeader
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
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:11044
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:5416
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:46
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:82
restrictedArea
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.
Definition: security.lib.php:341
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
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:431
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:5181
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:9823
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:2947
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
$nbtotalofrecords
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
Account
Class to manage bank accounts.
Definition: account.class.php:39