dolibarr 24.0.0-beta
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-2026 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';
45require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
46require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
47require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
48require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
50require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
51
52// Load translation files required by the page
53$langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
54
55$action = GETPOST('action', 'alpha');
56$massaction = GETPOST('massaction', 'alpha');
57$confirm = GETPOST('confirm', 'alpha');
58$toselect = GETPOST('toselect', 'array:int');
59$optioncss = GETPOST('optioncss', 'alpha');
60$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist';
61$mode = GETPOST('mode', 'alpha');
62
63$facid = GETPOST('facid', 'int');
64$socid = GETPOST('socid', 'int');
65$userid = GETPOST('userid', 'int');
66
67$search_ref = GETPOST("search_ref", "alpha");
68$search_date_startday = GETPOSTINT('search_date_startday');
69$search_date_startmonth = GETPOSTINT('search_date_startmonth');
70$search_date_startyear = GETPOSTINT('search_date_startyear');
71$search_date_endday = GETPOSTINT('search_date_endday');
72$search_date_endmonth = GETPOSTINT('search_date_endmonth');
73$search_date_endyear = GETPOSTINT('search_date_endyear');
74$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
75$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
76$search_company = GETPOST("search_company", 'alpha');
77$search_paymenttype = GETPOST("search_paymenttype");
78$search_account = GETPOST("search_account", 'alpha');
79$search_payment_num = GETPOST('search_payment_num', 'alpha');
80$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
81$search_noteprivate = GETPOST("search_noteprivate");
82$search_status = GETPOST('search_status', 'intcomma');
83$search_sale = GETPOSTINT('search_sale');
84
85
86$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
87$sortfield = GETPOST('sortfield', 'aZ09comma');
88$sortorder = GETPOST('sortorder', 'aZ09comma');
89$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
90
91if (empty($page) || $page == -1) {
92 $page = 0; // If $page is not defined, or '' or -1
93}
94$offset = $limit * $page;
95$pageprev = $page - 1;
96$pagenext = $page + 1;
97
98if (!$sortorder) {
99 $sortorder = "DESC";
100}
101if (!$sortfield) {
102 $sortfield = "p.ref";
103}
104
105$search_all = trim(GETPOST('search_all', 'alphanohtml'));
106
107$arrayofselected = !empty($arrayofselected) && is_array($arrayofselected) ? $arrayofselected : array();
108
109// List of fields to search into when doing a "search in all"
110$fieldstosearchall = array(
111 'p.ref' => "RefPayment",
112 's.nom' => "ThirdParty",
113 'p.num_paiement' => "Numero",
114 'p.amount' => "Amount",
115);
116
117$arrayfields = array(
118 'p.ref' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10),
119 'p.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20),
120 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30),
121 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40),
122 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 50, 'enabled' => (string) (int) (isModEnabled("bank"))),
123 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))),
124 'p.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 70, 'tooltip' => "ChequeOrTransferNumber"),
125 'p.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80),
126 'p.note' => array('label' => "Comment", 'checked' => '-1', 'position' => 85),
127 'p.ext_payment_id' => array('label' => "ExtPaymentID", 'checked' => '-1', 'position' => 87),
128 'p.ext_payment_site' => array('label' => "ExtPaymentSite", 'checked' => '-1', 'position' => 88),
129 'p.tms' => array('label' => "DateModification", 'checked' => '-1', 'position' => 150),
130 'p.statut' => array('label' => "Status", 'checked' => '1', 'position' => 200, 'enabled' => (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))),
131);
132$arrayfields = dol_sort_array($arrayfields, 'position');
133
134// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
135$hookmanager->initHooks(array('paymentlist'));
136$object = new Paiement($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// Add table from hooks
314$parameters = array();
315$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
316$sql .= $hookmanager->resPrint;
317
318$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
319if ($socid > 0) {
320 $sql .= " AND EXISTS (SELECT f.fk_soc FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf";
321 $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_soc = ".((int) $socid).")";
322}
323if ($userid) {
324 if ($userid == -1) {
325 $sql .= " AND p.fk_user_creat IS NULL";
326 } else {
327 $sql .= " AND p.fk_user_creat = ".((int) $userid);
328 }
329}
330
331// Search criteria
332if ($search_ref) {
333 $sql .= natural_search('p.ref', $search_ref);
334}
335if ($search_date_start) {
336 $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
337}
338if ($search_date_end) {
339 $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
340}
341if ($search_account > 0) {
342 $sql .= " AND b.fk_account = ".((int) $search_account);
343} elseif ($search_account == -2) {
344 $sql .= " AND (b.fk_account = 0 OR b.fk_account IS NULL)";
345}
346if ($search_paymenttype != '') {
347 $sql .= " AND c.code = '".$db->escape($search_paymenttype)."'";
348}
349if ($search_payment_num != '') {
350 $sql .= natural_search('p.num_paiement', $search_payment_num);
351}
352if ($search_amount) {
353 $sql .= " AND (".natural_search('p.amount', $search_amount, 1, 1);
354 $sql .= " OR ";
355 $sql .= natural_search('pf.amount', $search_amount, 1, 1);
356 $sql .= ")";
357}
358if ($search_company) {
359 $sql .= natural_search('s.nom', $search_company);
360}
361if ($search_noteprivate) {
362 $sql .= natural_search('p.note', $search_noteprivate);
363}
364// Search on sale representative
365if ($search_sale && $search_sale != -1) {
366 if ($search_sale == -2) {
367 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
368 } elseif ($search_sale > 0) {
369 $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).")";
370 }
371}
372
373if ($search_all) {
374 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
375}
376// Add where from extra fields
377include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
378
379// Add where from hooks
380$parameters = array();
381$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
382$sql .= $hookmanager->resPrint;
383
384$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";
385$sql .= ", c.code";
386$sql .= ", ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.fk_accountancy_journal";
387$sql .= ", s.rowid, s.nom, s.email";
388
389// Overwrite for a debug use case
390if (GETPOST("orphelins", "alpha")) {
391 // Payments not linked to an invoice. Should not happen. For debug only.
392 $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";
393 $sql .= ", c.code as paiement_code";
394
395 $sqlfields = $sql; // $sql fields to remove for count total
396
397 // Add fields from hooks
398 $parameters = array();
399 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
400 $sql .= $hookmanager->resPrint;
401 $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
402 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
403
404 // Add table from hooks
405 $parameters = array();
406 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
407 $sql .= $hookmanager->resPrint;
408
409 $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
410 $sql .= " AND pf.fk_facture IS NULL";
411
412 // Add where from hooks
413 $parameters = array();
414 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
415 $sql .= $hookmanager->resPrint;
416}
417
418
419// Count total nb of records
420$nbtotalofrecords = '';
421if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
422 /* The fast and low memory method to get and count full list converts the sql into a sql count */
423 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT p.rowid) as nbtotalofrecords', $sql);
424 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
425 $resql = $db->query($sqlforcount);
426 if ($resql) {
427 $objforcount = $db->fetch_object($resql);
428 $nbtotalofrecords = $objforcount->nbtotalofrecords;
429 } else {
431 }
432
433 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
434 $page = 0;
435 $offset = 0;
436 }
437 $db->free($resql);
438}
439
440// Complete request and execute it with limit
441$sql .= $db->order($sortfield, $sortorder);
442if ($limit) {
443 $sql .= $db->plimit($limit + 1, $offset);
444}
445//print $sql;
446
447$resql = $db->query($sql);
448if (!$resql) {
450 llxFooter();
451 $db->close();
452 exit;
453}
454
455$num = $db->num_rows($resql);
456
457
458// Output page
459// --------------------------------------------------------------------
460
461$arrayofselected = is_array($toselect) ? $toselect : array();
462
463$param = '';
464if (!empty($mode)) {
465 $param .= '&mode='.urlencode($mode);
466}
467if (!empty($contextpage) && $contextpage != getDolDefaultContextPage(__FILE__)) {
468 $param .= '&contextpage='.urlencode($contextpage);
469}
470if ($limit > 0 && $limit != $conf->liste_limit) {
471 $param .= '&limit='.((int) $limit);
472}
473if ($optioncss != '') {
474 $param .= '&optioncss='.urlencode($optioncss);
475}
476
477if (GETPOST("orphelins")) {
478 $param .= '&orphelins=1';
479}
480if ($search_ref) {
481 $param .= '&search_ref='.urlencode($search_ref);
482}
483if ($search_date_startday) {
484 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
485}
486if ($search_date_startmonth) {
487 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
488}
489if ($search_date_startyear) {
490 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
491}
492if ($search_date_endday) {
493 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
494}
495if ($search_date_endmonth) {
496 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
497}
498if ($search_date_endyear) {
499 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
500}
501if ($search_company) {
502 $param .= '&search_company='.urlencode($search_company);
503}
504if ($search_amount != '') {
505 $param .= '&search_amount='.urlencode($search_amount);
506}
507if ($search_paymenttype) {
508 $param .= '&search_paymenttype='.urlencode($search_paymenttype);
509}
510if ($search_account) {
511 $param .= '&search_account='.urlencode((string) ($search_account));
512}
513if ($search_payment_num) {
514 $param .= '&search_payment_num='.urlencode($search_payment_num);
515}
516if ($search_noteprivate) {
517 $param .= '&search_noteprivate='.urlencode($search_noteprivate);
518}
519// Add $param from extra fields
520include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
521// Add $param from hooks
522$parameters = array('param' => &$param);
523$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
524$param .= $hookmanager->resPrint;
525
526// List of mass actions available
527$arrayofmassactions = array(
528 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
529 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
530 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
531 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
532);
533if (!empty($permissiontopay) && getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK')) {
534 $arrayofmassactions['createbankpayment'] = img_picto('', 'bank', 'class="pictofixedwidth"').$langs->trans("FixLinkToBank");
535}
536if (!empty($permissiontodelete)) {
537 //$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
538}
539if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'createbankpayment'))) {
540 $arrayofmassactions = array();
541}
542$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
543
544print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
545if ($optioncss != '') {
546 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
547}
548print '<input type="hidden" name="token" value="'.newToken().'">';
549print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
550print '<input type="hidden" name="action" value="list">';
551print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
552print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
553print '<input type="hidden" name="page" value="'.$page.'">';
554print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
555print '<input type="hidden" name="page_y" value="">';
556print '<input type="hidden" name="mode" value="'.$mode.'">';
557
558// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
559print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
560
561
562if ($massaction == 'createbankpayment') {
563 $formquestion = array();
564
565 $valuefield = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
566 $valuefield .= img_picto('', 'bank', 'class="pictofixedwidth"');
567 $valuefield .= $form->select_comptes(0, 'accountid', 0, '', 2, '', 0, '', 1);
568 $valuefield .= '</div>';
569
570 $formquestion[] = array(
571 'type' => 'other',
572 'name' => 'bakaccount',
573 'label' => $langs->trans("BankAccount"),
574 'value' => $valuefield
575 );
576
577 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ToCreateRelatedRecordIntoBank"), $langs->trans("Confirm"), "createbankpayment", $formquestion, 1, 0, 200, 500, 1);
578}
579
580
581if ($search_all) {
582 $setupstring = '';
583 // @phan-suppress-next-line PhanEmptyForeach
584 foreach ($fieldstosearchall as $key => $val) {
585 $fieldstosearchall[$key] = $langs->trans($val);
586 $setupstring .= $key."=".$val.";";
587 }
588 print '<!-- Search done like if PAYMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
589 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
590}
591
592$moreforfilter = '';
593
594$parameters = array();
595$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
596if (empty($reshook)) {
597 $moreforfilter .= $hookmanager->resPrint;
598} else {
599 $moreforfilter = $hookmanager->resPrint;
600}
601$parameters = array(
602 'arrayfields' => &$arrayfields,
603);
604
605if (!empty($moreforfilter)) {
606 print '<div class="liste_titre liste_titre_bydiv centpercent">';
607 print $moreforfilter;
608 print '</div>';
609}
610
611$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
612$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
613$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
614$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
615
616print '<div class="div-table-responsive">';
617print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">'."\n";
618
619// Fields title search
620// --------------------------------------------------------------------
621print '<tr class="liste_titre_filter">';
622
623// Action column
624if ($conf->main_checkbox_left_column) {
625 print '<td class="liste_titre center maxwidthsearch">';
626 $searchpicto = $form->showFilterButtons('left');
627 print $searchpicto;
628 print '</td>';
629}
630
631// #
632if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
633 print '<td class="liste_titre">';
634 print '</td>';
635}
636
637// Filter: Ref
638if (!empty($arrayfields['p.ref']['checked'])) {
639 print '<td class="liste_titre left">';
640 print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
641 print '</td>';
642}
643
644// Filter: Date
645if (!empty($arrayfields['p.datep']['checked'])) {
646 print '<td class="liste_titre center">';
647 print '<div class="nowrapfordate">';
648 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
649 print '</div>';
650 print '<div class="nowrapfordate">';
651 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
652 print '</div>';
653 print '</td>';
654}
655
656// Filter: Thirdparty
657if (!empty($arrayfields['s.nom']['checked'])) {
658 print '<td class="liste_titre">';
659 print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
660 print '</td>';
661}
662
663// Filter: Payment type
664if (!empty($arrayfields['c.libelle']['checked'])) {
665 print '<td class="liste_titre">';
666 print $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
667 print '</td>';
668}
669
670// Filter: Bank transaction number
671if (!empty($arrayfields['transaction']['checked'])) {
672 print '<td class="liste_titre">';
673 print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
674 print '</td>';
675}
676
677// Filter: Cheque number (fund transfer)
678if (!empty($arrayfields['p.num_paiement']['checked'])) {
679 print '<td class="liste_titre">';
680 print '</td>';
681}
682
683// Filter: Bank account
684if (!empty($arrayfields['ba.label']['checked'])) {
685 print '<td class="liste_titre">';
686 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1, getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK') ? 1 : 0);
687 print '</td>';
688}
689
690// Filter: Amount
691if (!empty($arrayfields['p.amount']['checked'])) {
692 print '<td class="liste_titre right">';
693 print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
694 print '</td>';
695}
696
697// Filter: Note
698if (!empty($arrayfields['p.note']['checked'])) {
699 print '<td class="liste_titre">';
700 print '<input class="flat maxwidth150" type="text" name="search_noteprivate" value="'.dol_escape_htmltag($search_noteprivate).'">';
701 print '</td>';
702}
703
704// Filter: ext_payment_id
705if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
706 print '<td class="liste_titre">';
707 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_id" value="'.dol_escape_htmltag($search_ext_payment_id).'">';
708 print '</td>';
709}
710
711// Filter: ext_payment_site
712if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
713 print '<td class="liste_titre">';
714 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
715 print '</td>';
716}
717
718// Filter: ext_payment_site
719if (!empty($arrayfields['p.tms']['checked'])) {
720 print '<td class="liste_titre">';
721 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
722 print '</td>';
723}
724
725// Filter: Status (only placeholder)
726if (!empty($arrayfields['p.statut']['checked'])) {
727 print '<td class="liste_titre right">';
728 print '</td>';
729}
730
731// Extra fields
732include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
733
734// Fields from hook
735$parameters = array('arrayfields' => $arrayfields);
736$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
737print $hookmanager->resPrint;
738
739// Action column
740if (!$conf->main_checkbox_left_column) {
741 print '<td class="liste_titre center maxwidthsearch">';
742 $searchpicto = $form->showFilterButtons();
743 print $searchpicto;
744 print '</td>';
745}
746
747print '</tr>'."\n";
748
749$totalarray = array();
750$totalarray['nbfield'] = 0;
751
752// Fields title label
753// --------------------------------------------------------------------
754print '<tr class="liste_titre">';
755// Action column
756if ($conf->main_checkbox_left_column) {
757 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
758 $totalarray['nbfield']++;
759}
760if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
761 print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
762 $totalarray['nbfield']++;
763}
764if (!empty($arrayfields['p.ref']['checked'])) {
765 // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
766 print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
767 $totalarray['nbfield']++;
768}
769if (!empty($arrayfields['p.datep']['checked'])) {
770 print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center ');
771 $totalarray['nbfield']++;
772}
773if (!empty($arrayfields['s.nom']['checked'])) {
774 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
775 $totalarray['nbfield']++;
776}
777if (!empty($arrayfields['c.libelle']['checked'])) {
778 print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder);
779 $totalarray['nbfield']++;
780}
781if (!empty($arrayfields['p.num_paiement']['checked'])) {
782 print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
783 $totalarray['nbfield']++;
784}
785if (!empty($arrayfields['transaction']['checked'])) {
786 print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
787 $totalarray['nbfield']++;
788}
789if (!empty($arrayfields['ba.label']['checked'])) {
790 print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
791 $totalarray['nbfield']++;
792}
793if (!empty($arrayfields['p.amount']['checked'])) {
794 print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder);
795 $totalarray['nbfield']++;
796}
797if (!empty($arrayfields['p.note']['checked'])) {
798 print_liste_field_titre($arrayfields['p.note']['label'], $_SERVER["PHP_SELF"], "p.note", '', $param, '', $sortfield, $sortorder);
799 $totalarray['nbfield']++;
800}
801if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
802 print_liste_field_titre($arrayfields['p.ext_payment_id']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_id", '', $param, '', $sortfield, $sortorder);
803 $totalarray['nbfield']++;
804}
805if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
806 print_liste_field_titre($arrayfields['p.ext_payment_site']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_site", '', $param, '', $sortfield, $sortorder);
807 $totalarray['nbfield']++;
808}
809if (!empty($arrayfields['p.tms']['checked'])) {
810 print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", '', $param, '', $sortfield, $sortorder);
811 $totalarray['nbfield']++;
812}
813if (!empty($arrayfields['p.statut']['checked'])) {
814 print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder);
815 $totalarray['nbfield']++;
816}
817// Extra fields
818include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
819// Hook fields
820$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
821$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
822print $hookmanager->resPrint;
823// Action column
824if (!$conf->main_checkbox_left_column) {
825 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
826 $totalarray['nbfield']++;
827}
828
829print '</tr>'."\n";
830
831// Detect if we need a fetch on each output line
832$needToFetchEachLine = 0;
833if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
834 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
835 if (!is_null($val) && preg_match('/\$object/', $val)) {
836 $needToFetchEachLine++; // There is at least one compute field that use $object
837 }
838 }
839}
840
841
842// Loop on record
843// --------------------------------------------------------------------
844$i = 0;
845$savnbfield = $totalarray['nbfield'];
846$totalarray = array();
847$totalarray['nbfield'] = 0;
848$imaxinloop = ($limit ? min($num, $limit) : $num);
849while ($i < $imaxinloop) {
850 $obj = $db->fetch_object($resql);
851 if (empty($obj)) {
852 break; // Should not happen
853 }
854
855 $object->id = $obj->rowid;
856 $object->ref = ($obj->ref ? $obj->ref : $obj->rowid);
857 $object->date = $db->jdate($obj->datep);
858 $object->amount = $obj->amount;
859 $object->note_private = $obj->note_private;
860
861 $companystatic->id = $obj->socid;
862 $companystatic->name = $obj->name;
863 $companystatic->email = $obj->email;
864
865 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
866 if ($i == 0) {
867 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
868 print '<div class="box-flex-container kanban">';
869 }
870 // Output Kanban
871 $selected = -1;
872 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
873 $selected = 0;
874 if (in_array($object->id, $arrayofselected)) {
875 $selected = 1;
876 }
877 }
878 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
879 print $object->getKanbanView('', array('selected' => $selected));
880 if ($i == ($imaxinloop - 1)) {
881 print '</div>';
882 print '</td></tr>';
883 }
884 } else {
885 // Show line of result
886 $j = 0;
887 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
888
889 // Action column
890 if ($conf->main_checkbox_left_column) {
891 print '<td class="nowrap center">';
892 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
893 $selected = 0;
894 if (in_array($object->id, $arrayofselected)) {
895 $selected = 1;
896 }
897 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
898 }
899 print '</td>';
900 if (!$i) {
901 $totalarray['nbfield']++;
902 }
903 }
904
905 // No
906 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
907 print '<td class="nowraponall">'.(($offset * $limit) + $i).'</td>';
908 if (!$i) {
909 $totalarray['nbfield']++;
910 }
911 }
912
913 // Ref
914 if (!empty($arrayfields['p.ref']['checked'])) {
915 print '<td class="nowraponall">'.$object->getNomUrl(1).'</td>';
916 if (!$i) {
917 $totalarray['nbfield']++;
918 }
919 }
920
921 // Date
922 if (!empty($arrayfields['p.datep']['checked'])) {
923 $dateformatforpayment = 'dayhour';
924 print '<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datep), $dateformatforpayment, 'tzuser').'</td>';
925 if (!$i) {
926 $totalarray['nbfield']++;
927 }
928 }
929
930 // Thirdparty
931 if (!empty($arrayfields['s.nom']['checked'])) {
932 print '<td class="tdoverflowmax125">';
933 if ($obj->socid > 0) {
934 print $companystatic->getNomUrl(1, '', 24);
935 }
936 print '</td>';
937 if (!$i) {
938 $totalarray['nbfield']++;
939 }
940 }
941
942 // Payment type
943 if (!empty($arrayfields['c.libelle']['checked'])) {
944 print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForAttribute($langs->trans("PaymentTypeShort".$obj->paiement_code)).'">'.dolPrintHTML($langs->trans("PaymentTypeShort".$obj->paiement_code)).'</td>';
945 if (!$i) {
946 $totalarray['nbfield']++;
947 }
948 }
949
950 // Filter: Cheque number (fund transfer)
951 if (!empty($arrayfields['p.num_paiement']['checked'])) {
952 print '<td>'.$obj->num_payment.'</td>';
953 if (!$i) {
954 $totalarray['nbfield']++;
955 }
956 }
957
958 // Bank transaction
959 if (!empty($arrayfields['transaction']['checked'])) {
960 print '<td class="tdoverflowmax125">';
961 if ($obj->fk_bank > 0) {
962 $bankline->fetch($obj->fk_bank);
963 print $bankline->getNomUrl(1, 0);
964 }
965 print '</td>';
966 if (!$i) {
967 $totalarray['nbfield']++;
968 }
969 }
970
971 // Bank account
972 if (!empty($arrayfields['ba.label']['checked'])) {
973 print '<td>';
974 if ($obj->bid > 0) {
975 $accountstatic->id = $obj->bid;
976 $accountstatic->ref = $obj->bref;
977 $accountstatic->label = $obj->blabel;
978 $accountstatic->number = $obj->number;
979 $accountstatic->account_number = $obj->account_number;
980
981 $accountingjournal = new AccountingJournal($db);
982 $accountingjournal->fetch($obj->accountancy_journal);
983 $accountstatic->accountancy_journal = $accountingjournal->code;
984
985 print $accountstatic->getNomUrl(1);
986 }
987 print '</td>';
988 if (!$i) {
989 $totalarray['nbfield']++;
990 }
991 }
992
993 // Amount
994 if (!empty($arrayfields['p.amount']['checked'])) {
995 print '<td class="right">';
996 if ($obj->nbinvoices > 1 || ($obj->totalamount && $obj->amount != $obj->totalamount)) {
997 print $form->textwithpicto('', $langs->trans("PaymentMadeForSeveralInvoices"));
998 }
999 print '<span class="amount">'.price($obj->amount).'</span>';
1000 print '</td>';
1001 if (!$i) {
1002 $totalarray['nbfield']++;
1003 $totalarray['pos'][$totalarray['nbfield']] = 'amount';
1004 }
1005 if (empty($totalarray['val']['amount'])) {
1006 $totalarray['val']['amount'] = $obj->amount;
1007 } else {
1008 $totalarray['val']['amount'] += $obj->amount;
1009 }
1010 }
1011
1012 // Note
1013 if (!empty($arrayfields['p.note']['checked'])) {
1014 $firstline = dolGetFirstLineOfText($obj->note_private, 1);
1015 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($firstline).'">';
1016 print dolPrintHTML($firstline).'</span>';
1017 print '</td>';
1018 if (!$i) {
1019 $totalarray['nbfield']++;
1020 }
1021 }
1022
1023 // ext_payment_id
1024 if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
1025 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_id).'">';
1026 print dolPrintHTML($obj->ext_payment_id).'</span>';
1027 print '</td>';
1028 if (!$i) {
1029 $totalarray['nbfield']++;
1030 }
1031 }
1032
1033 // ext_payment_site
1034 if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
1035 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_site).'">';
1036 print dolPrintHTML($obj->ext_payment_site).'</span>';
1037 print '</td>';
1038 if (!$i) {
1039 $totalarray['nbfield']++;
1040 }
1041 }
1042
1043 // Date last change
1044 if (!empty($arrayfields['p.tms']['checked'])) {
1045 print '<td class="tdoverflowmax200">';
1046 print dol_print_date($obj->tms, 'dayhour', 'tzuserrel').'</span>';
1047 print '</td>';
1048 if (!$i) {
1049 $totalarray['nbfield']++;
1050 }
1051 }
1052
1053 // Extra fields
1054 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1055
1056 // Status
1057 if (!empty($arrayfields['p.statut']['checked'])) {
1058 print '<td class="right">';
1059 if ($obj->statut == 0) {
1060 print '<a href="card.php?id='.$obj->rowid.'&amp;action=valide">';
1061 }
1062 print $object->LibStatut($obj->statut, 5);
1063 if ($obj->statut == 0) {
1064 print '</a>';
1065 }
1066 print '</td>';
1067 if (!$i) {
1068 $totalarray['nbfield']++;
1069 }
1070 }
1071
1072 // Fields from hook
1073 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1074 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1075 print $hookmanager->resPrint;
1076
1077 // Action column
1078 if (!$conf->main_checkbox_left_column) {
1079 print '<td class="nowrap center">';
1080 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1081 $selected = 0;
1082 if (in_array($object->id, $arrayofselected)) {
1083 $selected = 1;
1084 }
1085 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1086 }
1087 print '</td>';
1088 if (!$i) {
1089 $totalarray['nbfield']++;
1090 }
1091 }
1092
1093 print '</tr>'."\n";
1094 }
1095
1096 $i++;
1097}
1098
1099// Show total line
1100include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1101
1102// If no record found
1103if ($num == 0) {
1104 $colspan = 1;
1105 foreach ($arrayfields as $key => $val) {
1106 if (!empty($val['checked'])) {
1107 $colspan++;
1108 }
1109 }
1110 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1111}
1112
1113$db->free($resql);
1114
1115$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1116$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1117print $hookmanager->resPrint;
1118
1119print '</table>'."\n";
1120print '</div>'."\n";
1121
1122print '</form>'."\n";
1123
1124// End of page
1125llxFooter();
1126$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:497
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.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class to manage payments of customer invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
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.
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.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.