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