dolibarr 22.0.5
list.php
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
6 * Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
7 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
33require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
34require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
35require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
36
45// Load translation files required by the page
46$langs->loadLangs(array('companies', 'donations'));
47
48$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
49$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
50$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
51$mode = GETPOST('mode', 'alpha');
52
53$paiementid = GETPOSTINT('paiementid');
54
55$search_ref = GETPOST("search_ref", "alpha");
56$search_date_startday = GETPOSTINT('search_date_startday');
57$search_date_startmonth = GETPOSTINT('search_date_startmonth');
58$search_date_startyear = GETPOSTINT('search_date_startyear');
59$search_date_endday = GETPOSTINT('search_date_endday');
60$search_date_endmonth = GETPOSTINT('search_date_endmonth');
61$search_date_endyear = GETPOSTINT('search_date_endyear');
62$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
63$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
64$search_company = GETPOST("search_company", 'alpha');
65$search_paymenttype = GETPOST("search_paymenttype", "intcomma");
66$search_account = GETPOST("search_account", 'alpha');
67$search_payment_num = GETPOST('search_payment_num', 'alpha');
68$search_amount = GETPOST("search_amount", 'alpha');
69$search_status = GETPOST('search_status', 'intcomma');
70
71$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
72$sortfield = GETPOST('sortfield', 'aZ09comma');
73$sortorder = GETPOST('sortorder', 'aZ09comma');
74$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
75if (empty($page) || $page == -1) {
76 $page = 0;
77} // If $page is not defined, or '' or -1
78$offset = $limit * $page;
79$pageprev = $page - 1;
80$pagenext = $page + 1;
81if (!$sortorder) {
82 $sortorder = "DESC";
83}
84if (!$sortfield) {
85 $sortfield = "pd.rowid";
86}
87
88$search_all = trim(GETPOST('search_all', 'alphanohtml'));
89
90$object = new Don($db);
91
92$morejs = array();
93$morecss = array();
94
95// List of fields to search into when doing a "search in all"
96$fieldstosearchall = array(
97 'pd.rowid' => "RefPayment",
98 's.nom' => "ThirdParty",
99 'pd.num_paiement' => "Numero",
100 'pd.amount' => "Amount",
101);
102
103$arrayfields = array(
104 'pd.rowid' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10),
105 'pd.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20),
106 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30),
107 'c.code' => array('label' => "Type", 'checked' => '1', 'position' => 40),
108 'pd.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"),
109 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))),
110 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 70, 'enabled' => (string) (int) (isModEnabled("bank"))),
111 'pd.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80),
112);
113$arrayfields = dol_sort_array($arrayfields, 'position');
114
115$optioncss = GETPOST('optioncss', 'alpha');
116$moreforfilter = GETPOST('moreforfilter', 'alpha');
117
118// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
119$hookmanager->initHooks(array('donationlist'));
120
121// Security check
122$result = restrictedArea($user, 'don');
123
124$permissiontoread = $user->hasRight('don', 'read');
125$permissiontoadd = $user->hasRight('don', 'write');
126$permissiontodelete = $user->hasRight('don', 'delete');
127
128/*
129 * Actions
130 */
131
132$parameters = array('socid' => $paiementid);
133$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
134if ($reshook < 0) {
135 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
136}
137
138if (empty($reshook)) {
139 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
140
141 // All tests are required to be compatible with all browsers
142 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
143 $search_ref = '';
144 $search_date_startday = '';
145 $search_date_startmonth = '';
146 $search_date_startyear = '';
147 $search_date_endday = '';
148 $search_date_endmonth = '';
149 $search_date_endyear = '';
150 $search_date_start = '';
151 $search_date_end = '';
152 $search_account = '';
153 $search_amount = '';
154 $search_paymenttype = '';
155 $search_payment_num = '';
156 $search_company = '';
157 $option = '';
158 $toselect = array();
159 $search_array_options = array();
160 }
161}
162
163/*
164 * View
165 */
166
167$form = new Form($db);
168$companystatic = new Societe($db);
169$bankline = new AccountLine($db);
170$accountstatic = new Account($db);
171
172$title = $langs->trans("Donations");
173$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
174
175// Build and execute select
176// --------------------------------------------------------------------
177$sql = "SELECT pd.rowid as payment_id, pd.amount, pd.datep, pd.fk_typepayment, pd.num_payment, pd.amount, pd.fk_bank, ";
178$sql .= ' s.rowid as soc_id, s.nom, ';
179$sql .= ' d.societe, ';
180$sql .= ' c.code as paiement_code, ';
181$sql .= ' d.rowid, ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal as accountancy_journal ';
182
183// Add fields from hooks
184$parameters = array();
185$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
186$sql .= $hookmanager->resPrint;
187
188$sqlfields = $sql; // $sql fields to remove for count total
189
190$sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as pd";
191$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."don as d ON (d.rowid = pd.fk_donation)";
192$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.rowid = pd.fk_bank)";
193$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (ba.rowid = b.fk_account)";
194$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (s.rowid = d.fk_soc)";
195$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON (c.id = pd.fk_typepayment)";
196$sql .= " WHERE d.entity IN (".getEntity('donation').")";
197
198if ($search_ref) {
199 $sql .= natural_search('pd.rowid', $search_ref);
200}
201if ($search_date_start) {
202 $sql .= " AND pd.datep >= '" . $db->idate($search_date_start) . "'";
203}
204if ($search_date_end) {
205 $sql .= " AND pd.datep <= '" . $db->idate($search_date_end) . "'";
206}
207if ($search_account > 0) {
208 $sql .= " AND b.fk_account=".((int) $search_account);
209}
210if ($search_paymenttype != '') {
211 $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
212}
213if ($search_payment_num != '') {
214 $sql .= natural_search('pd.num_payment', $search_payment_num);
215}
216if ($search_amount) {
217 $sql .= natural_search('pd.amount', $search_amount, 1);
218}
219if ($search_company) {
220 $sql .= natural_search('s.nom', $search_company);
221}
222if ($search_all) {
223 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
224}
225
226// Add where from hooks
227$parameters = array();
228$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
229$sql .= $hookmanager->resPrint;
230
231// Count total nb of records
232$nbtotalofrecords = '';
233if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
234 /* The fast and low memory method to get and count full list converts the sql into a sql count */
235 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
236 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
237 $resql = $db->query($sqlforcount);
238 if ($resql) {
239 $objforcount = $db->fetch_object($resql);
240 $nbtotalofrecords = $objforcount->nbtotalofrecords;
241 } else {
242 dol_print_error($db);
243 }
244
245 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
246 $page = 0;
247 $offset = 0;
248 }
249 $db->free($resql);
250}
251
252$sql .= $db->order($sortfield, $sortorder);
253
254// Complete request and execute it with limit
255if ($limit) {
256 $sql .= $db->plimit($limit + 1, $offset);
257}
258
259$resql = $db->query($sql);
260
261if (!$resql) {
262 dol_print_error($db);
263 exit;
264}
265
266$num = $db->num_rows($resql);
267
268// Output page
269// --------------------------------------------------------------------
270
271llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
272
273$param = '';
274if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
275 $param .= '&contextpage='.urlencode($contextpage);
276}
277if ($limit > 0 && $limit != $conf->liste_limit) {
278 $param .= '&limit='.((int) $limit);
279}
280if ($search_ref) {
281 $param .= '&search_ref='.urlencode($search_ref);
282}
283if ($search_date_startday) {
284 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
285}
286if ($search_date_startmonth) {
287 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
288}
289if ($search_date_startyear) {
290 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
291}
292if ($search_date_endday) {
293 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
294}
295if ($search_date_endmonth) {
296 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
297}
298if ($search_date_endyear) {
299 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
300}
301if ($search_company) {
302 $param .= '&search_company='.urlencode($search_company);
303}
304if ($search_amount != '') {
305 $param .= '&search_amount='.urlencode($search_amount);
306}
307if ($search_paymenttype) {
308 $param .= '&search_paymenttype='.urlencode($search_paymenttype);
309}
310if ($search_account) {
311 $param .= '&search_account='.urlencode((string) ($search_account));
312}
313if ($search_payment_num) {
314 $param .= '&search_payment_num='.urlencode($search_payment_num);
315}
316if ($optioncss != '') {
317 $param .= '&optioncss='.urlencode($optioncss);
318}
319
320print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
321if ($optioncss != '') {
322 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
323}
324print '<input type="hidden" name="token" value="'.newToken().'">';
325print '<input type="hidden" name="action" value="list">';
326print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
327print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
328print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
329print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
330
331// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
332print_barre_liste($langs->trans("DonationPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
333
334if ($search_all) {
335 foreach ($fieldstosearchall as $key => $val) {
336 $fieldstosearchall[$key] = $langs->trans($val);
337 }
338 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
339}
340
341$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
342$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
343$massactionbutton = '';
344if ($massactionbutton) {
345 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
346}
347
348$moreforfilter = '';
349print '<div class="div-table-responsive">';
350print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
351
352// Fields title search
353// --------------------------------------------------------------------
354print '<tr class="liste_titre_filter">';
355// Action column
356if (getDolGlobalInt('MAIN_CHECKBOX_LEFT_COLUMN')) {
357 print '<td class="liste_titre center maxwidthsearch">';
358 $searchpicto = $form->showFilterButtons('left');
359 print $searchpicto;
360 print '</td>';
361}
362
363if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
364 print '<td class="liste_titre">';
365 print '</td>';
366}
367
368if (!empty($arrayfields['pd.rowid']['checked'])) {
369 print '<td class="liste_titre left">';
370 print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
371 print '</td>';
372}
373
374// Filter: Date
375if (!empty($arrayfields['pd.datep']['checked'])) {
376 print '<td class="liste_titre">';
377 print '<div class="nowrapfordate">';
378 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
379 print '</div>';
380 print '<div class="nowrapfordate">';
381 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
382 print '</div>';
383 print '</td>';
384}
385
386// Filter: Thirdparty
387if (!empty($arrayfields['s.nom']['checked'])) {
388 print '<td class="liste_titre">';
389 print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
390 print '</td>';
391}
392
393// Filter: Payment type
394if (!empty($arrayfields['c.code']['checked'])) {
395 print '<td class="liste_titre">';
396 print $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
397 print '</td>';
398}
399
400// Filter: Bank transaction number
401if (!empty($arrayfields['transaction']['checked'])) {
402 print '<td class="liste_titre">';
403 print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
404 print '</td>';
405}
406
407// Filter: Cheque number (fund transfer)
408if (!empty($arrayfields['pd.num_paiement']['checked'])) {
409 print '<td class="liste_titre">';
410 print '</td>';
411}
412
413// Filter: Bank account
414if (!empty($arrayfields['ba.label']['checked'])) {
415 print '<td class="liste_titre">';
416 $form->select_comptes($search_account, 'search_account', 0, '', 1);
417 print '</td>';
418}
419
420// Filter: Amount
421if (!empty($arrayfields['pd.amount']['checked'])) {
422 print '<td class="liste_titre right">';
423 print '<input class="flat" type="text" size="6" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
424 print '</td>';
425}
426
427// Fields from hook
428$parameters = array('arrayfields' => $arrayfields);
429$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
430print $hookmanager->resPrint;
431
432// Action column
433if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
434 print '<td class="liste_titre center maxwidthsearch">';
435 $searchpicto = $form->showFilterButtons();
436 print $searchpicto;
437 print '</td>';
438}
439
440print '</tr>'."\n";
441
442$totalarray = array();
443$totalarray['nbfield'] = 0;
444
445// Fields title label
446// --------------------------------------------------------------------
447print '<tr class="liste_titre">';
448// Action column
449if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
450 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
451 $totalarray['nbfield']++;
452}
453if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
454 print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
455 $totalarray['nbfield']++;
456}
457if (!empty($arrayfields['pd.rowid']['checked'])) {
458 // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
459 print_liste_field_titre($arrayfields['pd.rowid']['label'], $_SERVER["PHP_SELF"], "pd.rowid", '', $param, '', $sortfield, $sortorder);
460 $totalarray['nbfield']++;
461}
462if (!empty($arrayfields['pd.datep']['checked'])) {
463 print_liste_field_titre($arrayfields['pd.datep']['label'], $_SERVER["PHP_SELF"], "pd.datep", '', $param, '', $sortfield, $sortorder);
464 $totalarray['nbfield']++;
465}
466if (!empty($arrayfields['s.nom']['checked'])) {
467 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
468 $totalarray['nbfield']++;
469}
470if (!empty($arrayfields['c.code']['checked'])) {
471 print_liste_field_titre($arrayfields['c.code']['label'], $_SERVER["PHP_SELF"], "c.code", '', $param, '', $sortfield, $sortorder);
472 $totalarray['nbfield']++;
473}
474if (!empty($arrayfields['pd.num_paiement']['checked'])) {
475 print_liste_field_titre($arrayfields['pd.num_paiement']['label'], $_SERVER["PHP_SELF"], "pd.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['pd.num_paiement']['tooltip']);
476 $totalarray['nbfield']++;
477}
478if (!empty($arrayfields['transaction']['checked'])) {
479 print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
480 $totalarray['nbfield']++;
481}
482if (!empty($arrayfields['ba.label']['checked'])) {
483 print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
484 $totalarray['nbfield']++;
485}
486if (!empty($arrayfields['pd.amount']['checked'])) {
487 print_liste_field_titre($arrayfields['pd.amount']['label'], $_SERVER["PHP_SELF"], "pd.amount", '', $param, '', $sortfield, $sortorder, 'right ');
488 $totalarray['nbfield']++;
489}
490
491// Extra fields
492include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
493// Hook fields
494$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
495$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
496print $hookmanager->resPrint;
497// Action column
498if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
499 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
500 $totalarray['nbfield']++;
501}
502print '</tr>'."\n";
503
504// Detect if we need a fetch on each output line
505$needToFetchEachLine = 0;
506if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
507 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
508 if (!is_null($val) && preg_match('/\$object/', $val)) {
509 $needToFetchEachLine++; // There is at least one compute field that use $object
510 }
511 }
512}
513
514// Loop on record
515// --------------------------------------------------------------------
516$i = 0;
517$savnbfield = $totalarray['nbfield'];
518$totalarray = array();
519$totalarray['nbfield'] = 0;
520$imaxinloop = ($limit ? min($num, $limit) : $num);
521while ($i < $imaxinloop) {
522 $obj = $db->fetch_object($resql);
523
524 $companystatic->id = $obj->soc_id;
525 $companystatic->name = $obj->nom;
526
527 $company = new Societe($db);
528 $result = $company->fetch($obj->socid);
529
530 print '<tr class="oddeven">';
531 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
532 print '<td class="nowrap center">';
533 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
534 $selected = 0;
535 if (in_array($obj->id_paiement, $arrayofselected)) {
536 $selected = 1;
537 }
538 print '<input id="cb'.$obj->id_paiement.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id_paiement.'"'.($selected ? ' checked="checked"' : '').'>';
539 }
540 print '</td>';
541 if (!$i) {
542 $totalarray['nbfield']++;
543 }
544 }
545
546 // Ref
547 if (!empty($arrayfields['pd.rowid']['checked'])) {
548 print '<td><a href="' . DOL_URL_ROOT . '/don/payment/card.php?id=' . $obj->payment_id . '">' . img_object($langs->trans("Payment"), "payment") . ' ' . $obj->payment_id . '</a></td>';
549 if (!$i) {
550 $totalarray['nbfield']++;
551 }
552 }
553
554 // Date
555 if (!empty($arrayfields['pd.datep']['checked'])) {
556 $dateformatforpayment = 'dayhour';
557 print '<td class="nowraponall">'.dol_print_date($db->jdate($obj->datep), $dateformatforpayment, 'tzuser').'</td>';
558 if (!$i) {
559 $totalarray['nbfield']++;
560 }
561 }
562
563 // Thirdparty
564 if (!empty($arrayfields['s.nom']['checked'])) {
565 print '<td class="nowraponall">';
566 if ($obj->soc_id > 0) {
567 print $companystatic->getNomUrl(1, '', 24);
568 } else {
569 print $object->societe = $obj->societe;
570 }
571 print '</td>';
572 if (!$i) {
573 $totalarray['nbfield']++;
574 }
575 }
576
577 // Payment type
578 if (!empty($arrayfields['c.code']['checked'])) {
579 print '<td>'.$langs->trans("PaymentTypeShort".$obj->paiement_code).'</td>';
580 if (!$i) {
581 $totalarray['nbfield']++;
582 }
583 }
584
585 // Filter: Cheque number (fund transfer)
586 if (!empty($arrayfields['pd.num_paiement']['checked'])) {
587 print '<td>'.$obj->num_payment.'</td>';
588 if (!$i) {
589 $totalarray['nbfield']++;
590 }
591 }
592
593 // Bank transaction
594 if (!empty($arrayfields['transaction']['checked'])) {
595 print '<td class="tdoverflowmax125">';
596 if ($obj->fk_bank > 0) {
597 $test = $bankline->fetch($obj->fk_bank);
598 print $bankline->getNomUrl(1, 0);
599 }
600 print '</td>';
601 if (!$i) {
602 $totalarray['nbfield']++;
603 }
604 }
605
606 // Bank account
607 if (!empty($arrayfields['ba.label']['checked'])) {
608 print '<td>';
609 if ($obj->bid > 0) {
610 $accountstatic->id = $obj->bid;
611 $accountstatic->ref = $obj->bref;
612 $accountstatic->label = $obj->blabel;
613 $accountstatic->number = $obj->number;
614 $accountstatic->account_number = $obj->account_number;
615
616 $accountingjournal = new AccountingJournal($db);
617 $accountingjournal->fetch($obj->accountancy_journal);
618 $accountstatic->accountancy_journal = $accountingjournal->code;
619
620 print $accountstatic->getNomUrl(1);
621 }
622 if (!$i) {
623 $totalarray['nbfield']++;
624 }
625 }
626
627 // Amount
628 if (!empty($arrayfields['pd.amount']['checked'])) {
629 print '<td class="right"><span class="amount">' . price($obj->amount) . '</span></td>';
630 if (!$i) {
631 $totalarray['nbfield']++;
632 $totalarray['pos'][$totalarray['nbfield']] = 'amount';
633 }
634 if (empty($totalarray['val']['amount'])) {
635 $totalarray['val']['amount'] = $obj->amount;
636 } else {
637 $totalarray['val']['amount'] += $obj->amount;
638 }
639 }
640
641 $i++;
642}
643
644// Show total line
645include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
646
647// If no record found
648if ($num == 0) {
649 $colspan = 1;
650 foreach ($arrayfields as $key => $val) {
651 if (!empty($val['checked'])) {
652 $colspan++;
653 }
654 }
655 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
656}
657
658$db->free($resql);
659
660$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
661$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
662print $hookmanager->resPrint;
663
664print '</table>'."\n";
665print '</div>'."\n";
666
667print '</form>'."\n";
668
669llxFooter();
670$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
$totalarray
Definition export.php:1206
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage bank accounts.
Class to manage bank transaction lines.
Class to manage accounting journals.
Class to manage donations.
Definition don.class.php:41
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.