dolibarr 24.0.1
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// Add hook to complete $arrayfield
145$parameters = array('arrayfields' => &$arrayfields);
146$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
147
148if (!$user->hasRight('societe', 'client', 'voir')) {
149 $search_sale = $user->id;
150}
151
152// Security check
153if ($user->socid) {
154 $socid = $user->socid;
155}
156$result = restrictedArea($user, 'facture', $facid, '');
157
158$permissiontopay = $user->hasRight('facture', 'paiement');
159$permissiontodelete = $user->hasRight('facture', 'delete');
160
161$error = 0;
162
163
164/*
165 * Actions
166 */
167
168if (GETPOST('cancel', 'alpha')) {
169 $action = 'list';
170 $massaction = '';
171}
172if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
173 $massaction = '';
174}
175
176$parameters = array('arrayfields' => &$arrayfields, 'socid' => $socid);
177$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
178if ($reshook < 0) {
179 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
180}
181
182
183if (empty($reshook)) {
184 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
185
186 // All tests are required to be compatible with all browsers
187 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
188 $search_ref = '';
189 $search_date_startday = '';
190 $search_date_startmonth = '';
191 $search_date_startyear = '';
192 $search_date_endday = '';
193 $search_date_endmonth = '';
194 $search_date_endyear = '';
195 $search_date_start = '';
196 $search_date_end = '';
197 $search_account = '';
198 $search_amount = '';
199 $search_paymenttype = '';
200 $search_payment_num = '';
201 $search_company = '';
202 $search_noteprivate = '';
203 $search_status = '';
204 $option = '';
205 $toselect = array();
206 $search_array_options = array();
207 }
208 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
209 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
210 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
211 }
212
213 // Mass actions
214 $objectclass = 'Paiement';
215 $objectlabel = 'Payment';
216 $uploaddir = $conf->invoice->dir_output.'/payments';
217
218 global $error;
219 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
220
221 if ($action === 'createbankpayment' && $permissiontopay && $confirm == 'yes') {
222 $db->begin();
223
224 foreach ($toselect as $toselectid) {
225 // Create the record into bank for the amount of payment $object
226 if (!$error) {
227 $label = '(CustomerInvoicePayment)';
228 if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
229 $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
230 }
231
232 $bankaccountid = GETPOSTINT('accountid');
233 if ($bankaccountid > 0) {
234 $object->fetch($toselectid);
235
236 if (((int) $object->fk_account) != 0) {
237 setEventMessages('Error, at least one payment is already linked to a bank account', null, 'errors');
238 $error++;
239 break;
240 }
241
242 $object->paiementcode = $object->type_code;
243 $object->amounts = $object->getAmountsArray();
244
245 $result = $object->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
246 if ($result < 0) {
247 setEventMessages($object->error, $object->errors, 'errors');
248 $error++;
249 }
250 } else {
251 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
252 $error++;
253 }
254 }
255 }
256
257 if (!$error) {
258 $db->commit();
259 } else {
260 $db->rollback();
261 }
262 }
263}
264
265
266/*
267 * View
268 */
269
270$form = new Form($db);
271$formother = new FormOther($db);
272$accountstatic = new Account($db);
273$companystatic = new Societe($db);
274$bankline = new AccountLine($db);
275
276$title = $langs->trans('ListPayment');
277
278llxHeader('', $title, '', '', 0, 0, '', '', '', 'bodyforlist');
279
280
281$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,";
282$sql .= " p.ext_payment_id, p.ext_payment_site,";
283$sql .= " p.tms,";
284$sql .= " c.code as paiement_code,";
285$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,";
286$sql .= " s.rowid as socid, s.nom as name, s.email,";
287// 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)
288// so SUM(pf.amount) should be equal to p.amount but if we filter on $socid, it may differ
289$sql .= " SUM(pf.amount) as totalamount, COUNT(f.rowid) as nbinvoices";
290// Add fields from extrafields
291if (!empty($extrafields->attributes[$object->table_element]['label'])) {
292 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
293 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
294 }
295}
296// Add fields from hooks
297$parameters = array();
298$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
299$sql .= $hookmanager->resPrint;
300$sql = preg_replace('/,\s*$/', '', $sql);
301
302$sqlfields = $sql; // $sql fields to remove for count total
303
304$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
305if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
306 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
307}
308$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
309$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
310$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
311
312$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
313$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
314$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
315
316// Add table from hooks
317$parameters = array();
318$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
319$sql .= $hookmanager->resPrint;
320
321$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
322if ($socid > 0) {
323 $sql .= " AND EXISTS (SELECT f.fk_soc FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf";
324 $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_soc = ".((int) $socid).")";
325}
326if ($userid) {
327 if ($userid == -1) {
328 $sql .= " AND p.fk_user_creat IS NULL";
329 } else {
330 $sql .= " AND p.fk_user_creat = ".((int) $userid);
331 }
332}
333
334// Search criteria
335if ($search_ref) {
336 $sql .= natural_search('p.ref', $search_ref);
337}
338if ($search_date_start) {
339 $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
340}
341if ($search_date_end) {
342 $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
343}
344if ($search_account > 0) {
345 $sql .= " AND b.fk_account = ".((int) $search_account);
346} elseif ($search_account == -2) {
347 $sql .= " AND (b.fk_account = 0 OR b.fk_account IS NULL)";
348}
349if ($search_paymenttype != '') {
350 $sql .= " AND c.code = '".$db->escape($search_paymenttype)."'";
351}
352if ($search_payment_num != '') {
353 $sql .= natural_search('p.num_paiement', $search_payment_num);
354}
355if ($search_amount) {
356 $sql .= " AND (".natural_search('p.amount', $search_amount, 1, 1);
357 $sql .= " OR ";
358 $sql .= natural_search('pf.amount', $search_amount, 1, 1);
359 $sql .= ")";
360}
361if ($search_company) {
362 $sql .= natural_search('s.nom', $search_company);
363}
364if ($search_noteprivate) {
365 $sql .= natural_search('p.note', $search_noteprivate);
366}
367// Search on sale representative
368if ($search_sale && $search_sale != -1) {
369 if ($search_sale == -2) {
370 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
371 } elseif ($search_sale > 0) {
372 $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).")";
373 }
374}
375
376if ($search_all) {
377 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
378}
379// Add where from extra fields
380include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
381
382// Add where from hooks
383$parameters = array();
384$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
385$sql .= $hookmanager->resPrint;
386
387$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";
388$sql .= ", c.code";
389$sql .= ", ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.fk_accountancy_journal";
390$sql .= ", s.rowid, s.nom, s.email";
391
392// Overwrite for a debug use case
393if (GETPOST("orphelins", "alpha")) {
394 // Payments not linked to an invoice. Should not happen. For debug only.
395 $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";
396 $sql .= ", c.code as paiement_code";
397
398 $sqlfields = $sql; // $sql fields to remove for count total
399
400 // Add fields from hooks
401 $parameters = array();
402 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
403 $sql .= $hookmanager->resPrint;
404 $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
405 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
406
407 // Add table from hooks
408 $parameters = array();
409 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
410 $sql .= $hookmanager->resPrint;
411
412 $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
413 $sql .= " AND pf.fk_facture IS NULL";
414
415 // Add where from hooks
416 $parameters = array();
417 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
418 $sql .= $hookmanager->resPrint;
419}
420
421
422// Count total nb of records
423$nbtotalofrecords = '';
424if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
425 /* The fast and low memory method to get and count full list converts the sql into a sql count */
426 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT p.rowid) as nbtotalofrecords', $sql);
427 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
428 $resql = $db->query($sqlforcount);
429 if ($resql) {
430 $objforcount = $db->fetch_object($resql);
431 $nbtotalofrecords = $objforcount->nbtotalofrecords;
432 } else {
434 }
435
436 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
437 $page = 0;
438 $offset = 0;
439 }
440 $db->free($resql);
441}
442
443// Complete request and execute it with limit
444$sql .= $db->order($sortfield, $sortorder);
445if ($limit) {
446 $sql .= $db->plimit($limit + 1, $offset);
447}
448//print $sql;
449
450$resql = $db->query($sql);
451if (!$resql) {
453 llxFooter();
454 $db->close();
455 exit;
456}
457
458$num = $db->num_rows($resql);
459
460
461// Output page
462// --------------------------------------------------------------------
463
464$arrayofselected = is_array($toselect) ? $toselect : array();
465
466$param = '';
467if (!empty($mode)) {
468 $param .= '&mode='.urlencode($mode);
469}
470if (!empty($contextpage) && $contextpage != getDolDefaultContextPage(__FILE__)) {
471 $param .= '&contextpage='.urlencode($contextpage);
472}
473if ($limit > 0 && $limit != $conf->liste_limit) {
474 $param .= '&limit='.((int) $limit);
475}
476if ($optioncss != '') {
477 $param .= '&optioncss='.urlencode($optioncss);
478}
479
480if (GETPOST("orphelins")) {
481 $param .= '&orphelins=1';
482}
483if ($search_ref) {
484 $param .= '&search_ref='.urlencode($search_ref);
485}
486if ($search_date_startday) {
487 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
488}
489if ($search_date_startmonth) {
490 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
491}
492if ($search_date_startyear) {
493 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
494}
495if ($search_date_endday) {
496 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
497}
498if ($search_date_endmonth) {
499 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
500}
501if ($search_date_endyear) {
502 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
503}
504if ($search_company) {
505 $param .= '&search_company='.urlencode($search_company);
506}
507if ($search_amount != '') {
508 $param .= '&search_amount='.urlencode($search_amount);
509}
510if ($search_paymenttype) {
511 $param .= '&search_paymenttype='.urlencode($search_paymenttype);
512}
513if ($search_account) {
514 $param .= '&search_account='.urlencode((string) ($search_account));
515}
516if ($search_payment_num) {
517 $param .= '&search_payment_num='.urlencode($search_payment_num);
518}
519if ($search_noteprivate) {
520 $param .= '&search_noteprivate='.urlencode($search_noteprivate);
521}
522// Add $param from extra fields
523include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
524// Add $param from hooks
525$parameters = array('param' => &$param);
526$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
527$param .= $hookmanager->resPrint;
528
529// List of mass actions available
530$arrayofmassactions = array(
531 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
532 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
533 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
534 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
535);
536if (!empty($permissiontopay) && getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK')) {
537 $arrayofmassactions['createbankpayment'] = img_picto('', 'bank', 'class="pictofixedwidth"').$langs->trans("FixLinkToBank");
538}
539if (!empty($permissiontodelete)) {
540 //$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
541}
542if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'createbankpayment'))) {
543 $arrayofmassactions = array();
544}
545$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
546
547print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
548if ($optioncss != '') {
549 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
550}
551print '<input type="hidden" name="token" value="'.newToken().'">';
552print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
553print '<input type="hidden" name="action" value="list">';
554print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
555print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
556print '<input type="hidden" name="page" value="'.$page.'">';
557print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
558print '<input type="hidden" name="page_y" value="">';
559print '<input type="hidden" name="mode" value="'.$mode.'">';
560
561// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
562print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
563
564
565if ($massaction == 'createbankpayment') {
566 $formquestion = array();
567
568 $valuefield = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
569 $valuefield .= img_picto('', 'bank', 'class="pictofixedwidth"');
570 $valuefield .= $form->select_comptes(0, 'accountid', 0, '', 2, '', 0, '', 1);
571 $valuefield .= '</div>';
572
573 $formquestion[] = array(
574 'type' => 'other',
575 'name' => 'bakaccount',
576 'label' => $langs->trans("BankAccount"),
577 'value' => $valuefield
578 );
579
580 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ToCreateRelatedRecordIntoBank"), $langs->trans("Confirm"), "createbankpayment", $formquestion, 1, 0, 200, 500, 1);
581}
582
583
584if ($search_all) {
585 $setupstring = '';
586 // @phan-suppress-next-line PhanEmptyForeach
587 foreach ($fieldstosearchall as $key => $val) {
588 $fieldstosearchall[$key] = $langs->trans($val);
589 $setupstring .= $key."=".$val.";";
590 }
591 print '<!-- Search done like if PAYMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
592 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
593}
594
595$moreforfilter = '';
596
597$parameters = array();
598$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
599if (empty($reshook)) {
600 $moreforfilter .= $hookmanager->resPrint;
601} else {
602 $moreforfilter = $hookmanager->resPrint;
603}
604$parameters = array(
605 'arrayfields' => &$arrayfields,
606);
607
608if (!empty($moreforfilter)) {
609 print '<div class="liste_titre liste_titre_bydiv centpercent">';
610 print $moreforfilter;
611 print '</div>';
612}
613
614$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
615$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
616$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
617$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
618
619print '<div class="div-table-responsive">';
620print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">'."\n";
621
622// Fields title search
623// --------------------------------------------------------------------
624print '<tr class="liste_titre_filter">';
625
626// Action column
627if ($conf->main_checkbox_left_column) {
628 print '<td class="liste_titre center maxwidthsearch">';
629 $searchpicto = $form->showFilterButtons('left');
630 print $searchpicto;
631 print '</td>';
632}
633
634// #
635if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
636 print '<td class="liste_titre">';
637 print '</td>';
638}
639
640// Filter: Ref
641if (!empty($arrayfields['p.ref']['checked'])) {
642 print '<td class="liste_titre left">';
643 print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
644 print '</td>';
645}
646
647// Filter: Date
648if (!empty($arrayfields['p.datep']['checked'])) {
649 print '<td class="liste_titre center">';
650 print '<div class="nowrapfordate">';
651 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
652 print '</div>';
653 print '<div class="nowrapfordate">';
654 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
655 print '</div>';
656 print '</td>';
657}
658
659// Filter: Thirdparty
660if (!empty($arrayfields['s.nom']['checked'])) {
661 print '<td class="liste_titre">';
662 print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
663 print '</td>';
664}
665
666// Filter: Payment type
667if (!empty($arrayfields['c.libelle']['checked'])) {
668 print '<td class="liste_titre">';
669 print $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
670 print '</td>';
671}
672
673// Filter: Bank transaction number
674if (!empty($arrayfields['transaction']['checked'])) {
675 print '<td class="liste_titre">';
676 print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
677 print '</td>';
678}
679
680// Filter: Cheque number (fund transfer)
681if (!empty($arrayfields['p.num_paiement']['checked'])) {
682 print '<td class="liste_titre">';
683 print '</td>';
684}
685
686// Filter: Bank account
687if (!empty($arrayfields['ba.label']['checked'])) {
688 print '<td class="liste_titre">';
689 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1, getDolGlobalString('FACTURE_PAYMENT_FIX_LINK_TO_BANK') ? 1 : 0);
690 print '</td>';
691}
692
693// Filter: Amount
694if (!empty($arrayfields['p.amount']['checked'])) {
695 print '<td class="liste_titre right">';
696 print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
697 print '</td>';
698}
699
700// Filter: Note
701if (!empty($arrayfields['p.note']['checked'])) {
702 print '<td class="liste_titre">';
703 print '<input class="flat maxwidth150" type="text" name="search_noteprivate" value="'.dol_escape_htmltag($search_noteprivate).'">';
704 print '</td>';
705}
706
707// Filter: ext_payment_id
708if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
709 print '<td class="liste_titre">';
710 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_id" value="'.dol_escape_htmltag($search_ext_payment_id).'">';
711 print '</td>';
712}
713
714// Filter: ext_payment_site
715if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
716 print '<td class="liste_titre">';
717 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
718 print '</td>';
719}
720
721// Filter: ext_payment_site
722if (!empty($arrayfields['p.tms']['checked'])) {
723 print '<td class="liste_titre">';
724 //print '<input class="flat maxwidth150" type="text" name="search_ext_payment_site" value="'.dol_escape_htmltag($search_payment_site).'">';
725 print '</td>';
726}
727
728// Filter: Status (only placeholder)
729if (!empty($arrayfields['p.statut']['checked'])) {
730 print '<td class="liste_titre right">';
731 print '</td>';
732}
733
734// Extra fields
735include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
736
737// Fields from hook
738$parameters = array('arrayfields' => $arrayfields);
739$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
740print $hookmanager->resPrint;
741
742// Action column
743if (!$conf->main_checkbox_left_column) {
744 print '<td class="liste_titre center maxwidthsearch">';
745 $searchpicto = $form->showFilterButtons();
746 print $searchpicto;
747 print '</td>';
748}
749
750print '</tr>'."\n";
751
752$totalarray = array();
753$totalarray['nbfield'] = 0;
754
755// Fields title label
756// --------------------------------------------------------------------
757print '<tr class="liste_titre">';
758// Action column
759if ($conf->main_checkbox_left_column) {
760 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
761 $totalarray['nbfield']++;
762}
763if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
764 print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
765 $totalarray['nbfield']++;
766}
767if (!empty($arrayfields['p.ref']['checked'])) {
768 // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
769 print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
770 $totalarray['nbfield']++;
771}
772if (!empty($arrayfields['p.datep']['checked'])) {
773 print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center ');
774 $totalarray['nbfield']++;
775}
776if (!empty($arrayfields['s.nom']['checked'])) {
777 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
778 $totalarray['nbfield']++;
779}
780if (!empty($arrayfields['c.libelle']['checked'])) {
781 print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder);
782 $totalarray['nbfield']++;
783}
784if (!empty($arrayfields['p.num_paiement']['checked'])) {
785 print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
786 $totalarray['nbfield']++;
787}
788if (!empty($arrayfields['transaction']['checked'])) {
789 print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
790 $totalarray['nbfield']++;
791}
792if (!empty($arrayfields['ba.label']['checked'])) {
793 print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
794 $totalarray['nbfield']++;
795}
796if (!empty($arrayfields['p.amount']['checked'])) {
797 print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder);
798 $totalarray['nbfield']++;
799}
800if (!empty($arrayfields['p.note']['checked'])) {
801 print_liste_field_titre($arrayfields['p.note']['label'], $_SERVER["PHP_SELF"], "p.note", '', $param, '', $sortfield, $sortorder);
802 $totalarray['nbfield']++;
803}
804if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
805 print_liste_field_titre($arrayfields['p.ext_payment_id']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_id", '', $param, '', $sortfield, $sortorder);
806 $totalarray['nbfield']++;
807}
808if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
809 print_liste_field_titre($arrayfields['p.ext_payment_site']['label'], $_SERVER["PHP_SELF"], "p.ext_payment_site", '', $param, '', $sortfield, $sortorder);
810 $totalarray['nbfield']++;
811}
812if (!empty($arrayfields['p.tms']['checked'])) {
813 print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", '', $param, '', $sortfield, $sortorder);
814 $totalarray['nbfield']++;
815}
816if (!empty($arrayfields['p.statut']['checked'])) {
817 print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder);
818 $totalarray['nbfield']++;
819}
820// Extra fields
821include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
822// Hook fields
823$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
824$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
825print $hookmanager->resPrint;
826// Action column
827if (!$conf->main_checkbox_left_column) {
828 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
829 $totalarray['nbfield']++;
830}
831
832print '</tr>'."\n";
833
834// Detect if we need a fetch on each output line
835$needToFetchEachLine = 0;
836if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
837 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
838 if (!is_null($val) && preg_match('/\$object/', $val)) {
839 $needToFetchEachLine++; // There is at least one compute field that use $object
840 }
841 }
842}
843
844
845// Loop on record
846// --------------------------------------------------------------------
847$i = 0;
848$savnbfield = $totalarray['nbfield'];
849$totalarray = array();
850$totalarray['nbfield'] = 0;
851$imaxinloop = ($limit ? min($num, $limit) : $num);
852while ($i < $imaxinloop) {
853 $obj = $db->fetch_object($resql);
854 if (empty($obj)) {
855 break; // Should not happen
856 }
857
858 $object->id = $obj->rowid;
859 $object->ref = ($obj->ref ? $obj->ref : $obj->rowid);
860 $object->date = $db->jdate($obj->datep);
861 $object->amount = $obj->amount;
862 $object->note_private = $obj->note_private;
863
864 $companystatic->id = $obj->socid;
865 $companystatic->name = $obj->name;
866 $companystatic->email = $obj->email;
867
868 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
869 if ($i == 0) {
870 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
871 print '<div class="box-flex-container kanban">';
872 }
873 // Output Kanban
874 $selected = -1;
875 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
876 $selected = 0;
877 if (in_array($object->id, $arrayofselected)) {
878 $selected = 1;
879 }
880 }
881 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
882 print $object->getKanbanView('', array('selected' => $selected));
883 if ($i == ($imaxinloop - 1)) {
884 print '</div>';
885 print '</td></tr>';
886 }
887 } else {
888 // Show line of result
889 $j = 0;
890 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
891
892 // Action column
893 if ($conf->main_checkbox_left_column) {
894 print '<td class="nowrap center">';
895 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
896 $selected = 0;
897 if (in_array($object->id, $arrayofselected)) {
898 $selected = 1;
899 }
900 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
901 }
902 print '</td>';
903 if (!$i) {
904 $totalarray['nbfield']++;
905 }
906 }
907
908 // No
909 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
910 print '<td class="nowraponall">'.(($offset * $limit) + $i).'</td>';
911 if (!$i) {
912 $totalarray['nbfield']++;
913 }
914 }
915
916 // Ref
917 if (!empty($arrayfields['p.ref']['checked'])) {
918 print '<td class="nowraponall">'.$object->getNomUrl(1).'</td>';
919 if (!$i) {
920 $totalarray['nbfield']++;
921 }
922 }
923
924 // Date
925 if (!empty($arrayfields['p.datep']['checked'])) {
926 $dateformatforpayment = 'dayhour';
927 print '<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datep), $dateformatforpayment, 'tzuser').'</td>';
928 if (!$i) {
929 $totalarray['nbfield']++;
930 }
931 }
932
933 // Thirdparty
934 if (!empty($arrayfields['s.nom']['checked'])) {
935 print '<td class="tdoverflowmax125">';
936 if ($obj->socid > 0) {
937 print $companystatic->getNomUrl(1, '', 24);
938 }
939 print '</td>';
940 if (!$i) {
941 $totalarray['nbfield']++;
942 }
943 }
944
945 // Payment type
946 if (!empty($arrayfields['c.libelle']['checked'])) {
947 print '<td class="tdoverflowmax100" title="'.dolPrintHTMLForAttribute($langs->trans("PaymentTypeShort".$obj->paiement_code)).'">'.dolPrintHTML($langs->trans("PaymentTypeShort".$obj->paiement_code)).'</td>';
948 if (!$i) {
949 $totalarray['nbfield']++;
950 }
951 }
952
953 // Filter: Cheque number (fund transfer)
954 if (!empty($arrayfields['p.num_paiement']['checked'])) {
955 print '<td>'.$obj->num_payment.'</td>';
956 if (!$i) {
957 $totalarray['nbfield']++;
958 }
959 }
960
961 // Bank transaction
962 if (!empty($arrayfields['transaction']['checked'])) {
963 print '<td class="tdoverflowmax125">';
964 if ($obj->fk_bank > 0) {
965 $bankline->fetch($obj->fk_bank);
966 print $bankline->getNomUrl(1, 0);
967 }
968 print '</td>';
969 if (!$i) {
970 $totalarray['nbfield']++;
971 }
972 }
973
974 // Bank account
975 if (!empty($arrayfields['ba.label']['checked'])) {
976 print '<td>';
977 if ($obj->bid > 0) {
978 $accountstatic->id = $obj->bid;
979 $accountstatic->ref = $obj->bref;
980 $accountstatic->label = $obj->blabel;
981 $accountstatic->number = $obj->number;
982 $accountstatic->account_number = $obj->account_number;
983
984 $accountingjournal = new AccountingJournal($db);
985 $accountingjournal->fetch($obj->accountancy_journal);
986 $accountstatic->accountancy_journal = $accountingjournal->code;
987
988 print $accountstatic->getNomUrl(1);
989 }
990 print '</td>';
991 if (!$i) {
992 $totalarray['nbfield']++;
993 }
994 }
995
996 // Amount
997 if (!empty($arrayfields['p.amount']['checked'])) {
998 print '<td class="right">';
999 if ($obj->nbinvoices > 1 || ($obj->totalamount && $obj->amount != $obj->totalamount)) {
1000 print $form->textwithpicto('', $langs->trans("PaymentMadeForSeveralInvoices"));
1001 }
1002 print '<span class="amount">'.price($obj->amount).'</span>';
1003 print '</td>';
1004 if (!$i) {
1005 $totalarray['nbfield']++;
1006 $totalarray['pos'][$totalarray['nbfield']] = 'amount';
1007 }
1008 if (empty($totalarray['val']['amount'])) {
1009 $totalarray['val']['amount'] = $obj->amount;
1010 } else {
1011 $totalarray['val']['amount'] += $obj->amount;
1012 }
1013 }
1014
1015 // Note
1016 if (!empty($arrayfields['p.note']['checked'])) {
1017 $firstline = dolGetFirstLineOfText($obj->note_private, 1);
1018 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($firstline).'">';
1019 print dolPrintHTML($firstline).'</span>';
1020 print '</td>';
1021 if (!$i) {
1022 $totalarray['nbfield']++;
1023 }
1024 }
1025
1026 // ext_payment_id
1027 if (!empty($arrayfields['p.ext_payment_id']['checked'])) {
1028 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_id).'">';
1029 print dolPrintHTML($obj->ext_payment_id).'</span>';
1030 print '</td>';
1031 if (!$i) {
1032 $totalarray['nbfield']++;
1033 }
1034 }
1035
1036 // ext_payment_site
1037 if (!empty($arrayfields['p.ext_payment_site']['checked'])) {
1038 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->ext_payment_site).'">';
1039 print dolPrintHTML($obj->ext_payment_site).'</span>';
1040 print '</td>';
1041 if (!$i) {
1042 $totalarray['nbfield']++;
1043 }
1044 }
1045
1046 // Date last change
1047 if (!empty($arrayfields['p.tms']['checked'])) {
1048 print '<td class="tdoverflowmax200">';
1049 print dol_print_date($obj->tms, 'dayhour', 'tzuserrel').'</span>';
1050 print '</td>';
1051 if (!$i) {
1052 $totalarray['nbfield']++;
1053 }
1054 }
1055
1056 // Extra fields
1057 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1058
1059 // Status
1060 if (!empty($arrayfields['p.statut']['checked'])) {
1061 print '<td class="right">';
1062 if ($obj->statut == 0) {
1063 print '<a href="card.php?id='.$obj->rowid.'&amp;action=valide&amp;token='.newToken().'">';
1064 }
1065 print $object->LibStatut($obj->statut, 5);
1066 if ($obj->statut == 0) {
1067 print '</a>';
1068 }
1069 print '</td>';
1070 if (!$i) {
1071 $totalarray['nbfield']++;
1072 }
1073 }
1074
1075 // Fields from hook
1076 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1077 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1078 print $hookmanager->resPrint;
1079
1080 // Action column
1081 if (!$conf->main_checkbox_left_column) {
1082 print '<td class="nowrap center">';
1083 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1084 $selected = 0;
1085 if (in_array($object->id, $arrayofselected)) {
1086 $selected = 1;
1087 }
1088 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1089 }
1090 print '</td>';
1091 if (!$i) {
1092 $totalarray['nbfield']++;
1093 }
1094 }
1095
1096 print '</tr>'."\n";
1097 }
1098
1099 $i++;
1100}
1101
1102// Show total line
1103include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1104
1105// If no record found
1106if ($num == 0) {
1107 $colspan = 1;
1108 foreach ($arrayfields as $key => $val) {
1109 if (!empty($val['checked'])) {
1110 $colspan++;
1111 }
1112 }
1113 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1114}
1115
1116$db->free($resql);
1117
1118$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1119$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1120print $hookmanager->resPrint;
1121
1122print '</table>'."\n";
1123print '</div>'."\n";
1124
1125print '</form>'."\n";
1126
1127// End of page
1128llxFooter();
1129$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage 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)
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolDefaultContextPage($s)
Return the default context page string.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return 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.