dolibarr 23.0.3
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
6 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
7 * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2017-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
9 * Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
10 * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
11 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
12 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
13 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
35// Load Dolibarr environment
36require '../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
45require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
46require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
48require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
50
51// Load translation files required by the page
52$langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
53
54$action = GETPOST('action', 'alpha');
55$massaction = GETPOST('massaction', 'alpha');
56$confirm = GETPOST('confirm', 'alpha');
57$toselect = GETPOST('toselect', 'array:int');
58$optioncss = GETPOST('optioncss', 'alpha');
59$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist';
60$mode = GETPOST('mode', 'alpha');
61
62$facid = GETPOST('facid', 'int');
63$socid = GETPOST('socid', 'int');
64$userid = GETPOST('userid', 'int');
65
66$search_ref = GETPOST("search_ref", "alpha");
67$search_date_startday = GETPOSTINT('search_date_startday');
68$search_date_startmonth = GETPOSTINT('search_date_startmonth');
69$search_date_startyear = GETPOSTINT('search_date_startyear');
70$search_date_endday = GETPOSTINT('search_date_endday');
71$search_date_endmonth = GETPOSTINT('search_date_endmonth');
72$search_date_endyear = GETPOSTINT('search_date_endyear');
73$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
74$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
75$search_company = GETPOST("search_company", 'alpha');
76$search_paymenttype = GETPOST("search_paymenttype");
77$search_account = GETPOST("search_account", 'alpha');
78$search_payment_num = GETPOST('search_payment_num', 'alpha');
79$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
80$search_noteprivate = GETPOST("search_noteprivate");
81$search_status = GETPOST('search_status', 'intcomma');
82$search_sale = GETPOSTINT('search_sale');
83
84
85$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
86$sortfield = GETPOST('sortfield', 'aZ09comma');
87$sortorder = GETPOST('sortorder', 'aZ09comma');
88$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
89
90if (empty($page) || $page == -1) {
91 $page = 0; // If $page is not defined, or '' or -1
92}
93$offset = $limit * $page;
94$pageprev = $page - 1;
95$pagenext = $page + 1;
96
97if (!$sortorder) {
98 $sortorder = "DESC";
99}
100if (!$sortfield) {
101 $sortfield = "p.ref";
102}
103
104$search_all = trim(GETPOST('search_all', 'alphanohtml'));
105
106$arrayofselected = !empty($arrayofselected) && is_array($arrayofselected) ? $arrayofselected : array();
107
108// List of fields to search into when doing a "search in all"
109$fieldstosearchall = array(
110 'p.ref' => "RefPayment",
111 's.nom' => "ThirdParty",
112 'p.num_paiement' => "Numero",
113 'p.amount' => "Amount",
114);
115
116$arrayfields = array(
117 'p.ref' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10),
118 'p.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20),
119 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30),
120 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40),
121 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 50, 'enabled' => (string) (int) (isModEnabled("bank"))),
122 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))),
123 'p.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 70, 'tooltip' => "ChequeOrTransferNumber"),
124 'p.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80),
125 'p.note' => array('label' => "Comment", 'checked' => '-1', 'position' => 85),
126 'p.ext_payment_id' => array('label' => "ExtPaymentID", 'checked' => '-1', 'position' => 87),
127 'p.ext_payment_site' => array('label' => "ExtPaymentSite", 'checked' => '-1', 'position' => 88),
128 'p.tms' => array('label' => "DateModification", 'checked' => '-1', 'position' => 150),
129 'p.statut' => array('label' => "Status", 'checked' => '1', 'position' => 200, 'enabled' => (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))),
130);
131$arrayfields = dol_sort_array($arrayfields, 'position');
132
133// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
134$hookmanager->initHooks(array('paymentlist'));
135$object = new Paiement($db);
136$extrafields = new ExtraFields($db);
137
138// Fetch optionals attributes and labels
139$extrafields->fetch_name_optionals_label($object->table_element);
140
141$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
142// Extra fields
143include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
144
145if (!$user->hasRight('societe', 'client', 'voir')) {
146 $search_sale = $user->id;
147}
148
149// Security check
150if ($user->socid) {
151 $socid = $user->socid;
152}
153$result = restrictedArea($user, 'facture', $facid, '');
154
155$permissiontopay = $user->hasRight('facture', 'paiement');
156$permissiontodelete = $user->hasRight('facture', 'delete');
157
158$error = 0;
159
160
161/*
162 * Actions
163 */
164
165if (GETPOST('cancel', 'alpha')) {
166 $action = 'list';
167 $massaction = '';
168}
169if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
170 $massaction = '';
171}
172
173$parameters = array('arrayfields' => &$arrayfields, 'socid' => $socid);
174$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
175if ($reshook < 0) {
176 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177}
178
179
180if (empty($reshook)) {
181 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
182
183 // All tests are required to be compatible with all browsers
184 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
185 $search_ref = '';
186 $search_date_startday = '';
187 $search_date_startmonth = '';
188 $search_date_startyear = '';
189 $search_date_endday = '';
190 $search_date_endmonth = '';
191 $search_date_endyear = '';
192 $search_date_start = '';
193 $search_date_end = '';
194 $search_account = '';
195 $search_amount = '';
196 $search_paymenttype = '';
197 $search_payment_num = '';
198 $search_company = '';
199 $search_noteprivate = '';
200 $search_status = '';
201 $option = '';
202 $toselect = array();
203 $search_array_options = array();
204 }
205 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
206 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
207 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
208 }
209
210 // Mass actions
211 $objectclass = 'Paiement';
212 $objectlabel = 'Payment';
213 $uploaddir = $conf->invoice->dir_output.'/payments';
214
215 global $error;
216 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
217
218 if ($action === 'createbankpayment' && $permissiontopay && $confirm == 'yes') {
219 $db->begin();
220
221 foreach ($toselect as $toselectid) {
222 // Create the record into bank for the amount of payment $object
223 if (!$error) {
224 $label = '(CustomerInvoicePayment)';
225 if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
226 $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
227 }
228
229 $bankaccountid = GETPOSTINT('accountid');
230 if ($bankaccountid > 0) {
231 $object->fetch($toselectid);
232
233 if (((int) $object->fk_account) != 0) {
234 setEventMessages('Error, at least one payment is already linked to a bank account', null, 'errors');
235 $error++;
236 break;
237 }
238
239 $object->paiementcode = $object->type_code;
240 $object->amounts = $object->getAmountsArray();
241
242 $result = $object->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
243 if ($result < 0) {
244 setEventMessages($object->error, $object->errors, 'errors');
245 $error++;
246 }
247 } else {
248 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
249 $error++;
250 }
251 }
252 }
253
254 if (!$error) {
255 $db->commit();
256 } else {
257 $db->rollback();
258 }
259 }
260}
261
262
263/*
264 * View
265 */
266
267$form = new Form($db);
268$formother = new FormOther($db);
269$accountstatic = new Account($db);
270$companystatic = new Societe($db);
271$bankline = new AccountLine($db);
272
273$title = $langs->trans('ListPayment');
274
275llxHeader('', $title, '', '', 0, 0, '', '', '', 'bodyforlist');
276
277
278$sql = "SELECT p.rowid, p.ref, p.datep, p.fk_bank, p.statut, p.num_paiement as num_payment, p.amount, p.note as note_private,";
279$sql .= " p.ext_payment_id, p.ext_payment_site,";
280$sql .= " p.tms,";
281$sql .= " c.code as paiement_code,";
282$sql .= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
283$sql .= " s.rowid as socid, s.nom as name, s.email,";
284// We need an aggregate because we added a left join to get the thirdparty. In real world, it should be the same thirdparty if payment is same (but not in database structure)
285// so SUM(pf.amount) should be equal to p.amount but if we filter on $socid, it may differ
286$sql .= " SUM(pf.amount) as totalamount, COUNT(f.rowid) as nbinvoices";
287// Add fields from extrafields
288if (!empty($extrafields->attributes[$object->table_element]['label'])) {
289 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
290 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
291 }
292}
293// Add fields from hooks
294$parameters = array();
295$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
296$sql .= $hookmanager->resPrint;
297$sql = preg_replace('/,\s*$/', '', $sql);
298
299$sqlfields = $sql; // $sql fields to remove for count total
300
301$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
302if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
303 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
304}
305$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
306$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
307$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
308
309$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
310$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
311$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
312
313$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
314if ($socid > 0) {
315 $sql .= " AND EXISTS (SELECT f.fk_soc FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf";
316 $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_soc = ".((int) $socid).")";
317}
318if ($userid) {
319 if ($userid == -1) {
320 $sql .= " AND p.fk_user_creat IS NULL";
321 } else {
322 $sql .= " AND p.fk_user_creat = ".((int) $userid);
323 }
324}
325
326// Search criteria
327if ($search_ref) {
328 $sql .= natural_search('p.ref', $search_ref);
329}
330if ($search_date_start) {
331 $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
332}
333if ($search_date_end) {
334 $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
335}
336if ($search_account > 0) {
337 $sql .= " AND b.fk_account = ".((int) $search_account);
338} elseif ($search_account == -2) {
339 $sql .= " AND (b.fk_account = 0 OR b.fk_account IS NULL)";
340}
341if ($search_paymenttype != '') {
342 $sql .= " AND c.code = '".$db->escape($search_paymenttype)."'";
343}
344if ($search_payment_num != '') {
345 $sql .= natural_search('p.num_paiement', $search_payment_num);
346}
347if ($search_amount) {
348 $sql .= " AND (".natural_search('p.amount', $search_amount, 1, 1);
349 $sql .= " OR ";
350 $sql .= natural_search('pf.amount', $search_amount, 1, 1);
351 $sql .= ")";
352}
353if ($search_company) {
354 $sql .= natural_search('s.nom', $search_company);
355}
356if ($search_noteprivate) {
357 $sql .= natural_search('p.note', $search_noteprivate);
358}
359// Search on sale representative
360if ($search_sale && $search_sale != -1) {
361 if ($search_sale == -2) {
362 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
363 } elseif ($search_sale > 0) {
364 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
365 }
366}
367
368if ($search_all) {
369 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
370}
371// Add where from extra fields
372include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
373
374// Add where from hooks
375$parameters = array();
376$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
377$sql .= $hookmanager->resPrint;
378
379$sql .= " GROUP BY p.rowid, p.ref, p.datep, p.fk_bank, p.statut, p.num_paiement, p.amount, p.note, p.ext_payment_id, p.ext_payment_site";
380$sql .= ", c.code";
381$sql .= ", ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.fk_accountancy_journal";
382$sql .= ", s.rowid, s.nom, s.email";
383
384// Overwrite for a debug use case
385if (GETPOST("orphelins", "alpha")) {
386 // Payments not linked to an invoice. Should not happen. For debug only.
387 $sql = "SELECT p.rowid, p.ref, p.datep, p.fk_bank, p.statut, p.num_paiement as num_payment, p.amount, p.note as private_note";
388 $sql .= ", c.code as paiement_code";
389
390 $sqlfields = $sql; // $sql fields to remove for count total
391
392 // Add fields from hooks
393 $parameters = array();
394 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
395 $sql .= $hookmanager->resPrint;
396 $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
397 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
398 $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
399 $sql .= " AND pf.fk_facture IS NULL";
400
401 // Add where from hooks
402 $parameters = array();
403 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
404 $sql .= $hookmanager->resPrint;
405}
406
407
408// Count total nb of records
409$nbtotalofrecords = '';
410if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
411 /* The fast and low memory method to get and count full list converts the sql into a sql count */
412 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT p.rowid) as nbtotalofrecords', $sql);
413 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
414 $resql = $db->query($sqlforcount);
415 if ($resql) {
416 $objforcount = $db->fetch_object($resql);
417 $nbtotalofrecords = $objforcount->nbtotalofrecords;
418 } else {
419 dol_print_error($db);
420 }
421
422 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
423 $page = 0;
424 $offset = 0;
425 }
426 $db->free($resql);
427}
428
429// Complete request and execute it with limit
430$sql .= $db->order($sortfield, $sortorder);
431if ($limit) {
432 $sql .= $db->plimit($limit + 1, $offset);
433}
434//print $sql;
435
436$resql = $db->query($sql);
437if (!$resql) {
438 dol_print_error($db);
439 llxFooter();
440 $db->close();
441 exit;
442}
443
444$num = $db->num_rows($resql);
445
446
447// Output page
448// --------------------------------------------------------------------
449
450$arrayofselected = is_array($toselect) ? $toselect : array();
451
452$param = '';
453if (!empty($mode)) {
454 $param .= '&mode='.urlencode($mode);
455}
456if (!empty($contextpage) && $contextpage != getDolDefaultContextPage(__FILE__)) {
457 $param .= '&contextpage='.urlencode($contextpage);
458}
459if ($limit > 0 && $limit != $conf->liste_limit) {
460 $param .= '&limit='.((int) $limit);
461}
462if ($optioncss != '') {
463 $param .= '&optioncss='.urlencode($optioncss);
464}
465
466if (GETPOST("orphelins")) {
467 $param .= '&orphelins=1';
468}
469if ($search_ref) {
470 $param .= '&search_ref='.urlencode($search_ref);
471}
472if ($search_date_startday) {
473 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
474}
475if ($search_date_startmonth) {
476 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
477}
478if ($search_date_startyear) {
479 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
480}
481if ($search_date_endday) {
482 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
483}
484if ($search_date_endmonth) {
485 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
486}
487if ($search_date_endyear) {
488 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
489}
490if ($search_company) {
491 $param .= '&search_company='.urlencode($search_company);
492}
493if ($search_amount != '') {
494 $param .= '&search_amount='.urlencode($search_amount);
495}
496if ($search_paymenttype) {
497 $param .= '&search_paymenttype='.urlencode($search_paymenttype);
498}
499if ($search_account) {
500 $param .= '&search_account='.urlencode((string) ($search_account));
501}
502if ($search_payment_num) {
503 $param .= '&search_payment_num='.urlencode($search_payment_num);
504}
505if ($search_noteprivate) {
506 $param .= '&search_noteprivate='.urlencode($search_noteprivate);
507}
508// Add $param from extra fields
509include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
510// Add $param from hooks
511$parameters = array('param' => &$param);
512$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
513$param .= $hookmanager->resPrint;
514
515// List of mass actions available
516$arrayofmassactions = array(
517 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
518 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
519 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
520 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
521);
522if (!empty($permissiontopay) && getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK')) {
523 $arrayofmassactions['createbankpayment'] = img_picto('', 'bank', 'class="pictofixedwidth"').$langs->trans("FixLinkToBank");
524}
525if (!empty($permissiontodelete)) {
526 //$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
527}
528if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'createbankpayment'))) {
529 $arrayofmassactions = array();
530}
531$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
532
533print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
534if ($optioncss != '') {
535 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
536}
537print '<input type="hidden" name="token" value="'.newToken().'">';
538print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
539print '<input type="hidden" name="action" value="list">';
540print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
541print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
542print '<input type="hidden" name="page" value="'.$page.'">';
543print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
544print '<input type="hidden" name="page_y" value="">';
545print '<input type="hidden" name="mode" value="'.$mode.'">';
546
547// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
548print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
549
550
551if ($massaction == 'createbankpayment') {
552 $formquestion = array();
553
554 $valuefield = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
555 $valuefield .= img_picto('', 'bank', 'class="pictofixedwidth"');
556 $valuefield .= $form->select_comptes(0, 'accountid', 0, '', 2, '', 0, '', 1);
557 $valuefield .= '</div>';
558
559 $formquestion[] = array(
560 'type' => 'other',
561 'name' => 'bakaccount',
562 'label' => $langs->trans("BankAccount"),
563 'value' => $valuefield
564 );
565
566 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ToCreateRelatedRecordIntoBank"), $langs->trans("Confirm"), "createbankpayment", $formquestion, 1, 0, 200, 500, 1);
567}
568
569
570if ($search_all) {
571 $setupstring = '';
572 // @phan-suppress-next-line PhanEmptyForeach
573 foreach ($fieldstosearchall as $key => $val) {
574 $fieldstosearchall[$key] = $langs->trans($val);
575 $setupstring .= $key."=".$val.";";
576 }
577 print '<!-- Search done like if PAYMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
578 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
579}
580
581$moreforfilter = '';
582
583$parameters = array();
584$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
585if (empty($reshook)) {
586 $moreforfilter .= $hookmanager->resPrint;
587} else {
588 $moreforfilter = $hookmanager->resPrint;
589}
590$parameters = array(
591 'arrayfields' => &$arrayfields,
592);
593
594if (!empty($moreforfilter)) {
595 print '<div class="liste_titre liste_titre_bydiv centpercent">';
596 print $moreforfilter;
597 print '</div>';
598}
599
600$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
601$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
602$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
603$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
604
605print '<div class="div-table-responsive">';
606print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">'."\n";
607
608// Fields title search
609// --------------------------------------------------------------------
610print '<tr class="liste_titre_filter">';
611
612// Action column
613if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
614 print '<td class="liste_titre center maxwidthsearch">';
615 $searchpicto = $form->showFilterButtons('left');
616 print $searchpicto;
617 print '</td>';
618}
619
620// #
621if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
622 print '<td class="liste_titre">';
623 print '</td>';
624}
625
626// Filter: Ref
627if (!empty($arrayfields['p.ref']['checked'])) {
628 print '<td class="liste_titre left">';
629 print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
630 print '</td>';
631}
632
633// Filter: Date
634if (!empty($arrayfields['p.datep']['checked'])) {
635 print '<td class="liste_titre center">';
636 print '<div class="nowrapfordate">';
637 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
638 print '</div>';
639 print '<div class="nowrapfordate">';
640 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
641 print '</div>';
642 print '</td>';
643}
644
645// Filter: Thirdparty
646if (!empty($arrayfields['s.nom']['checked'])) {
647 print '<td class="liste_titre">';
648 print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
649 print '</td>';
650}
651
652// Filter: Payment type
653if (!empty($arrayfields['c.libelle']['checked'])) {
654 print '<td class="liste_titre">';
655 print $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
656 print '</td>';
657}
658
659// Filter: Bank transaction number
660if (!empty($arrayfields['transaction']['checked'])) {
661 print '<td class="liste_titre">';
662 print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
663 print '</td>';
664}
665
666// Filter: Cheque number (fund transfer)
667if (!empty($arrayfields['p.num_paiement']['checked'])) {
668 print '<td class="liste_titre">';
669 print '</td>';
670}
671
672// Filter: Bank account
673if (!empty($arrayfields['ba.label']['checked'])) {
674 print '<td class="liste_titre">';
675 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1, getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK') ? 1 : 0);
676 print '</td>';
677}
678
679// Filter: Amount
680if (!empty($arrayfields['p.amount']['checked'])) {
681 print '<td class="liste_titre right">';
682 print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
683 print '</td>';
684}
685
686// Filter: Note
687if (!empty($arrayfields['p.note']['checked'])) {
688 print '<td class="liste_titre">';
689 print '<input class="flat maxwidth150" type="text" name="search_noteprivate" value="'.dol_escape_htmltag($search_noteprivate).'">';
690 print '</td>';
691}
692
693// Filter: ext_payment_id
694if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
695 print '<td class="liste_titre">';
696 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_id" value="'.dol_escape_htmltag($search_ext_payment_id).'">';
697 print '</td>';
698}
699
700// Filter: ext_payment_site
701if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
702 print '<td class="liste_titre">';
703 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
704 print '</td>';
705}
706
707// Filter: ext_payment_site
708if (!empty($arrayfields['p.tms']['checked'])) {
709 print '<td class="liste_titre">';
710 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
711 print '</td>';
712}
713
714// Filter: Status (only placeholder)
715if (!empty($arrayfields['p.statut']['checked'])) {
716 print '<td class="liste_titre right">';
717 print '</td>';
718}
719
720// Extra fields
721include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
722
723// Fields from hook
724$parameters = array('arrayfields' => $arrayfields);
725$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
726print $hookmanager->resPrint;
727
728// Action column
729if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
730 print '<td class="liste_titre center maxwidthsearch">';
731 $searchpicto = $form->showFilterButtons();
732 print $searchpicto;
733 print '</td>';
734}
735
736print '</tr>'."\n";
737
738$totalarray = array();
739$totalarray['nbfield'] = 0;
740
741// Fields title label
742// --------------------------------------------------------------------
743print '<tr class="liste_titre">';
744// Action column
745if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
746 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
747 $totalarray['nbfield']++;
748}
749if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
750 print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
751 $totalarray['nbfield']++;
752}
753if (!empty($arrayfields['p.ref']['checked'])) {
754 // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
755 print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
756 $totalarray['nbfield']++;
757}
758if (!empty($arrayfields['p.datep']['checked'])) {
759 print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center ');
760 $totalarray['nbfield']++;
761}
762if (!empty($arrayfields['s.nom']['checked'])) {
763 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
764 $totalarray['nbfield']++;
765}
766if (!empty($arrayfields['c.libelle']['checked'])) {
767 print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder);
768 $totalarray['nbfield']++;
769}
770if (!empty($arrayfields['p.num_paiement']['checked'])) {
771 print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
772 $totalarray['nbfield']++;
773}
774if (!empty($arrayfields['transaction']['checked'])) {
775 print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
776 $totalarray['nbfield']++;
777}
778if (!empty($arrayfields['ba.label']['checked'])) {
779 print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
780 $totalarray['nbfield']++;
781}
782if (!empty($arrayfields['p.amount']['checked'])) {
783 print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder);
784 $totalarray['nbfield']++;
785}
786if (!empty($arrayfields['p.note']['checked'])) {
787 print_liste_field_titre($arrayfields['p.note']['label'], $_SERVER["PHP_SELF"], "p.note", '', $param, '', $sortfield, $sortorder);
788 $totalarray['nbfield']++;
789}
790if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
791 print_liste_field_titre($arrayfields['p.ext_payment_id']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_id", '', $param, '', $sortfield, $sortorder);
792 $totalarray['nbfield']++;
793}
794if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
795 print_liste_field_titre($arrayfields['p.ext_payment_site']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_site", '', $param, '', $sortfield, $sortorder);
796 $totalarray['nbfield']++;
797}
798if (!empty($arrayfields['p.tms']['checked'])) {
799 print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", '', $param, '', $sortfield, $sortorder);
800 $totalarray['nbfield']++;
801}
802if (!empty($arrayfields['p.statut']['checked'])) {
803 print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder);
804 $totalarray['nbfield']++;
805}
806// Extra fields
807include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
808// Hook fields
809$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
810$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
811print $hookmanager->resPrint;
812// Action column
813if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
814 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
815 $totalarray['nbfield']++;
816}
817
818print '</tr>'."\n";
819
820// Detect if we need a fetch on each output line
821$needToFetchEachLine = 0;
822if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
823 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
824 if (!is_null($val) && preg_match('/\$object/', $val)) {
825 $needToFetchEachLine++; // There is at least one compute field that use $object
826 }
827 }
828}
829
830
831// Loop on record
832// --------------------------------------------------------------------
833$i = 0;
834$savnbfield = $totalarray['nbfield'];
835$totalarray = array();
836$totalarray['nbfield'] = 0;
837$imaxinloop = ($limit ? min($num, $limit) : $num);
838while ($i < $imaxinloop) {
839 $obj = $db->fetch_object($resql);
840 if (empty($obj)) {
841 break; // Should not happen
842 }
843
844 $object->id = $obj->rowid;
845 $object->ref = ($obj->ref ? $obj->ref : $obj->rowid);
846 $object->date = $db->jdate($obj->datep);
847 $object->amount = $obj->amount;
848 $object->note_private = $obj->note_private;
849
850 $companystatic->id = $obj->socid;
851 $companystatic->name = $obj->name;
852 $companystatic->email = $obj->email;
853
854 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
855 if ($i == 0) {
856 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
857 print '<div class="box-flex-container kanban">';
858 }
859 // Output Kanban
860 $selected = -1;
861 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
862 $selected = 0;
863 if (in_array($object->id, $arrayofselected)) {
864 $selected = 1;
865 }
866 }
867 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
868 print $object->getKanbanView('', array('selected' => $selected));
869 if ($i == ($imaxinloop - 1)) {
870 print '</div>';
871 print '</td></tr>';
872 }
873 } else {
874 // Show line of result
875 $j = 0;
876 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
877
878 // Action column
879 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
880 print '<td class="nowrap center">';
881 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
882 $selected = 0;
883 if (in_array($object->id, $arrayofselected)) {
884 $selected = 1;
885 }
886 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
887 }
888 print '</td>';
889 if (!$i) {
890 $totalarray['nbfield']++;
891 }
892 }
893
894 // No
895 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
896 print '<td class="nowraponall">'.(($offset * $limit) + $i).'</td>';
897 if (!$i) {
898 $totalarray['nbfield']++;
899 }
900 }
901
902 // Ref
903 if (!empty($arrayfields['p.ref']['checked'])) {
904 print '<td class="nowraponall">'.$object->getNomUrl(1).'</td>';
905 if (!$i) {
906 $totalarray['nbfield']++;
907 }
908 }
909
910 // Date
911 if (!empty($arrayfields['p.datep']['checked'])) {
912 $dateformatforpayment = 'dayhour';
913 print '<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datep), $dateformatforpayment, 'tzuser').'</td>';
914 if (!$i) {
915 $totalarray['nbfield']++;
916 }
917 }
918
919 // Thirdparty
920 if (!empty($arrayfields['s.nom']['checked'])) {
921 print '<td class="tdoverflowmax125">';
922 if ($obj->socid > 0) {
923 print $companystatic->getNomUrl(1, '', 24);
924 }
925 print '</td>';
926 if (!$i) {
927 $totalarray['nbfield']++;
928 }
929 }
930
931 // Payment type
932 if (!empty($arrayfields['c.libelle']['checked'])) {
933 print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForAttribute($langs->trans("PaymentTypeShort".$obj->paiement_code)).'">'.dolPrintHTML($langs->trans("PaymentTypeShort".$obj->paiement_code)).'</td>';
934 if (!$i) {
935 $totalarray['nbfield']++;
936 }
937 }
938
939 // Filter: Cheque number (fund transfer)
940 if (!empty($arrayfields['p.num_paiement']['checked'])) {
941 print '<td>'.$obj->num_payment.'</td>';
942 if (!$i) {
943 $totalarray['nbfield']++;
944 }
945 }
946
947 // Bank transaction
948 if (!empty($arrayfields['transaction']['checked'])) {
949 print '<td class="tdoverflowmax125">';
950 if ($obj->fk_bank > 0) {
951 $bankline->fetch($obj->fk_bank);
952 print $bankline->getNomUrl(1, 0);
953 }
954 print '</td>';
955 if (!$i) {
956 $totalarray['nbfield']++;
957 }
958 }
959
960 // Bank account
961 if (!empty($arrayfields['ba.label']['checked'])) {
962 print '<td>';
963 if ($obj->bid > 0) {
964 $accountstatic->id = $obj->bid;
965 $accountstatic->ref = $obj->bref;
966 $accountstatic->label = $obj->blabel;
967 $accountstatic->number = $obj->number;
968 $accountstatic->account_number = $obj->account_number;
969
970 $accountingjournal = new AccountingJournal($db);
971 $accountingjournal->fetch($obj->accountancy_journal);
972 $accountstatic->accountancy_journal = $accountingjournal->code;
973
974 print $accountstatic->getNomUrl(1);
975 }
976 print '</td>';
977 if (!$i) {
978 $totalarray['nbfield']++;
979 }
980 }
981
982 // Amount
983 if (!empty($arrayfields['p.amount']['checked'])) {
984 print '<td class="right">';
985 if ($obj->nbinvoices > 1 || ($obj->totalamount && $obj->amount != $obj->totalamount)) {
986 print $form->textwithpicto('', $langs->trans("PaymentMadeForSeveralInvoices"));
987 }
988 print '<span class="amount">'.price($obj->amount).'</span>';
989 print '</td>';
990 if (!$i) {
991 $totalarray['nbfield']++;
992 $totalarray['pos'][$totalarray['nbfield']] = 'amount';
993 }
994 if (empty($totalarray['val']['amount'])) {
995 $totalarray['val']['amount'] = $obj->amount;
996 } else {
997 $totalarray['val']['amount'] += $obj->amount;
998 }
999 }
1000
1001 // Note
1002 if (!empty($arrayfields['p.note']['checked'])) {
1003 $firstline = dolGetFirstLineOfText($obj->note_private, 1);
1004 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($firstline).'">';
1005 print dolPrintHTML($firstline).'</span>';
1006 print '</td>';
1007 if (!$i) {
1008 $totalarray['nbfield']++;
1009 }
1010 }
1011
1012 // ext_payment_id
1013 if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
1014 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_id).'">';
1015 print dolPrintHTML($obj->ext_payment_id).'</span>';
1016 print '</td>';
1017 if (!$i) {
1018 $totalarray['nbfield']++;
1019 }
1020 }
1021
1022 // ext_payment_site
1023 if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
1024 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_site).'">';
1025 print dolPrintHTML($obj->ext_payment_site).'</span>';
1026 print '</td>';
1027 if (!$i) {
1028 $totalarray['nbfield']++;
1029 }
1030 }
1031
1032 // Date last change
1033 if (!empty($arrayfields['p.tms']['checked'])) {
1034 print '<td class="tdoverflowmax200">';
1035 print dol_print_date($obj->tms, 'dayhour', 'tzuserrel').'</span>';
1036 print '</td>';
1037 if (!$i) {
1038 $totalarray['nbfield']++;
1039 }
1040 }
1041
1042 // Extra fields
1043 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1044
1045 // Status
1046 if (!empty($arrayfields['p.statut']['checked'])) {
1047 print '<td class="right">';
1048 if ($obj->statut == 0) {
1049 print '<a href="card.php?id='.$obj->rowid.'&amp;action=valide">';
1050 }
1051 print $object->LibStatut($obj->statut, 5);
1052 if ($obj->statut == 0) {
1053 print '</a>';
1054 }
1055 print '</td>';
1056 if (!$i) {
1057 $totalarray['nbfield']++;
1058 }
1059 }
1060
1061 // Action column
1062 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1063 print '<td class="nowrap center">';
1064 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1065 $selected = 0;
1066 if (in_array($object->id, $arrayofselected)) {
1067 $selected = 1;
1068 }
1069 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1070 }
1071 print '</td>';
1072 if (!$i) {
1073 $totalarray['nbfield']++;
1074 }
1075 }
1076
1077 print '</tr>'."\n";
1078 }
1079
1080 $i++;
1081}
1082
1083// Show total line
1084include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1085
1086// If no record found
1087if ($num == 0) {
1088 $colspan = 1;
1089 foreach ($arrayfields as $key => $val) {
1090 if (!empty($val['checked'])) {
1091 $colspan++;
1092 }
1093 }
1094 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1095}
1096
1097$db->free($resql);
1098
1099$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1100$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1101print $hookmanager->resPrint;
1102
1103print '</table>'."\n";
1104print '</div>'."\n";
1105
1106print '</form>'."\n";
1107
1108// End of page
1109llxFooter();
1110$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition export.php:1216
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 bank accounts.
Class to manage bank transaction lines.
Class to manage accounting journals.
Class to manage standard extra fields.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
Class to manage payments of customer invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getDolDefaultContextPage($s)
Return the default context page string.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.