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