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