dolibarr  13.0.2
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  * Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
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.'/salaries/class/paymentsalary.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
29 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
33 
34 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
35 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
36 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
37 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
38 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
39 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
40 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
41 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
42 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
43 
44 // Load variable for pagination
45 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
46 $sortfield = GETPOST('sortfield', 'aZ09comma');
47 $sortorder = GETPOST('sortorder', 'aZ09comma');
48 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
49 if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
50 $offset = $limit * $page;
51 $pageprev = $page - 1;
52 $pagenext = $page + 1;
53 if (!$sortfield) $sortfield = "s.datep,s.rowid";
54 if (!$sortorder) $sortorder = "DESC,DESC";
55 
56 // Initialize technical objects
57 $object = new PaymentSalary($db);
58 $extrafields = new ExtraFields($db);
59 $diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
60 $hookmanager->initHooks(array('salarieslist')); // Note that conf->hooks_modules contains array
61 
62 // Fetch optionals attributes and labels
63 $extrafields->fetch_name_optionals_label($object->table_element);
64 
65 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
66 
67 if (!$sortfield) $sortfield = "s.datep,s.rowid";
68 if (!$sortorder) $sortorder = "DESC,DESC";
69 
70 $search_ref = GETPOST('search_ref', 'int');
71 $search_user = GETPOST('search_user', 'alpha');
72 $search_label = GETPOST('search_label', 'alpha');
73 $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
74 $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
75 $search_amount = GETPOST('search_amount', 'alpha');
76 $search_account = GETPOST('search_account', 'int');
77 
78 $filtre = GETPOST("filtre", 'restricthtml');
79 
80 if (!GETPOST('search_type_id', 'int'))
81 {
82  $newfiltre = str_replace('filtre=', '', $filtre);
83  $filterarray = explode('-', $newfiltre);
84  foreach ($filterarray as $val)
85  {
86  $part = explode(':', $val);
87  if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1];
88  }
89 } else {
90  $search_type_id = GETPOST('search_type_id', 'int');
91 }
92 
93 $childids = $user->getAllChildIds(1);
94 
95 // Security check
96 $socid = GETPOST("socid", "int");
97 if ($user->socid) $socid = $user->socid;
98 $result = restrictedArea($user, 'salaries', '', '', '');
99 
100 // Initialize array of search criterias
101 $search_all = GETPOST("search_all", 'alpha');
102 $search = array();
103 foreach ($object->fields as $key => $val)
104 {
105  if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
106 }
107 
108 // List of fields to search into when doing a "search in all"
109 $fieldstosearchall = array();
110 foreach ($object->fields as $key => $val)
111 {
112  if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
113 }
114 
115 $permissiontoread = $user->rights->salaries->read;
116 $permissiontoadd = $user->rights->salaries->write;
117 $permissiontodelete = $user->rights->salaries->delete;
118 
119 
120 /*
121  * Actions
122  */
123 
124 if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
125 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
126 
127 $parameters = array();
128 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
129 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
130 
131 if (empty($reshook))
132 {
133  // Selection of new fields
134  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
135 
136  // Purge search criteria
137  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
138  {
139  $search_ref = "";
140  $search_user = "";
141  $search_label = "";
142  $search_date_start = '';
143  $search_date_end = '';
144  $search_amount = "";
145  $search_account = '';
146  $search_type_id = "";
147  }
148  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
149  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
150  {
151  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
152  }
153 
154  // Mass actions
155  $objectclass = 'PaymentSalary';
156  $objectlabel = 'SalariesPayments';
157  $uploaddir = $conf->salaries->dir_output;
158  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
159 
160  // Validate records
161  if (!$error && $massaction == 'buildsepa' && $permissiontoadd)
162  {
163  $objecttmp = new $objectclass($db);
164 
165  // TODO
166  }
167 }
168 
169 /*
170  * View
171  */
172 
173 $form = new Form($db);
174 $salstatic = new PaymentSalary($db);
175 $userstatic = new User($db);
176 $accountstatic = new Account($db);
177 
178 $now = dol_now();
179 
180 //$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
181 $help_url = '';
182 $title = $langs->trans('SalariesPayments');
183 
184 $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
185 $sql .= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
186 $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
187 $sql .= " pst.code as payment_code";
188 $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
189 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
190 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
191 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
192 $sql .= " ".MAIN_DB_PREFIX."user as u";
193 $sql .= " WHERE u.rowid = s.fk_user";
194 $sql .= " AND s.entity IN (".getEntity('payment_salaries').")";
195 if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
196 
197 // Search criteria
198 if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
199 if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
200 if ($search_label) $sql .= natural_search(array('s.label'), $search_label);
201 if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
202 if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
203 if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
204 if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account);
205 if ($filtre) {
206  $filtre = str_replace(":", "=", $filtre);
207  $sql .= " AND ".$filtre;
208 }
209 if ($search_type_id) {
210  $sql .= " AND s.fk_typepayment=".$search_type_id;
211 }
212 $sql .= $db->order($sortfield, $sortorder);
213 
214 // Count total nb of records
215 $nbtotalofrecords = '';
216 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
217 {
218  $resql = $db->query($sql);
219  $nbtotalofrecords = $db->num_rows($resql);
220  if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
221  {
222  $page = 0;
223  $offset = 0;
224  }
225 }
226 // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
227 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
228 {
229  $num = $nbtotalofrecords;
230 } else {
231  if ($limit) $sql .= $db->plimit($limit + 1, $offset);
232 
233  $resql = $db->query($sql);
234  if (!$resql)
235  {
236  dol_print_error($db);
237  exit;
238  }
239 
240  $num = $db->num_rows($resql);
241 }
242 
243 // Output page
244 // --------------------------------------------------------------------
245 
246 llxHeader('', $title, $help_url);
247 
248 $arrayofselected = is_array($toselect) ? $toselect : array();
249 
250 $param = '';
251 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
252 if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
253 if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id);
254 if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
255 if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
256 if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
257 if ($search_label) $param .= '&search_label='.urlencode($search_label);
258 if ($search_account) $param .= '&search_account='.urlencode($search_account);
259 if ($search_date_start) $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int'));
260 if ($search_date_end) $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int'));
261 // Add $param from extra fields
262 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
263 
264 // List of mass actions available
265 $arrayofmassactions = array(
266  //'presend'=>$langs->trans("SendByMail"),
267  //'buildsepa'=>$langs->trans("BuildSepa"), // TODO
268 );
269 //if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
270 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
271 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
272 
273 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
274 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
275 print '<input type="hidden" name="token" value="'.newToken().'">';
276 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
277 print '<input type="hidden" name="action" value="list">';
278 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
279 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
280 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
281 
282 $url = DOL_URL_ROOT.'/salaries/card.php?action=create';
283 if (!empty($socid)) $url .= '&socid='.$socid;
284 $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
285 
286 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
287 
288 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
289 //$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
290 $selectedfields = '';
291 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
292 
293 print '<div class="div-table-responsive">';
294 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
295 
296 // Fields title search
297 // --------------------------------------------------------------------
298 print '<tr class="liste_titre_filter">';
299 // Ref
300 print '<td class="liste_titre left">';
301 print '<input class="flat" type="text" size="3" name="search_ref" value="'.$db->escape($search_ref).'">';
302 print '</td>';
303 // Employee
304 print '<td class="liste_titre">';
305 print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
306 print '</td>';
307 // Label
308 print '<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$db->escape($search_label).'"></td>';
309 // Date payment
310 print '<td class="liste_titre center">';
311 print '<div class="nowrap">';
312 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
313 print '</div>';
314 print '<div class="nowrap">';
315 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
316 print '</div>';
317 print '</td>';
318 // Date value
319 print '<td class="liste_titre center">';
320 print '</td>';
321 // Type
322 print '<td class="liste_titre left">';
323 $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
324 print '</td>';
325 // Account
326 if (!empty($conf->banque->enabled))
327 {
328  print '<td class="liste_titre">';
329  $form->select_comptes($search_account, 'search_account', 0, '', 1);
330  print '</td>';
331 }
332 // Amount
333 print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).'"></td>';
334 
335 // Extra fields
336 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
337 
338 // Fields from hook
339 $parameters = array('arrayfields'=>$arrayfields);
340 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
341 print $hookmanager->resPrint;
342 // Action column
343 print '<td class="liste_titre maxwidthsearch">';
344 $searchpicto = $form->showFilterButtons();
345 print $searchpicto;
346 print '</td>';
347 print '</tr>'."\n";
348 
349 
350 // Fields title label
351 // --------------------------------------------------------------------
352 print '<tr class="liste_titre">';
353 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
354 print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
355 print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
356 print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
357 print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
358 print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
359 if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
360 print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
361 // Extra fields
362 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
363 // Hook fields
364 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
365 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
366 print $hookmanager->resPrint;
367 // Action column
368 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
369 print '</tr>'."\n";
370 
371 
372 // Detect if we need a fetch on each output line
373 $needToFetchEachLine = 0;
374 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
375 {
376  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
377  {
378  if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
379  }
380 }
381 
382 // Loop on record
383 // --------------------------------------------------------------------
384 $i = 0;
385 $total = 0;
386 $totalarray = array();
387 while ($i < ($limit ? min($num, $limit) : $num))
388 {
389  $obj = $db->fetch_object($resql);
390  if (empty($obj)) break; // Should not happen
391 
392  // Store properties in $object
393  $object->setVarsFromFetchObj($obj);
394 
395  // Show here line of result
396  print '<tr class="oddeven">';
397 
398  $userstatic->id = $obj->uid;
399  $userstatic->lastname = $obj->lastname;
400  $userstatic->firstname = $obj->firstname;
401  $userstatic->admin = $obj->admin;
402  $userstatic->login = $obj->login;
403  $userstatic->email = $obj->email;
404  $userstatic->socid = $obj->fk_soc;
405  $userstatic->statut = $obj->status;
406 
407  $salstatic->id = $obj->rowid;
408  $salstatic->ref = $obj->rowid;
409 
410  // Ref
411  print "<td>".$salstatic->getNomUrl(1)."</td>\n";
412  if (!$i) $totalarray['nbfield']++;
413 
414  // Employee
415  print "<td>".$userstatic->getNomUrl(1)."</td>\n";
416  if (!$i) $totalarray['nbfield']++;
417 
418  // Label payment
419  print "<td>".dol_trunc($obj->label, 40)."</td>\n";
420  if (!$i) $totalarray['nbfield']++;
421 
422  // Date payment
423  print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
424  if (!$i) $totalarray['nbfield']++;
425 
426  // Date value
427  print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
428  if (!$i) $totalarray['nbfield']++;
429 
430  // Type
431  print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
432  if (!$i) $totalarray['nbfield']++;
433 
434  // Account
435  if (!empty($conf->banque->enabled))
436  {
437  print '<td>';
438  if ($obj->fk_bank > 0)
439  {
440  //$accountstatic->fetch($obj->fk_bank);
441  $accountstatic->id = $obj->bid;
442  $accountstatic->ref = $obj->bref;
443  $accountstatic->number = $obj->bnumber;
444 
445  if (!empty($conf->accounting->enabled))
446  {
447  $accountstatic->account_number = $obj->account_number;
448 
449  $accountingjournal = new AccountingJournal($db);
450  $accountingjournal->fetch($obj->fk_accountancy_journal);
451 
452  $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
453  }
454  $accountstatic->label = $obj->blabel;
455  print $accountstatic->getNomUrl(1);
456  } else print '&nbsp;';
457  print '</td>';
458  if (!$i) $totalarray['nbfield']++;
459  }
460 
461  // Amount
462  print '<td class="nowrap right">'.price($obj->amount).'</td>';
463  if (!$i) $totalarray['nbfield']++;
464  if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
465  $totalarray['val']['totalttcfield'] += $obj->amount;
466 
467  // Extra fields
468  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
469  // Fields from hook
470  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
471  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
472  print $hookmanager->resPrint;
473  // Action column
474  print '<td class="nowrap center">';
475  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
476  {
477  $selected = 0;
478  if (in_array($object->id, $arrayofselected)) $selected = 1;
479  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
480  }
481  print '</td>';
482  if (!$i) $totalarray['nbfield']++;
483 
484  print '</tr>'."\n";
485 
486  $i++;
487 }
488 
489 // Show total line
490 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
491 
492 
493 // If no record found
494 if ($num == 0)
495 {
496  $colspan = 1;
497  foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
498  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
499 }
500 
501 
502 $db->free($resql);
503 
504 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
505 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
506 print $hookmanager->resPrint;
507 
508 print '</table>'."\n";
509 print '</div>'."\n";
510 
511 print '</form>'."\n";
512 
513 
514 
515 // End of page
516 llxFooter();
517 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class to manage salary payments.
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 Dolibarr users.
Definition: user.class.php:44
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.
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...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
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...
Class to manage accounting accounts.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
llxFooter()
Empty footer.
Definition: wrapper.php:59