dolibarr  20.0.0-beta
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 // Load Dolibarr environment
29 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
33 
34 // Load translation files required by the page
35 $langs->loadLangs(array('banks', 'withdrawals', 'companies', 'categories'));
36 
37 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
38 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
39 $show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
40 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
41 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
42 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
43 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search
44 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
45 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
46 $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
47 
48 $type = GETPOST('type', 'aZ09');
49 
50 // Load variable for pagination
51 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
52 $sortfield = GETPOST('sortfield', 'aZ09comma');
53 $sortorder = GETPOST('sortorder', 'aZ09comma');
54 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
55 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
56  // If $page is not defined, or '' or -1 or if we click on clear filters
57  $page = 0;
58 }
59 $offset = $limit * $page;
60 $pageprev = $page - 1;
61 $pagenext = $page + 1;
62 if (!$sortorder) {
63  $sortorder = "DESC";
64 }
65 if (!$sortfield) {
66  $sortfield = ($type == 'bank-transfer' ? "datec" : "p.datec");
67 }
68 
69 $search_line = GETPOST('search_line', 'alpha');
70 $search_bon = GETPOST('search_bon', 'alpha');
71 $search_code = GETPOST('search_code', 'alpha');
72 $search_company = GETPOST('search_company', 'alpha');
73 $statut = GETPOSTINT('statut');
74 
75 $bon = new BonPrelevement($db);
76 $line = new LignePrelevement($db);
77 $company = new Societe($db);
78 $userstatic = new User($db);
79 
80 $hookmanager->initHooks(array('withdrawalsreceiptslineslist'));
81 
82 // Security check
83 $socid = GETPOSTINT('socid');
84 if ($user->socid) {
85  $socid = $user->socid;
86 }
87 if ($type == 'bank-transfer') {
88  $result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
89 } else {
90  $result = restrictedArea($user, 'prelevement', '', '', 'bons');
91 }
92 
93 
94 /*
95  * Actions
96  */
97 
98 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
99  $search_line = "";
100  $search_bon = "";
101  $search_code = "";
102  $search_company = "";
103  $statut = "";
104 }
105 
106 
107 /*
108  * View
109  */
110 
111 $form = new Form($db);
112 
113 $title = $langs->trans("WithdrawalsLines");
114 if ($type == 'bank-transfer') {
115  $title = $langs->trans("CreditTransferLines");
116 }
117 $help_url = '';
118 
119 $sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec";
120 $sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
121 $sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email";
122 $sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
123 
124 $sqlfields = $sql; // $sql fields to remove for count total
125 
126 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
127 $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
128 $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
129 if ($type == 'bank-transfer') {
130  $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
131 } else {
132  $sql .= " , ".MAIN_DB_PREFIX."facture as f";
133 }
134 $sql .= " , ".MAIN_DB_PREFIX."societe as s";
135 $sql .= " WHERE pl.fk_prelevement_bons = p.rowid";
136 $sql .= " AND pf.fk_prelevement_lignes = pl.rowid";
137 if ($type == 'bank-transfer') {
138  $sql .= " AND pf.fk_facture_fourn = f.rowid";
139 } else {
140  $sql .= " AND pf.fk_facture = f.rowid";
141 }
142 $sql .= " AND f.fk_soc = s.rowid";
143 $sql .= " AND f.entity IN (".getEntity('invoice').")";
144 if ($socid) {
145  $sql .= " AND s.rowid = ".((int) $socid);
146 }
147 if ($search_bon) {
148  $sql .= " AND pl.rowid = '".$db->escape($search_bon)."'";
149 }
150 if ($search_line) {
151  $sql .= natural_search("p.ref", $search_line);
152 }
153 if ($type == 'bank-transfer') {
154  if ($search_code) {
155  $sql .= natural_search("s.code_fournisseur", $search_code);
156  }
157 } else {
158  if ($search_code) {
159  $sql .= natural_search("s.code_client", $search_code);
160  }
161 }
162 if ($search_company) {
163  $sql .= natural_search("s.nom", $search_company);
164 }
165 //get salary invoices
166 if ($type == 'bank-transfer') {
167  $sql .= " UNION";
168 
169  $sql .= " SELECT p.rowid, p.ref, p.statut as status, p.datec";
170  $sql .= ", sl.rowid as facid, sl.ref as invoiceref, sl.amount";
171  $sql .= ", u.rowid as socid, CONCAT(u.firstname, ' ', u.lastname) as name, u.ref_employee as code_client, NULL as code_fournisseur, u.email";
172  $sql .= ", pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
173 
174  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
175  $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
176  $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
177  $sql .= " , ".MAIN_DB_PREFIX."salary as sl";
178  $sql .= " , ".MAIN_DB_PREFIX."user as u";
179 
180  $sql .= " WHERE pl.fk_prelevement_bons = p.rowid";
181  $sql .= " AND pf.fk_prelevement_lignes = pl.rowid";
182  $sql .= " AND pf.fk_salary = sl.rowid";
183  $sql .= " AND sl.fk_user = u.rowid";
184  $sql .= " AND sl.entity IN (".getEntity('invoice').")";
185  if ($socid) {
186  $sql .= " AND s.rowid = ".((int) $socid);
187  }
188  if ($search_bon) {
189  $sql .= " AND pl.rowid = '".$db->escape($search_bon)."'";
190  }
191  if ($search_line) {
192  $sql .= natural_search("p.ref", $search_line);
193  }
194  if ($type == 'bank-transfer') {
195  if ($search_code) {
196  $sql .= natural_search("NULL", $search_code);
197  }
198  } else {
199  if ($search_code) {
200  $sql .= natural_search("s.code_client", $search_code);
201  }
202  }
203  if ($search_company) {
204  $sql .= natural_search(array("u.firstname","u.lastname"), $search_company);
205  }
206 }
207 // Count total nb of records
208 $nbtotalofrecords = '';
209 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
210  /* The fast and low memory method to get and count full list converts the sql into a sql count */
211  if ($type == 'bank-transfer') {
212  $sqlforcount = "SELECT COUNT(*) as nbtotalofrecords FROM (" . $sql . ") AS combined_results";
213  } else {
214  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
215  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
216  }
217 
218  $resql = $db->query($sqlforcount);
219  if ($resql) {
220  $objforcount = $db->fetch_object($resql);
221  $nbtotalofrecords = $objforcount->nbtotalofrecords;
222  } else {
223  dol_print_error($db);
224  }
225 
226  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
227  $page = 0;
228  $offset = 0;
229  }
230  $db->free($resql);
231 }
232 
233 // Complete request and execute it with limit
234 $sql .= $db->order($sortfield, $sortorder);
235 if ($limit) {
236  $sql .= $db->plimit($limit + 1, $offset);
237 }
238 
239 $resql = $db->query($sql);
240 if (!$resql) {
241  dol_print_error($db);
242  exit;
243 }
244 
245 $num = $db->num_rows($resql);
246 
247 // Output page
248 // --------------------------------------------------------------------
249 
250 llxHeader('', $title, $help_url);
251 
252 $arrayofselected = is_array($toselect) ? $toselect : array();
253 
254 $param = '';
255 $param .= "&statut=".urlencode($statut);
256 $param .= "&search_bon=".urlencode($search_bon);
257 if ($type == 'bank-transfer') {
258  $param .= '&type=bank-transfer';
259 }
260 if (!empty($mode)) {
261  $param .= '&mode='.urlencode($mode);
262 }
263 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
264  $param .= '&contextpage='.urlencode($contextpage);
265 }
266 if ($limit > 0 && $limit != $conf->liste_limit) {
267  $param .= '&limit='.((int) $limit);
268 }
269 if ($optioncss != '') {
270  $param .= '&optioncss='.urlencode($optioncss);
271 }
272 
273 $arrayofmassactions = array(
274  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
275  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
276 );
277 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
278 
279 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
280 print '<input type="hidden" name="token" value="'.newToken().'">';
281 if ($optioncss != '') {
282  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
283 }
284 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
285 print '<input type="hidden" name="action" value="list">';
286 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
287 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
288 print '<input type="hidden" name="page" value="'.$page.'">';
289 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
290 print '<input type="hidden" name="page_y" value="">';
291 print '<input type="hidden" name="mode" value="'.$mode.'">';
292 
293 if ($type != '') {
294  print '<input type="hidden" name="type" value="'.$type.'">';
295 }
296 
297 $newcardbutton = '';
298 $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'));
299 $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'));
300 
301 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1);
302 
303 $moreforfilter = '';
304 /*$moreforfilter.='<div class="divsearchfield">';
305  $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
306  $moreforfilter.= '</div>';*/
307 
308 $parameters = array();
309 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
310 if (empty($reshook)) {
311  $moreforfilter .= $hookmanager->resPrint;
312 } else {
313  $moreforfilter = $hookmanager->resPrint;
314 }
315 
316 if (!empty($moreforfilter)) {
317  print '<div class="liste_titre liste_titre_bydiv centpercent">';
318  print $moreforfilter;
319  $parameters = array();
320  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
321  print $hookmanager->resPrint;
322  print '</div>';
323 }
324 
325 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
326 $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
327 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
328 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
329 
330 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
331 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
332 
333 // Fields title search
334 // --------------------------------------------------------------------
335 print '<tr class="liste_titre_filter">';
336 // Action column
337 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
338  print '<td class="liste_titre center maxwidthsearch">';
339  $searchpicto = $form->showFilterButtons('left');
340  print $searchpicto;
341  print '</td>';
342 }
343 print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'.dol_escape_htmltag($search_line).'" size="6"></td>';
344 print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.dol_escape_htmltag($search_bon).'" size="6"></td>';
345 print '<td class="liste_titre">&nbsp;</td>';
346 print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.dol_escape_htmltag($search_company).'" size="6"></td>';
347 print '<td class="liste_titre center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).'" size="6"></td>';
348 print '<td class="liste_titre">&nbsp;</td>';
349 print '<td class="liste_titre">&nbsp;</td>';
350 // Action column
351 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
352  print '<td class="liste_titre center maxwidthsearch">';
353  $searchpicto = $form->showFilterButtons();
354  print $searchpicto;
355  print '</td>';
356 }
357 print '</tr>'."\n";
358 
359 $totalarray = array();
360 $totalarray['nbfield'] = 0;
361 
362 $columntitle = "WithdrawalsReceipts";
363 $columntitlethirdparty = "CustomerCode";
364 $columncodethirdparty = "s.code_client";
365 if ($type == 'bank-transfer') {
366  $columntitle = "BankTransferReceipts";
367  $columntitlethirdparty = "SupplierCode";
368  $columncodethirdparty = "s.code_fournisseur";
369 }
370 
371 // Fields title label
372 // --------------------------------------------------------------------
373 print '<tr class="liste_titre">';
374 // Action column
375 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
376  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
377  $totalarray['nbfield']++;
378 }
379 print_liste_field_titre($columntitle, $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
380 $totalarray['nbfield']++;
381 print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
382 $totalarray['nbfield']++;
383 print_liste_field_titre(($type == 'bank-transfer' ? "BillsAndSalaries" : "Bills"), $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder);
384 $totalarray['nbfield']++;
385 print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
386 $totalarray['nbfield']++;
387 print_liste_field_titre($columntitlethirdparty, $_SERVER["PHP_SELF"], $columncodethirdparty, '', $param, '', $sortfield, $sortorder, 'center ');
388 $totalarray['nbfield']++;
389 print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center ');
390 $totalarray['nbfield']++;
391 print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right ');
392 $totalarray['nbfield']++;
393 // Action column
394 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
395  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
396  $totalarray['nbfield']++;
397 }
398 print '</tr>'."\n";
399 
400 // Loop on record
401 // --------------------------------------------------------------------
402 $i = 0;
403 $savnbfield = $totalarray['nbfield'];
404 $totalarray = array();
405 $totalarray['nbfield'] = 0;
406 
407 $imaxinloop = ($limit ? min($num, $limit) : $num);
408 while ($i < $imaxinloop) {
409  $obj = $db->fetch_object($resql);
410 
411  $bon->id = $obj->rowid;
412  $bon->ref = $obj->ref;
413  $bon->statut = $obj->status;
414  $bon->date_echeance = $obj->datec;
415  $bon->total = $obj->amount;
416 
417  $object = $bon;
418  if ($object->checkIfSalaryBonPrelevement()) {
419  $fullname = explode(' ', $obj->name);
420 
421  $userstatic->id = $obj->socid;
422  $userstatic->email = $obj->email;
423  $userstatic->firstname = $fullname[0];
424  $userstatic->lastname = isset($fullname[1]) ? $fullname[1] : '';
425  }
426 
427  $company->id = $obj->socid;
428  $company->name = $obj->name;
429  $company->email = $obj->email;
430  $company->code_client = $obj->code_client;
431 
432  if ($mode == 'kanban') {
433  if ($i == 0) {
434  print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
435  print '<div class="box-flex-container kanban">';
436  }
437  // Output Kanban
438  $selected = -1;
439  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
440  $selected = 0;
441  if (in_array($object->id, $arrayofselected)) {
442  $selected = 1;
443  }
444  }
445  print $object->getKanbanView('', array('selected' => $selected));
446  if ($i == ($imaxinloop - 1)) {
447  print '</div>';
448  print '</td></tr>';
449  }
450  } else {
451  // Show line of result
452  $j = 0;
453  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
454 
455  // Action column
456  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
457  print '<td class="nowrap center">';
458  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
459  $selected = 0;
460  if (in_array($object->id, $arrayofselected)) {
461  $selected = 1;
462  }
463  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
464  }
465  print '</td>';
466  if (!$i) {
467  $totalarray['nbfield']++;
468  }
469  }
470  print '<td>';
471  print $bon->getNomUrl(1);
472  print "</td>\n";
473 
474  print '<td>';
475  print $line->LibStatut($obj->statut_ligne, 2);
476  print "&nbsp;";
477  print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
478  print substr('000000'.$obj->rowid_ligne, -6);
479  print '</a></td>';
480 
481  // Ref invoice or salary
482  print '<td class="nowraponall">';
483  $link_to_bill = '/compta/facture/card.php?facid=';
484  $link_title = 'Invoice';
485  $link_picto = 'bill';
486  if ($type == 'bank-transfer') {
487  if ($bon->checkIfSalaryBonPrelevement()) {
488  $link_to_bill = '/salaries/card.php?id=';
489  $link_title = 'SalaryInvoice';
490  $link_picto = 'salary';
491  } else {
492  $link_to_bill = '/fourn/facture/card.php?facid=';
493  $link_title = 'SupplierInvoice';
494  $link_picto = 'supplier_invoice';
495  }
496  }
497  print '<a href="'.DOL_URL_ROOT.$link_to_bill.$obj->facid.'">';
498  print img_object($langs->trans($link_title), $link_picto);
499  if (!$bon->checkIfSalaryBonPrelevement()) {
500  print '&nbsp;'.$obj->invoiceref."</td>\n";
501  } else {
502  print '&nbsp;'.(!empty($obj->invoiceref) ? $obj->invoiceref : $obj->facid)."</td>\n";
503  }
504  print '</a>';
505  print '</td>';
506 
507  // Thirdparty (company or user)
508  print '<td class="tdoverflowmax150">';
509  print(!$bon->checkIfSalaryBonPrelevement() ? $company->getNomUrl(1) : $userstatic->getNomUrl(-1));
510  print "</td>\n";
511 
512  print '<td class="center">';
513  $link_to_tab = '/comm/card.php?socid=';
514  $link_code = $obj->code_client;
515  if ($type == 'bank-transfer') {
516  $link_to_tab = '/fourn/card.php?socid=';
517  $link_code = $obj->code_fournisseur;
518  }
519  print '<a href="'.DOL_URL_ROOT.$link_to_tab.$company->id.'">'.$link_code."</a>";
520  print "</td>\n";
521 
522  print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
523 
524  print '<td class="nowraponall right"><span class="amount">'.price($obj->amount)."</span></td>\n";
525 
526  // Action column
527  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
528  print '<td class="nowrap center">';
529  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
530  $selected = 0;
531  if (in_array($object->id, $arrayofselected)) {
532  $selected = 1;
533  }
534  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
535  }
536  print '</td>';
537  if (!$i) {
538  $totalarray['nbfield']++;
539  }
540  }
541 
542  print '</tr>'."\n";
543  }
544  $i++;
545 }
546 
547 if ($num == 0) {
548  print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
549 }
550 
551 $db->free($resql);
552 
553 $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
554 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
555 print $hookmanager->resPrint;
556 
557 print '</table>'."\n";
558 print '</div>'."\n";
559 
560 print '</form>'."\n";
561 
562 
563 // End of page
564 llxFooter();
565 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
Class to manage withdrawal receipts.
Class to manage generation of HTML components Only common components must be here.
Class to manage withdrawals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
Definition: user.class.php:50
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:745
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.