dolibarr 18.0.6
bankentries_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
6 * Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
7 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
8 * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
10 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
11 * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
12 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27
34// Load Dolibarr environment
35require '../../main.inc.php';
36
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
40
41require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
43require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
44require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
45require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
46require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
47require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
48require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
49require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
50require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
51require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
52require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
53require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
54require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
55require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
56require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
57require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
58require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
59require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
60
61// Load translation files required by the page
62$langs->loadLangs(array("banks", "bills", "categories", "companies", "margins", "salaries", "loan", "donations", "trips", "members", "compta", "accountancy"));
63
64$id = GETPOST('id', 'int');
65$ref = GETPOST('ref', 'alpha');
66$action = GETPOST('action', 'aZ09');
67$cancel = GETPOST('cancel', 'alpha');
68$confirm = GETPOST('confirm', 'alpha');
69$contextpage = 'banktransactionlist';
70$massaction = GETPOST('massaction', 'alpha');
71$optioncss = GETPOST('optioncss', 'aZ09');
72
73
74$dateop = dol_mktime(12, 0, 0, GETPOST("opmonth", 'int'), GETPOST("opday", 'int'), GETPOST("opyear", 'int'));
75$search_debit = GETPOST("search_debit", 'alpha');
76$search_credit = GETPOST("search_credit", 'alpha');
77$search_type = GETPOST("search_type", 'alpha');
78$search_account = GETPOST("search_account", 'int') ?GETPOST("search_account", 'int') : GETPOST("account", 'int');
79$search_accountancy_code = GETPOST('search_accountancy_code', 'alpha') ?GETPOST('search_accountancy_code', 'alpha') : GETPOST('accountancy_code', 'alpha');
80$search_bid = GETPOST("search_bid", "int") ?GETPOST("search_bid", "int") : GETPOST("bid", "int");
81$search_ref = GETPOST('search_ref', 'alpha');
82$search_description = GETPOST("search_description", 'alpha');
83$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
84$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
85$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
86$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
87$search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
88$search_req_nb = GETPOST("req_nb", 'alpha');
89$search_num_releve = GETPOST("search_num_releve", 'alpha');
90$search_conciliated = GETPOST("search_conciliated", 'int');
91$search_fk_bordereau = GETPOST("search_fk_bordereau", 'int');
92$optioncss = GETPOST('optioncss', 'alpha');
93$toselect = GETPOST('toselect', 'array');
94$num_releve = GETPOST("num_releve", "alpha");
95if (empty($dateop)) {
96 $dateop = -1;
97}
98
99$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
100$sortfield = GETPOST('sortfield', 'aZ09comma');
101$sortorder = GETPOST('sortorder', 'aZ09comma');
102$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
103$pageplusone = GETPOST("pageplusone", 'int');
104if ($pageplusone) {
105 $page = $pageplusone - 1;
106}
107if (empty($page) || $page == -1) {
108 $page = 0;
109} // If $page is not defined, or '' or -1
110$offset = $limit * $page;
111$pageprev = $page - 1;
112$pagenext = $page + 1;
113if (!$sortorder) {
114 $sortorder = 'desc,desc,desc';
115}
116if (!$sortfield) {
117 $sortfield = 'b.datev,b.dateo,b.rowid';
118}
119
120$object = new Account($db);
121if ($id > 0 || !empty($ref)) {
122 $result = $object->fetch($id, $ref);
123 $search_account = $object->id; // Force the search field on id of account
124
125 if (!($object->id > 0)) {
126 $langs->load("errors");
127 print($langs->trans('ErrorRecordNotFound'));
128 exit;
129 }
130}
131
132// redefine contextpage to depend on bank account
133$contextpage = 'banktransactionlist'.(empty($object->id) ? '' : '-'.$object->id);
134
135$mode_balance_ok = false;
136//if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) // TODO Manage balance when account not selected
137if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) {
138 $sortfield = 'b.datev,b.dateo,b.rowid';
139 if ($id > 0 || !empty($ref) || $search_account > 0) {
140 $mode_balance_ok = true;
141 }
142}
143
144// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
145$hookmanager->initHooks(array('banktransactionlist', $contextpage));
146$extrafields = new ExtraFields($db);
147
148// fetch optionals attributes and labels
149$extrafields->fetch_name_optionals_label('banktransaction');
150$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
151
152$arrayfields = array(
153 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1,'position'=>10),
154 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1,'position'=>20),
155 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1,'position'=>30),
156 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1,'position'=>40),
157 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1,'position'=>50),
158 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1,'position'=>60),
159 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>70),
160 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>80),
161 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>90),
162 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>100),
163 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>110),
164 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120),
165 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130),
166 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140),
167 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeNumber"), 'checked'=>0, 'position'=>150),
168);
169// Extra fields
170include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
171
172$object->fields = dol_sort_array($object->fields, 'position');
173$arrayfields = dol_sort_array($arrayfields, 'position');
174
175// Security check
176$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
177$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
178if ($fieldvalue) {
179 if ($user->socid) {
180 $socid = $user->socid;
181 }
182 $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype);
183} else {
184 if ($user->socid) {
185 $socid = $user->socid;
186 }
187 $result = restrictedArea($user, 'banque');
188}
189
190
191/*
192 * Actions
193 */
194
195if (GETPOST('cancel', 'alpha')) {
196 $action = 'list';
197 $massaction = '';
198}
199if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
200 $massaction = '';
201}
202
203$parameters = array();
204$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
205if ($reshook < 0) {
206 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
207}
208
209include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
210
211if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
212 $search_dt_start = '';
213 $search_dt_end = '';
214 $search_dv_start = '';
215 $search_dv_end = '';
216 $search_type = "";
217 $search_debit = "";
218 $search_credit = "";
219 $search_bid = "";
220 $search_ref = "";
221 $search_req_nb = '';
222 $search_description = '';
223 $search_thirdparty_user = '';
224 $search_num_releve = '';
225 $search_conciliated = '';
226 $search_fk_bordereau = '';
227 $toselect = array();
228
229 $search_account = "";
230 if ($id > 0 || !empty($ref)) {
231 $search_account = $object->id;
232 }
233}
234
235if (empty($reshook)) {
236 $objectclass = 'Account';
237 $objectlabel = 'BankTransaction';
238 $permissiontoread = !empty($user->rights->banque->lire);
239 $permissiontodelete = $user->hasRight('banque', 'modifier');
240 $uploaddir = $conf->bank->dir_output;
241 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
242}
243
244$rowids = GETPOST('rowid', 'array');
245
246// Conciliation
247if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha'))
248 && (GETPOST("num_releve", "alpha") || !empty($rowids))
249 && !empty($user->rights->banque->consolidate)
250 && (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
251 $error = 0;
252
253 // Definition, nettoyage parametres
254 $num_releve = GETPOST("num_releve", "alpha");
255
256 if ($num_releve) {
257 $bankline = new AccountLine($db);
258
259 $rowids = GETPOST('rowid', 'array');
260
261 if (!empty($rowids) && is_array($rowids)) {
262 foreach ($rowids as $row) {
263 if ($row > 0) {
264 $result = $bankline->fetch($row);
265 $bankline->num_releve = $num_releve; // GETPOST("num_releve");
266 $result = $bankline->update_conciliation($user, GETPOST("cat"), GETPOST('confirm_reconcile', 'alpha') ? 1 : 0); // If we confirm_reconcile, we set flag 'rappro' to 1.
267 if ($result < 0) {
268 setEventMessages($bankline->error, $bankline->errors, 'errors');
269 $error++;
270 break;
271 }
272 }
273 }
274 if (!$error && count($rowids) > 0) {
275 setEventMessages($langs->trans("XNewLinesConciliated", count($rowids)), null);
276 }
277 } else {
278 $error++;
279 $langs->load("errors");
280 setEventMessages($langs->trans("NoRecordSelected"), null, 'errors');
281 }
282 } else {
283 $error++;
284 $langs->load("errors");
285 setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
286 }
287
288 if (!$error) {
289 $param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $object->id).'&search_account='.((int) $object->id);
290 if ($page) {
291 $param .= '&page='.urlencode($page);
292 }
293 if ($offset) {
294 $param .= '&offset='.urlencode($offset);
295 }
296 if ($limit) {
297 $param .= '&limit='.((int) $limit);
298 }
299 if ($search_conciliated != '' && $search_conciliated != '-1') {
300 $param .= '&search_conciliated='.urlencode($search_conciliated);
301 }
302 if ($search_thirdparty_user) {
303 $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
304 }
305 if ($search_num_releve) {
306 $param .= '&search_num_releve='.urlencode($search_num_releve);
307 }
308 if ($search_description) {
309 $param .= '&search_description='.urlencode($search_description);
310 }
311 if (dol_strlen($search_dt_start) > 0) {
312 $param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int');
313 }
314 if (dol_strlen($search_dt_end) > 0) {
315 $param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int');
316 }
317 if (dol_strlen($search_dv_start) > 0) {
318 $param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int');
319 }
320 if (dol_strlen($search_dv_end) > 0) {
321 $param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int');
322 }
323 if ($search_type) {
324 $param .= '&search_type='.urlencode($search_type);
325 }
326 if ($search_debit) {
327 $param .= '&search_debit='.urlencode($search_debit);
328 }
329 if ($search_credit) {
330 $param .= '&search_credit='.urlencode($search_credit);
331 }
332 $param .= '&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder);
333 header('Location: '.$_SERVER["PHP_SELF"].'?'.$param); // To avoid to submit twice and allow the back button
334 exit;
335 }
336}
337
338
339if (GETPOST('save') && !$cancel && $user->hasRight('banque', 'modifier')) {
340 $error = 0;
341
342 if (price2num(GETPOST("addcredit")) > 0) {
343 $amount = price2num(GETPOST("addcredit"));
344 } else {
345 $amount = - price2num(GETPOST("adddebit"));
346 }
347
348 $operation = GETPOST("operation", 'alpha');
349 $num_chq = GETPOST("num_chq", 'alpha');
350 $label = GETPOST("label", 'alpha');
351 $cat1 = GETPOST("cat1", 'alpha');
352
353 $bankaccountid = $id;
354 if (GETPOST('add_account', 'int') > 0) {
355 $bankaccountid = GETPOST('add_account', 'int');
356 }
357 if (!$dateop) {
358 $error++;
359 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
360 }
361 if (!$operation) {
362 $error++;
363 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
364 }
365 if (!$label) {
366 $error++;
367 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
368 }
369 if (!$amount) {
370 $error++;
371 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
372 }
373 if (!($bankaccountid > 0)) {
374 $error++;
375 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
376 }
377 /*if (isModEnabled('accounting') && (empty($search_accountancy_code) || $search_accountancy_code == '-1'))
378 {
379 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
380 $error++;
381 }*/
382
383 if (!$error && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
384 $objecttmp = new Account($db);
385 $objecttmp->fetch($bankaccountid);
386 $insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code);
387 if ($insertid > 0) {
388 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
389 header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : ''));
390 exit;
391 } else {
392 setEventMessages($object->error, $object->errors, 'errors');
393 }
394 } else {
395 $action = 'addline';
396 }
397}
398
399if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('banque', 'modifier')) {
400 $accline = new AccountLine($db);
401 $result = $accline->fetch(GETPOST("rowid", "int"));
402 $result = $accline->delete($user);
403 if ($result <= 0) {
404 setEventMessages($accline->error, $accline->errors, 'errors');
405 } else {
406 setEventMessages('RecordDeleted', null, 'mesgs');
407 }
408}
409
410/*
411 * View
412 */
413
414$form = new Form($db);
415$formother = new FormOther($db);
416$formaccounting = new FormAccounting($db);
417
418$companystatic = new Societe($db);
419$bankaccountstatic = new Account($db);
420$userstatic= new User($db);
421
422$banktransferstatic = new BonPrelevement($db);
423$societestatic = new Societe($db);
424$userstatic = new User($db);
425$chargestatic = new ChargeSociales($db);
426$loanstatic = new Loan($db);
427$memberstatic = new Adherent($db);
428$donstatic = new Don($db);
429$paymentstatic = new Paiement($db);
430$paymentsupplierstatic = new PaiementFourn($db);
431$paymentscstatic = new PaymentSocialContribution($db);
432$paymentvatstatic = new PaymentVAT($db);
433$paymentsalstatic = new PaymentSalary($db);
434$paymentdonationstatic = new PaymentDonation($db);
435$paymentvariousstatic = new PaymentVarious($db);
436$paymentexpensereportstatic = new PaymentExpenseReport($db);
437$bankstatic = new Account($db);
438$banklinestatic = new AccountLine($db);
439$bordereaustatic = new RemiseCheque($db);
440
441$now = dol_now();
442
443// Must be before button action
444$param = '';
445if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
446 $param .= '&contextpage='.urlencode($contextpage);
447}
448if ($limit > 0 && $limit != $conf->liste_limit) {
449 $param .= '&limit='.((int) $limit);
450}
451if ($id > 0) {
452 $param .= '&id='.urlencode($id);
453}
454if (!empty($ref)) {
455 $param .= '&ref='.urlencode($ref);
456}
457if (!empty($search_ref)) {
458 $param .= '&search_ref='.urlencode($search_ref);
459}
460if (!empty($search_description)) {
461 $param .= '&search_description='.urlencode($search_description);
462}
463if (!empty($search_type)) {
464 $param .= '&type='.urlencode($search_type);
465}
466if (!empty($search_thirdparty_user)) {
467 $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
468}
469if (!empty($search_debit)) {
470 $param .= '&search_debit='.urlencode($search_debit);
471}
472if (!empty($search_credit)) {
473 $param .= '&search_credit='.urlencode($search_credit);
474}
475if ($search_account > 0) {
476 $param .= '&search_account='.urlencode($search_account);
477}
478if (!empty($search_num_releve)) {
479 $param .= '&search_num_releve='.urlencode($search_num_releve);
480}
481if ($search_conciliated != '' && $search_conciliated != '-1') {
482 $param .= '&search_conciliated='.urlencode($search_conciliated);
483}
484if ($search_fk_bordereau > 0) {
485 $param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau);
486}
487if ($search_bid > 0) {
488 $param .= '&search_bid='.urlencode($search_bid);
489}
490if (dol_strlen($search_dt_start) > 0) {
491 $param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int');
492}
493if (dol_strlen($search_dt_end) > 0) {
494 $param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int');
495}
496if (dol_strlen($search_dv_start) > 0) {
497 $param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int');
498}
499if (dol_strlen($search_dv_end) > 0) {
500 $param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int');
501}
502if ($search_req_nb) {
503 $param .= '&req_nb='.urlencode($search_req_nb);
504}
505if (GETPOST("search_thirdparty", 'int')) {
506 $param .= '&thirdparty='.urlencode(GETPOST("search_thirdparty", 'int'));
507}
508if ($optioncss != '') {
509 $param .= '&optioncss='.urlencode($optioncss);
510}
511if ($action == 'reconcile') {
512 $param .= '&action=reconcile';
513}
514$totalarray = array(
515 'nbfield' => 0,
516 'totalcred' => 0,
517 'totaldeb' => 0,
518);
519// Add $param from extra fields
520include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
521
522$options = array();
523
524$buttonreconcile = '';
525$morehtmlref = '';
526
527if ($id > 0 || !empty($ref)) {
528 $title = $object->ref.' - '.$langs->trans("Transactions");
529} else {
530 $title = $langs->trans("BankTransactions");
531}
532$help_url = '';
533
534llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $param);
535
536
537if ($id > 0 || !empty($ref)) {
538 // Load bank groups
539 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
540 $bankcateg = new BankCateg($db);
541
542 foreach ($bankcateg->fetchAll() as $bankcategory) {
543 $options[$bankcategory->id] = $bankcategory->label;
544 }
545
546 // Bank card
547 $head = bank_prepare_head($object);
548 print dol_get_fiche_head($head, 'journal', $langs->trans("FinancialAccount"), 0, 'account');
549
550 $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
551
552 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
553
554 print dol_get_fiche_end();
555
556
557 /*
558 * Buttons actions
559 */
560
561 if ($action != 'reconcile') {
562 if ($object->canBeConciliated() > 0) {
563 $allowautomaticconciliation = false; // TODO
564 $titletoconciliatemanual = $langs->trans("Conciliate");
565 $titletoconciliateauto = $langs->trans("Conciliate");
566 if ($allowautomaticconciliation) {
567 $titletoconciliatemanual .= ' ('.$langs->trans("Manual").')';
568 $titletoconciliateauto .= ' ('.$langs->trans("Auto").')';
569 }
570
571 // If not cash account and can be reconciliate
572 if ($user->rights->banque->consolidate) {
573 $newparam = $param;
574 $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
575 $buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
576 } else {
577 $buttonreconcile = '<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
578 }
579
580 if ($allowautomaticconciliation) {
581 // If not cash account and can be reconciliate
582 if ($user->rights->banque->consolidate) {
583 $newparam = $param;
584 $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
585 $buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
586 } else {
587 $buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
588 }
589 }
590 }
591 }
592}
593
594$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
595$sql .= " b.fk_account, b.fk_type, b.fk_bordereau,";
596$sql .= " ba.rowid as bankid, ba.ref as bankref";
597// Add fields from extrafields
598if (!empty($extrafields->attributes[$object->table_element]['label'])) {
599 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
600 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
601 }
602}
603// Add fields from hooks
604$parameters = array();
605$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
606$sql .= $hookmanager->resPrint;
607$sql .= " FROM ";
608if ($search_bid > 0) {
609 $sql .= MAIN_DB_PREFIX."bank_class as l,";
610}
611$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
612$sql .= " ".MAIN_DB_PREFIX."bank as b";
613if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
614 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
615}
616
617// Add fields from hooks
618$parameters = array();
619$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
620$sql .= $hookmanager->resPrint;
621
622$sql .= " WHERE b.fk_account = ba.rowid";
623$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
624if ($search_account > 0) {
625 $sql .= " AND b.fk_account = ".((int) $search_account);
626}
627// Search period criteria
628if (dol_strlen($search_dt_start) > 0) {
629 $sql .= " AND b.dateo >= '".$db->idate($search_dt_start)."'";
630}
631if (dol_strlen($search_dt_end) > 0) {
632 $sql .= " AND b.dateo <= '".$db->idate($search_dt_end)."'";
633}
634// Search period criteria
635if (dol_strlen($search_dv_start) > 0) {
636 $sql .= " AND b.datev >= '".$db->idate($search_dv_start)."'";
637}
638if (dol_strlen($search_dv_end) > 0) {
639 $sql .= " AND b.datev <= '".$db->idate($search_dv_end)."'";
640}
641if ($search_ref) {
642 $sql .= natural_search("b.rowid", $search_ref, 1);
643}
644if ($search_req_nb) {
645 $sql .= natural_search("b.num_chq", $search_req_nb);
646}
647if ($search_num_releve) {
648 $sql .= natural_search("b.num_releve", $search_num_releve);
649}
650if ($search_conciliated != '' && $search_conciliated != '-1') {
651 $sql .= " AND b.rappro = ".((int) $search_conciliated);
652}
653if ($search_fk_bordereau > 0) {
654 $sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
655}
656if ($search_thirdparty_user) {
657 $sql.= " AND (b.rowid IN ";
658 $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
659 $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
660 $sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
661 $sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1).")";
662
663 $sql.= " OR b.rowid IN ";
664 $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
665 $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
666 $sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
667 $sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1);
668 $sql.= "))";
669}
670if ($search_description) {
671 $search_description_to_use = $search_description;
672 $arrayoffixedlabels = array(
673 'payment_salary',
674 'CustomerInvoicePayment', 'CustomerInvoicePaymentBack',
675 'SupplierInvoicePayment', 'SupplierInvoicePaymentBack',
676 'DonationPayment',
677 'ExpenseReportPayment',
678 'SocialContributionPayment',
679 'SubscriptionPayment',
680 'WithdrawalPayment'
681 );
682 foreach ($arrayoffixedlabels as $keyforlabel) {
683 $translatedlabel = $langs->transnoentitiesnoconv($keyforlabel);
684 if (preg_match('/'.$search_description.'/i', $translatedlabel)) {
685 $search_description_to_use .= "|".$keyforlabel;
686 }
687 }
688 $sql .= natural_search("b.label", $search_description_to_use); // Warning some text are just translation keys, not translated strings
689}
690
691if ($search_bid > 0) {
692 $sql .= " AND b.rowid = l.lineid AND l.fk_categ = ".((int) $search_bid);
693}
694if (!empty($search_type)) {
695 $sql .= " AND b.fk_type = '".$db->escape($search_type)."'";
696}
697// Search criteria amount
698if ($search_debit) {
699 $sql .= natural_search('ABS(b.amount)', $search_debit, 1);
700 $sql .= ' AND b.amount <= 0';
701}
702if ($search_credit) {
703 $sql .= natural_search('b.amount', $search_credit, 1);
704 $sql .= ' AND b.amount >= 0';
705}
706// Add where from extra fields
707include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
708
709// Add where from hooks
710$parameters = array();
711$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
712$sql .= $hookmanager->resPrint;
713
714$sql .= $db->order($sortfield, $sortorder);
715
716$nbtotalofrecords = '';
717$nbtotalofpages = 0;
718if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
719 $result = $db->query($sql);
720 $nbtotalofrecords = $db->num_rows($result);
721 $nbtotalofpages = ceil($nbtotalofrecords / $limit);
722}
723
724if (($id > 0 || !empty($ref)) && ((string) $page == '')) {
725 // We open a list of transaction of a dedicated account and no page was set by defaut
726 // We force on last page.
727 $page = ($nbtotalofpages - 1);
728 $offset = $limit * $page;
729 if ($page < 0) {
730 $page = 0;
731 }
732}
733if ($page >= $nbtotalofpages) {
734 // If we made a search and result has low page than the page number we were on
735 $page = ($nbtotalofpages - 1);
736 $offset = $limit * $page;
737 if ($page < 0) {
738 $page = 0;
739 }
740}
741
742
743// If not account defined $mode_balance_ok=false
744if (empty($search_account)) {
745 $mode_balance_ok = false;
746}
747// If a search is done $mode_balance_ok=false
748if (!empty($search_ref)) {
749 $mode_balance_ok = false;
750}
751if (!empty($search_description)) {
752 $mode_balance_ok = false;
753}
754if (!empty($search_type)) {
755 $mode_balance_ok = false;
756}
757if (!empty($search_debit)) {
758 $mode_balance_ok = false;
759}
760if (!empty($search_credit)) {
761 $mode_balance_ok = false;
762}
763if (!empty($search_thirdparty_user)) {
764 $mode_balance_ok = false;
765}
766if ($search_conciliated != '' && $search_conciliated != '-1') {
767 $mode_balance_ok = false;
768}
769if (!empty($search_num_releve)) {
770 $mode_balance_ok = false;
771}
772if (!empty($search_fk_bordereau)) {
773 $mode_balance_ok = false;
774}
775
776$sql .= $db->plimit($limit + 1, $offset);
777//print $sql;
778dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
779$resql = $db->query($sql);
780if ($resql) {
781 $num = $db->num_rows($resql);
782
783 $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array();
784
785 // List of mass actions available
786 $arrayofmassactions = array(
787 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
788 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
789 );
790 //if ($user->rights->bank->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
791 if (in_array($massaction, array('presend', 'predelete'))) {
792 $arrayofmassactions = array();
793 }
794 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
795
796 // Confirmation delete
797 if ($action == 'delete') {
798 $text = $langs->trans('ConfirmDeleteTransaction');
799 print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
800 }
801
802 // Lines of title fields
803 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
804 if ($optioncss != '') {
805 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
806 }
807 print '<input type="hidden" name="token" value="'.newToken().'">';
808 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
809 print '<input type="hidden" name="action" value="'.($action != 'delete' ? $action : 'search').'">';
810 if (!empty($view)) {
811 print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
812 }
813 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
814 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
815 print '<input type="hidden" name="page" value="'.$page.'">';
816 print '<input type="hidden" name="id" value="'.$id.'">';
817 print '<input type="hidden" name="ref" value="'.$ref.'">';
818 if (GETPOST('bid')) {
819 print '<input type="hidden" name="bid" value="'.GETPOST("bid", 'int').'">';
820 }
821
822 // Form to reconcile
823 if ($user->rights->banque->consolidate && $action == 'reconcile') {
824 print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
825 $texttoshow = $langs->trans("InputReceiptNumber").': ';
826 $yyyy = dol_substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1);
827 $mm = dol_substr($langs->transnoentitiesnoconv("Month"), 0, 1).substr($langs->transnoentitiesnoconv("Month"), 0, 1);
828 $dd = dol_substr($langs->transnoentitiesnoconv("Day"), 0, 1).substr($langs->transnoentitiesnoconv("Day"), 0, 1);
829 $placeholder = $yyyy.$mm;
830 $placeholder .= ' '.$langs->trans("or").' ';
831 $placeholder .= $yyyy.$mm.$dd;
832 if (!$placeholder) {
833 $texttoshow .= $langs->trans("InputReceiptNumberBis");
834 }
835 print $texttoshow;
836 print '<input class="flat width175" pattern="[0-9]+" title="'.dol_escape_htmltag($texttoshow.($placeholder ? ': '.$placeholder : '')).'" id="num_releve" name="num_releve" placeholder="'.dol_escape_htmltag($placeholder).'" type="text" value="'.(GETPOST('num_releve', 'int') ? GETPOST('num_releve', 'int') : '').'">'; // The only default value is value we just entered
837 print '</div>';
838 if (is_array($options) && count($options)) {
839 print $langs->trans("EventualyAddCategory").': ';
840 print Form::selectarray('cat', $options, GETPOST('cat'), 1);
841 }
842 print '<br><div style="margin-top: 5px;"><span class="opacitymedium">'.$langs->trans("ThenCheckLinesAndConciliate").'</span> ';
843 print '<input class="button" name="confirm_savestatement" type="submit" value="'.$langs->trans("SaveStatementOnly").'">';
844 print ' '.$langs->trans("or").' ';
845 print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">';
846 print ' '.$langs->trans("or").' ';
847 print '<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans("Cancel").'">';
848 print '</div>';
849
850 // Show last bank statements
851 $nbmax = 12; // We show last 12 receipts (so we can have more than one year)
852 $liste = "";
853 $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank";
854 $sql .= " WHERE fk_account = ".((int) $object->id)." AND num_releve IS NOT NULL";
855 $sql .= $db->order("num_releve", "DESC");
856 $sql .= $db->plimit($nbmax + 1);
857 print '<br>';
858 print $langs->trans("LastAccountStatements").' : ';
859 $resqlr = $db->query($sql);
860 if ($resqlr) {
861 $numr = $db->num_rows($resqlr);
862 $i = 0;
863 $last_ok = 0;
864 while (($i < $numr) && ($i < $nbmax)) {
865 $objr = $db->fetch_object($resqlr);
866 if (!$last_ok) {
867 $last_releve = $objr->num_releve;
868 $last_ok = 1;
869 }
870 $i++;
871 $liste = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$id.'&amp;num='.$objr->num_releve.'">'.$objr->num_releve.'</a> &nbsp; '.$liste;
872 }
873 if ($numr >= $nbmax) {
874 $liste = "... &nbsp; ".$liste;
875 }
876 print $liste;
877 if ($numr <= 0) {
878 print '<b>'.$langs->trans("None").'</b>';
879 }
880 } else {
881 dol_print_error($db);
882 }
883
884 // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
885 if (!empty($conf->global->BANK_REPORT_LAST_NUM_RELEVE)) {
886 print '
887 <script type="text/javascript">
888 $("#num_releve").val("' . $last_releve.'");
889 </script>
890 ';
891 }
892 print '<br><br>';
893 }
894
895 // Form to add a transaction with no invoice
896 if ($user->hasRight('banque', 'modifier') && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
897 print load_fiche_titre($langs->trans("AddBankRecordLong"), '', '');
898
899 print '<table class="noborder centpercent">';
900
901 print '<tr class="liste_titre">';
902 print '<td>'.$langs->trans("Description").'</td>';
903 print '<td>'.$langs->trans("Date").'</td>';
904 print '<td>&nbsp;</td>';
905 print '<td>'.$langs->trans("Type").'</td>';
906 print '<td>'.$langs->trans("Numero").'</td>';
907 print '<td class=right>'.$langs->trans("BankAccount").'</td>';
908 print '<td class=right>'.$langs->trans("Debit").'</td>';
909 print '<td class=right>'.$langs->trans("Credit").'</td>';
910 /*if (isModEnabled('accounting'))
911 {
912 print '<td class="center">';
913 print $langs->trans("AccountAccounting");
914 print '</td>';
915 }*/
916 print '<td align="center">&nbsp;</td>';
917 print '</tr>';
918
919 print '<tr>';
920 print '<td>';
921 print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label", "alpha").'">';
922 if (is_array($options) && count($options)) {
923 print '<br>'.$langs->trans("Rubrique").': ';
924 print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
925 }
926 print '</td>';
927 print '<td class="nowrap">';
928 print $form->selectDate(empty($dateop) ?-1 : $dateop, 'op', 0, 0, 0, 'transaction');
929 print '</td>';
930 print '<td>&nbsp;</td>';
931 print '<td class="nowrap">';
932 $form->select_types_paiements((GETPOST('operation') ?GETPOST('operation') : ($object->courant == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1);
933 print '</td>';
934 print '<td>';
935 print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq", "alpha").'">';
936 print '</td>';
937 //if (! $search_account > 0)
938 //{
939 print '<td class=right>';
940 $form->select_comptes(GETPOST('add_account', 'int') ?GETPOST('add_account', 'int') : $search_account, 'add_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''));
941 print '</td>';
942 //}
943 print '<td class="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit", "alpha").'"></td>';
944 print '<td class="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit", "alpha").'"></td>';
945 /*if (isModEnabled('accounting'))
946 {
947 print '<td class="center">';
948 print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, '');
949 print '</td>';
950 }*/
951 print '<td class="center">';
952 print '<input type="submit" name="save" class="button buttongen marginbottomonly button-add" value="'.$langs->trans("Add").'"><br>';
953 print '<input type="submit" name="cancel" class="button buttongen marginbottomonly button-cancel" value="'.$langs->trans("Cancel").'">';
954 print '</td></tr>';
955
956 print '</table>';
957 print '<br>';
958 }
959
960 // Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page
961 $urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?token='.currentToken();
962 print '
963 <script type="text/javascript">
964 $(function() {
965 $("a.ajaxforbankoperationchange").each(function(){
966 var current = $(this);
967 current.click(function()
968 {
969 var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
970 $.get(url, function(data)
971 {
972 console.log(url)
973 console.log(data)
974 current.parent().parent().find(".spanforajaxedit").replaceWith(data);
975 });
976 return false;
977 });
978 });
979 });
980 </script>
981 ';
982
983 $i = 0;
984
985 // Title
986 $bankcateg = new BankCateg($db);
987
988 $newcardbutton = '';
989 if ($action != 'addline' && $action != 'reconcile') {
990 if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
991 if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { // Default is to record miscellaneous direct entries using miscellaneous payments
992 $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.urlencode($search_account).'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier);
993 } else // If direct entries is not done using miscellaneous payments
994 {
995 $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&token='.newToken().'&page='.$page.$param, '', $user->rights->banque->modifier);
996 }
997 } else {
998 $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&token='.newToken().'&page='.$page.$param, '', -1);
999 }
1000 }
1001
1002 $morehtml = '';
1003 /*$morehtml = '<div class="inline-block '.(($buttonreconcile || $newcardbutton) ? 'marginrightonly' : '').'">';
1004 $morehtml .= '<label for="pageplusone">'.$langs->trans("Page")."</label> "; // ' Page ';
1005 $morehtml .= '<input type="text" name="pageplusone" id="pageplusone" class="flat right width25 pageplusone" value="'.($page + 1).'">';
1006 $morehtml .= '/'.$nbtotalofpages.' ';
1007 $morehtml .= '</div>';
1008 */
1009
1010 if ($action != 'addline' && $action != 'reconcile') {
1011 $morehtml .= $buttonreconcile;
1012 }
1013
1014 $morehtml .= '<!-- Add New button -->'.$newcardbutton;
1015
1016 $picto = 'bank_account';
1017 if ($id > 0 || !empty($ref)) {
1018 $picto = '';
1019 }
1020
1021 print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1);
1022
1023 // We can add page now to param
1024 if ($page != '') {
1025 $param .= '&page='.urlencode($page);
1026 }
1027
1028 $moreforfilter = '';
1029
1030 $moreforfilter .= '<div class="divsearchfield">';
1031 $moreforfilter .= $langs->trans('DateOperationShort');
1032 $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
1033 $moreforfilter .= '<div class="nowrap inline-block">';
1034 $moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1035 $moreforfilter .= '</div>';
1036 $moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
1037 $moreforfilter .= '<div class="nowrap inline-block">';
1038 $moreforfilter .= $form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1039 $moreforfilter .= '</div>';
1040 $moreforfilter .= '</div>';
1041
1042 $moreforfilter .= '<div class="divsearchfield">';
1043 $moreforfilter .= $langs->trans('DateValueShort');
1044 $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
1045 $moreforfilter .= '<div class="nowrap inline-block">';
1046 $moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1047 $moreforfilter .= '</div>';
1048 $moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
1049 $moreforfilter .= '<div class="nowrap inline-block">';
1050 $moreforfilter .= $form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1051 $moreforfilter .= '</div>';
1052 $moreforfilter .= '</div>';
1053
1054 if (isModEnabled('categorie')) {
1055 // Categories
1056 if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
1057 $langs->load('categories');
1058
1059 // Bank line
1060 $moreforfilter .= '<div class="divsearchfield">';
1061 $tmptitle = $langs->trans('RubriquesTransactions');
1062 $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
1063 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0, '', 0, 0, 0, '', '', 1);
1064 $moreforfilter .= '</div>';
1065 }
1066 }
1067
1068 $parameters = array();
1069 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
1070 if (empty($reshook)) {
1071 $moreforfilter .= $hookmanager->resPrint;
1072 } else {
1073 $moreforfilter = $hookmanager->resPrint;
1074 }
1075
1076 if ($moreforfilter) {
1077 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1078 print $moreforfilter;
1079 print '</div>'."\n";
1080 }
1081
1082 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1083 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
1084 // When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation).
1085 if ($action == 'reconcile') {
1086 $arrayfields['b.num_releve']['checked'] = 1;
1087 }
1088
1089 print '<div class="div-table-responsive">';
1090 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1091
1092
1093 print '<tr class="liste_titre_filter">';
1094 if (!empty($arrayfields['b.rowid']['checked'])) {
1095 print '<td class="liste_titre">';
1096 print '<input type="text" class="flat" name="search_ref" size="2" value="'.dol_escape_htmltag($search_ref).'">';
1097 print '</td>';
1098 }
1099 if (!empty($arrayfields['b.label']['checked'])) {
1100 print '<td class="liste_titre">';
1101 print '<input type="text" class="flat maxwidth100" name="search_description" value="'.dol_escape_htmltag($search_description).'">';
1102 print '</td>';
1103 }
1104 if (!empty($arrayfields['b.dateo']['checked'])) {
1105 print '<td class="liste_titre">&nbsp;</td>';
1106 }
1107 if (!empty($arrayfields['b.datev']['checked'])) {
1108 print '<td class="liste_titre">&nbsp;</td>';
1109 }
1110 if (!empty($arrayfields['type']['checked'])) {
1111 print '<td class="liste_titre" align="center">';
1112 print $form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
1113 print '</td>';
1114 }
1115 // Numero
1116 if (!empty($arrayfields['b.num_chq']['checked'])) {
1117 print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
1118 }
1119 // Checked
1120 if (!empty($arrayfields['bu.label']['checked'])) {
1121 print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).'"></td>';
1122 }
1123 // Ref
1124 if (!empty($arrayfields['ba.ref']['checked'])) {
1125 print '<td class="liste_titre">';
1126 $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, 'maxwidth100');
1127 print '</td>';
1128 }
1129 // Debit
1130 if (!empty($arrayfields['b.debit']['checked'])) {
1131 print '<td class="liste_titre right">';
1132 print '<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).'">';
1133 print '</td>';
1134 }
1135 // Credit
1136 if (!empty($arrayfields['b.credit']['checked'])) {
1137 print '<td class="liste_titre right">';
1138 print '<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).'">';
1139 print '</td>';
1140 }
1141 // Balance before
1142 if (!empty($arrayfields['balancebefore']['checked'])) {
1143 print '<td class="liste_titre right">';
1144 $htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
1145 print $form->textwithpicto('', $htmltext, 1);
1146 print '</td>';
1147 }
1148 // Balance
1149 if (!empty($arrayfields['balance']['checked'])) {
1150 print '<td class="liste_titre right">';
1151 $htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
1152 print $form->textwithpicto('', $htmltext, 1);
1153 print '</td>';
1154 }
1155 // Numero statement
1156 if (!empty($arrayfields['b.num_releve']['checked'])) {
1157 print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
1158 }
1159 // Conciliated
1160 if (!empty($arrayfields['b.conciliated']['checked'])) {
1161 print '<td class="liste_titre center parentonrightofpage">';
1162 print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1, 'search_status onrightofpage maxwidth75');
1163 print '</td>';
1164 }
1165 // Bordereau
1166 if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
1167 print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).'" size="3"></td>';
1168 }
1169
1170 // Actions and select
1171 print '<td class="liste_titre" align="middle">';
1172 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
1173 print $searchpicto;
1174 print '</td>';
1175 print "</tr>\n";
1176
1177 // Fields title
1178 print '<tr class="liste_titre">';
1179 if (!empty($arrayfields['b.rowid']['checked'])) {
1180 print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
1181 }
1182 if (!empty($arrayfields['b.label']['checked'])) {
1183 print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder);
1184 }
1185 if (!empty($arrayfields['b.dateo']['checked'])) {
1186 print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center ");
1187 }
1188 if (!empty($arrayfields['b.datev']['checked'])) {
1189 print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, 'align="center"', $sortfield, $sortorder);
1190 }
1191 if (!empty($arrayfields['type']['checked'])) {
1192 print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder);
1193 }
1194 if (!empty($arrayfields['b.num_chq']['checked'])) {
1195 print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center ");
1196 }
1197 if (!empty($arrayfields['bu.label']['checked'])) {
1198 print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
1199 }
1200 if (!empty($arrayfields['ba.ref']['checked'])) {
1201 print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
1202 }
1203 if (!empty($arrayfields['b.debit']['checked'])) {
1204 print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
1205 }
1206 if (!empty($arrayfields['b.credit']['checked'])) {
1207 print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
1208 }
1209 if (!empty($arrayfields['balancebefore']['checked'])) {
1210 print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
1211 }
1212 if (!empty($arrayfields['balance']['checked'])) {
1213 print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
1214 }
1215 if (!empty($arrayfields['b.num_releve']['checked'])) {
1216 print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center ");
1217 }
1218 if (!empty($arrayfields['b.conciliated']['checked'])) {
1219 print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
1220 }
1221 if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
1222 print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
1223 }
1224
1225 // Extra fields
1226 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1227 // Hook fields
1228 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
1229 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
1230 print $hookmanager->resPrint;
1231 // Actions and select
1232 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
1233 print "</tr>\n";
1234
1235 $balance = 0; // For balance
1236 $balancebefore = 0; // For balance
1237 $balancecalculated = false;
1238 $posconciliatecol = 0;
1239 $cachebankaccount = array();
1240
1241 // Loop on each record
1242 $sign = 1;
1243
1244 while ($i < min($num, $limit)) {
1245 $objp = $db->fetch_object($resql);
1246 $links = $bankaccountstatic->get_url($objp->rowid);
1247
1248 // If we are in a situation where we need/can show balance, we calculate the start of balance
1249 if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0')) {
1250 if (!$search_account) {
1251 dol_print_error('', 'account is not defined but $mode_balance_ok is true');
1252 exit;
1253 }
1254
1255 // Loop on each record before
1256 $sign = 1;
1257 $i = 0;
1258 $sqlforbalance = 'SELECT SUM(b.amount) as previoustotal';
1259 $sqlforbalance .= " FROM ";
1260 $sqlforbalance .= " ".MAIN_DB_PREFIX."bank_account as ba,";
1261 $sqlforbalance .= " ".MAIN_DB_PREFIX."bank as b";
1262 $sqlforbalance .= " WHERE b.fk_account = ba.rowid";
1263 $sqlforbalance .= " AND ba.entity IN (".getEntity('bank_account').")";
1264 $sqlforbalance .= " AND b.fk_account = ".((int) $search_account);
1265 $sqlforbalance .= " AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
1266 $resqlforbalance = $db->query($sqlforbalance);
1267 //print $sqlforbalance;
1268 if ($resqlforbalance) {
1269 $objforbalance = $db->fetch_object($resqlforbalance);
1270 if ($objforbalance) {
1271 // If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
1272 if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
1273 $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
1274 } else {
1275 // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
1276 $balance = $objforbalance->previoustotal;
1277 }
1278 }
1279 } else {
1280 dol_print_error($db);
1281 }
1282
1283 $balancecalculated = true;
1284
1285 // Output a line with start balance
1286 if ($user->rights->banque->consolidate && $action == 'reconcile') {
1287 $tmpnbfieldbeforebalance = 0;
1288 $tmpnbfieldafterbalance = 0;
1289 $balancefieldfound = 0;
1290 foreach ($arrayfields as $key => $val) {
1291 if ($key == 'balancebefore' || $key == 'balance') {
1292 $balancefieldfound++;
1293 continue;
1294 }
1295 if (!empty($arrayfields[$key]['checked'])) {
1296 if (!$balancefieldfound) {
1297 $tmpnbfieldbeforebalance++;
1298 } else {
1299 $tmpnbfieldafterbalance++;
1300 }
1301 }
1302 }
1303 // Extra fields
1304 $element = 'banktransaction';
1305 if (!empty($extrafields->attributes[$element]['label']) && is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label'])) {
1306 foreach ($extrafields->attributes[$element]['label'] as $key => $val) {
1307 if (!empty($arrayfields["ef.".$key]['checked'])) {
1308 if (!empty($arrayfields[$key]['checked'])) {
1309 if (!$balancefieldfound) {
1310 $tmpnbfieldbeforebalance++;
1311 } else {
1312 $tmpnbfieldafterbalance++;
1313 }
1314 }
1315 }
1316 }
1317 }
1318
1319 print '<tr class="oddeven trforbreak">';
1320 if ($tmpnbfieldbeforebalance) {
1321 print '<td colspan="'.$tmpnbfieldbeforebalance.'">';
1322 print '&nbsp;';
1323 print '</td>';
1324 }
1325
1326 if (!empty($arrayfields['balancebefore']['checked'])) {
1327 print '<td class="right">';
1328 if ($search_conciliated !== '0') {
1329 print price(price2num($balance, 'MT'), 1, $langs);
1330 }
1331 print '</td>';
1332 }
1333 if (!empty($arrayfields['balance']['checked'])) {
1334 print '<td class="right">';
1335 if ($search_conciliated !== '0') {
1336 print price(price2num($balance, 'MT'), 1, $langs);
1337 }
1338 print '</td>';
1339 }
1340 if (!empty($arrayfields['b.num_releve']['checked'])) {
1341 print '<td class="center">';
1342 print '<input type="checkbox" id="selectAll" title="'.dol_escape_htmltag($langs->trans("SelectAll")).'" />';
1343 print ' <script type="text/javascript">
1344 $("input#selectAll").change(function() {
1345 $("input[type=checkbox][name^=rowid]").prop("checked", $(this).is(":checked"));
1346 });
1347 </script>';
1348 print '</td>';
1349 }
1350 print '<td colspan="'.($tmpnbfieldafterbalance + 1).'">';
1351 print '&nbsp;';
1352 print '</td>';
1353 print '</tr>';
1354 }
1355 }
1356
1357 if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
1358 $balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
1359 $balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
1360 } else {
1361 $balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc)
1362 $balance = price2num($balance + ($sign * $objp->amount), 'MT');
1363 }
1364
1365 if (empty($cachebankaccount[$objp->bankid])) {
1366 $bankaccounttmp = new Account($db);
1367 $bankaccounttmp->fetch($objp->bankid);
1368 $cachebankaccount[$objp->bankid] = $bankaccounttmp;
1369 $bankaccount = $bankaccounttmp;
1370 } else {
1371 $bankaccount = $cachebankaccount[$objp->bankid];
1372 }
1373
1374 if (empty($conf->global->BANK_COLORIZE_MOVEMENT)) {
1375 $backgroundcolor = "class='oddeven'";
1376 } else {
1377 if ($objp->amount < 0) {
1378 $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
1379 $backgroundcolor = 'style="background: '.$color.';"';
1380 } else {
1381 $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
1382 $backgroundcolor = 'style="background: '.$color.';"';
1383 }
1384 }
1385
1386 $banklinestatic->id = $objp->rowid;
1387 $banklinestatic->ref = $objp->rowid;
1388
1389 print '<tr class="oddeven" '.$backgroundcolor.'>';
1390
1391 // Ref
1392 if (!empty($arrayfields['b.rowid']['checked'])) {
1393 print '<td class="nowrap left">';
1394 print $banklinestatic->getNomUrl(1);
1395 print '</td>';
1396 if (!$i) {
1397 $totalarray['nbfield']++;
1398 }
1399 }
1400
1401 // Description
1402 if (!empty($arrayfields['b.label']['checked'])) {
1403 $labeltoshow = '';
1404 $titletoshow = '';
1405 $reg = array();
1406 preg_match('/\‍((.+)\‍)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction
1407 if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
1408 $labeltoshow = $langs->trans($reg[1]);
1409 } else {
1410 if ($objp->label == '(payment_salary)') {
1411 $labeltoshow = $langs->trans("SalaryPayment");
1412 } else {
1413 $labeltoshow = dol_escape_htmltag($objp->label);
1414 $titletoshow = $objp->label;
1415 }
1416 }
1417
1418
1419 print '<td class="tdoverflowmax250"'.($titletoshow ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>';
1420
1421 // Add info about links after description
1422 $cachebankaccount = array();
1423 foreach ($links as $key => $val) {
1424 print '<!-- '.$links[$key]['type'].' -->';
1425 if ($links[$key]['type'] == 'withdraw') {
1426 $banktransferstatic->id = $links[$key]['url_id'];
1427 $banktransferstatic->ref = $links[$key]['label'];
1428 print $banktransferstatic->getNomUrl(0).($labeltoshow ? ' ' : '');
1429 } elseif ($links[$key]['type'] == 'payment') {
1430 $paymentstatic->id = $links[$key]['url_id'];
1431 $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment
1432 $paymentstatic->date = $db->jdate($objp->do);
1433 print $paymentstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1434 } elseif ($links[$key]['type'] == 'payment_supplier') {
1435 $paymentsupplierstatic->id = $links[$key]['url_id'];
1436 $paymentsupplierstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment
1437 print $paymentsupplierstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1438 } elseif ($links[$key]['type'] == 'payment_sc') {
1439 $paymentscstatic->id = $links[$key]['url_id'];
1440 $paymentscstatic->ref = $links[$key]['url_id'];
1441 $paymentscstatic->label = $links[$key]['label'];
1442 print $paymentscstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1443 } elseif ($links[$key]['type'] == 'payment_vat') {
1444 $paymentvatstatic->id = $links[$key]['url_id'];
1445 $paymentvatstatic->ref = $links[$key]['url_id'];
1446 print $paymentvatstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1447 } elseif ($links[$key]['type'] == 'payment_salary') {
1448 $paymentsalstatic->id = $links[$key]['url_id'];
1449 $paymentsalstatic->ref = $links[$key]['url_id'];
1450 $paymentsalstatic->label = $links[$key]['label'];
1451 print $paymentsalstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1452 } elseif ($links[$key]['type'] == 'payment_loan') {
1453 print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
1454 print ' '.img_object($langs->trans('ShowPayment'), 'payment').' ';
1455 print '</a>'.($labeltoshow ? ' ' : '');
1456 } elseif ($links[$key]['type'] == 'payment_donation') {
1457 $paymentdonationstatic->id = $links[$key]['url_id'];
1458 $paymentdonationstatic->ref = $links[$key]['url_id'];
1459 print $paymentdonationstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1460 } elseif ($links[$key]['type'] == 'payment_expensereport') {
1461 $paymentexpensereportstatic->id = $links[$key]['url_id'];
1462 $paymentexpensereportstatic->ref = $links[$key]['url_id'];
1463 print $paymentexpensereportstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1464 } elseif ($links[$key]['type'] == 'payment_various') {
1465 $paymentvariousstatic->id = $links[$key]['url_id'];
1466 $paymentvariousstatic->ref = $links[$key]['url_id'];
1467 print $paymentvariousstatic->getNomUrl(2).($labeltoshow ? ' ' : '');
1468 } elseif ($links[$key]['type'] == 'banktransfert') {
1469 // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
1470 if ($objp->amount > 0) {
1471 $banklinestatic->fetch($links[$key]['url_id']);
1472 $bankstatic->id = $banklinestatic->fk_account;
1473 $bankstatic->label = $banklinestatic->bank_account_ref;
1474 print $langs->trans("TransferFrom").' ';
1475 print $bankstatic->getNomUrl(1, 'transactions');
1476 print ' '.$langs->trans("toward").' ';
1477 $bankstatic->id = $objp->bankid;
1478 $bankstatic->label = $objp->bankref;
1479 print $bankstatic->getNomUrl(1, '');
1480 print ($labeltoshow ? ' - ' : '');
1481 } else {
1482 $bankstatic->id = $objp->bankid;
1483 $bankstatic->label = $objp->bankref;
1484 print $langs->trans("TransferFrom").' ';
1485 print $bankstatic->getNomUrl(1, '');
1486 print ' '.$langs->trans("toward").' ';
1487 $banklinestatic->fetch($links[$key]['url_id']);
1488 $bankstatic->id = $banklinestatic->fk_account;
1489 $bankstatic->label = $banklinestatic->bank_account_ref;
1490 print $bankstatic->getNomUrl(1, 'transactions');
1491 print ($labeltoshow ? ' - ' : '');
1492 }
1493 //var_dump($links);
1494 } elseif ($links[$key]['type'] == 'company') {
1495 } elseif ($links[$key]['type'] == 'user') {
1496 } elseif ($links[$key]['type'] == 'member') {
1497 } elseif ($links[$key]['type'] == 'sc') {
1498 } elseif ($links[$key]['type'] == 'vat') {
1499 } elseif ($links[$key]['type'] == 'salary') {
1500 // Information is already shown using the payment_salary link. No need of this link.
1501 } else {
1502 // Show link with label $links[$key]['label']
1503 print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
1504 if (preg_match('/^\‍((.*)\‍)$/i', $links[$key]['label'], $reg)) {
1505 // Label generique car entre parentheses. On l'affiche en le traduisant
1506 if ($reg[1] == 'paiement') {
1507 $reg[1] = 'Payment';
1508 }
1509 print $langs->trans($reg[1]);
1510 } else {
1511 print $links[$key]['label'];
1512 }
1513 print '</a>'.($labeltoshow ? ' - ' : '');
1514 }
1515 }
1516
1517 print $labeltoshow; // Already escaped
1518
1519 print '</td>';
1520 if (!$i) {
1521 $totalarray['nbfield']++;
1522 }
1523 }
1524
1525 // Date ope
1526 if (!empty($arrayfields['b.dateo']['checked'])) {
1527 print '<td align="center" class="nowrap">';
1528 print '<span class="spanforajaxedit" id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
1529 print '&nbsp;';
1530 print '<span class="inline-block">';
1531 print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1532 print img_edit_remove()."</a> ";
1533 print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1534 print img_edit_add()."</a>";
1535 print '</span>';
1536 print "</td>\n";
1537 if (!$i) {
1538 $totalarray['nbfield']++;
1539 }
1540 }
1541
1542 // Date value
1543 if (!empty($arrayfields['b.datev']['checked'])) {
1544 print '<td align="center" class="nowrap">';
1545 print '<span class="spanforajaxedit" id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv), "day")."</span>";
1546 print '&nbsp;';
1547 print '<span class="inline-block">';
1548 print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1549 print img_edit_remove()."</a> ";
1550 print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1551 print img_edit_add()."</a>";
1552 print '</span>';
1553 print "</td>\n";
1554 if (!$i) {
1555 $totalarray['nbfield']++;
1556 }
1557 }
1558
1559 // Payment type
1560 if (!empty($arrayfields['type']['checked'])) {
1561 print '<td class="tdoverflowmax100">';
1562 $labeltype = ($langs->trans("PaymentTypeShort".$objp->fk_type) != "PaymentTypeShort".$objp->fk_type) ? $langs->trans("PaymentTypeShort".$objp->fk_type) : $langs->getLabelFromKey($db, $objp->fk_type, 'c_paiement', 'code', 'libelle', '', 1);
1563 if ($labeltype == 'SOLD') {
1564 print '&nbsp;'; //$langs->trans("InitialBankBalance");
1565 } else {
1566 print $labeltype;
1567 }
1568 print "</td>\n";
1569 if (!$i) {
1570 $totalarray['nbfield']++;
1571 }
1572 }
1573
1574 // Num cheque
1575 if (!empty($arrayfields['b.num_chq']['checked'])) {
1576 print '<td class="nowrap" align="center">'.($objp->num_chq ? dol_escape_htmltag($objp->num_chq) : "")."</td>\n";
1577 if (!$i) {
1578 $totalarray['nbfield']++;
1579 }
1580 }
1581
1582 // Third party
1583 if (!empty($arrayfields['bu.label']['checked'])) {
1584 print '<td class="tdoverflowmax150">';
1585
1586 $companylinked_id = 0;
1587 $userlinked_id = 0;
1588 $type_link = "";
1589
1590 //payment line type to define user display and user or company linked
1591 foreach ($links as $key => $value) {
1592 if ($links[$key]['type'] == 'payment_sc') {
1593 $type_link = 'payment_sc';
1594 }
1595 if ($links[$key]['type'] == 'payment_salary') {
1596 $type_link = 'payment_salary';
1597 }
1598
1599 if ($links[$key]['type'] == 'company') {
1600 $companylinked_id = $links[$key]['url_id'];
1601 }
1602 if ($links[$key]['type'] == 'user') {
1603 $userlinked_id = $links[$key]['url_id'];
1604 }
1605 }
1606
1607 if ($companylinked_id) {
1608 // TODO Add a cache of loaded companies here ?
1609 $companystatic->fetch($companylinked_id);
1610 print $companystatic->getNomUrl(1);
1611 } elseif ($userlinked_id &&
1612 (($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
1613 || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
1614 // Get object user from cache or load it
1615 if (!empty($conf->cache['user'][$userlinked_id])) {
1616 $tmpuser = $conf->cache['user'][$userlinked_id];
1617 } else {
1618 $tmpuser = new User($db);
1619 $tmpuser->fetch($userlinked_id);
1620 $conf->cache['user'][$userlinked_id] = $tmpuser;
1621 }
1622 print $tmpuser->getNomUrl(1);
1623 } else {
1624 print '&nbsp;';
1625 }
1626
1627 print '</td>';
1628 if (!$i) {
1629 $totalarray['nbfield']++;
1630 }
1631 }
1632
1633 // Bank account
1634 if (!empty($arrayfields['ba.ref']['checked'])) {
1635 print '<td class="nowrap">';
1636 print $bankaccount->getNomUrl(1);
1637 print "</td>\n";
1638 if (!$i) {
1639 $totalarray['nbfield']++;
1640 }
1641 }
1642
1643 // Debit
1644 if (!empty($arrayfields['b.debit']['checked'])) {
1645 print '<td class="nowrap right"><span class="amount">';
1646 if ($objp->amount < 0) {
1647 print price($objp->amount * -1);
1648 $totalarray['totaldeb'] += $objp->amount;
1649 }
1650 print "</span></td>\n";
1651 if (!$i) {
1652 $totalarray['nbfield']++;
1653 }
1654 if (!$i) {
1655 $totalarray['totaldebfield'] = $totalarray['nbfield'];
1656 }
1657 }
1658
1659 // Credit
1660 if (!empty($arrayfields['b.credit']['checked'])) {
1661 print '<td class="nowrap right"><span class="amount">';
1662 if ($objp->amount > 0) {
1663 print price($objp->amount);
1664 $totalarray['totalcred'] += $objp->amount;
1665 }
1666 print "</span></td>\n";
1667 if (!$i) {
1668 $totalarray['nbfield']++;
1669 }
1670 if (!$i) {
1671 $totalarray['totalcredfield'] = $totalarray['nbfield'];
1672 }
1673 }
1674
1675 // Balance before
1676 if (!empty($arrayfields['balancebefore']['checked'])) {
1677 if ($mode_balance_ok) {
1678 if ($balancebefore >= 0) {
1679 print '<td class="nowrap right">&nbsp;'.price($balancebefore).'</td>';
1680 } else {
1681 print '<td class="error nowrap right">&nbsp;'.price($balancebefore).'</td>';
1682 }
1683 } else {
1684 print '<td class="right">-</td>';
1685 }
1686 if (!$i) {
1687 $totalarray['nbfield']++;
1688 }
1689 }
1690
1691 // Balance after
1692 if (!empty($arrayfields['balance']['checked'])) {
1693 if ($mode_balance_ok) {
1694 if ($balance >= 0) {
1695 print '<td class="nowrap right">&nbsp;'.price($balance).'</td>';
1696 } else {
1697 print '<td class="error nowrap right">&nbsp;'.price($balance).'</td>';
1698 }
1699 } else {
1700 print '<td class="right">-</td>';
1701 }
1702 if (!$i) {
1703 $totalarray['nbfield']++;
1704 }
1705 }
1706
1707 if (!empty($arrayfields['b.num_releve']['checked'])) {
1708 print '<td class="nowraponall" align="center">';
1709 // Transaction reconciliated or edit link
1710 if ($bankaccount->canBeConciliated() > 0) {
1711 if ($objp->num_releve) {
1712 print '<a href="releve.php?num='.urlencode($objp->num_releve).'&account='.urlencode($objp->bankid).'&save_lastsearch_values=1">'.dol_escape_htmltag($objp->num_releve).'</a>';
1713 }
1714 if (!$objp->conciliated && $action == 'reconcile') {
1715 if ($objp->num_releve) {
1716 print '&nbsp;';
1717 }
1718 print '<input class="flat" name="rowid['.$objp->rowid.']" type="checkbox" value="'.$objp->rowid.'" size="1"'.(!empty($_POST['rowid'][$objp->rowid]) ? ' checked' : '').'>';
1719 }
1720 }
1721 print '</td>';
1722 if (!$i) {
1723 $totalarray['nbfield']++;
1724 $posconciliatecol = $totalarray['nbfield'];
1725 }
1726 }
1727
1728 if (!empty($arrayfields['b.conciliated']['checked'])) {
1729 print '<td class="nowraponall" align="center">';
1730 print yn($objp->conciliated);
1731 print '</td>';
1732 if (!$i) {
1733 $totalarray['nbfield']++;
1734 }
1735 }
1736
1737 if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
1738 $bordereaustatic->fetch($objp->fk_bordereau);
1739 print '<td class="nowraponall" align="center">';
1740 print $bordereaustatic->getNomUrl();
1741 print '</td>';
1742 if (!$i) {
1743 $totalarray['nbfield']++;
1744 }
1745 }
1746
1747 // Fields from hook
1748 $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
1749 $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
1750 print $hookmanager->resPrint;
1751
1752 // Action edit/delete and select
1753 print '<td class="nowraponall" align="center">';
1754 // Transaction reconciliated or edit link
1755 if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
1756 print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
1757 print img_edit();
1758 print '</a>';
1759 } else {
1760 if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
1761 print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
1762 print img_edit();
1763 print '</a>';
1764 } else {
1765 print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
1766 print img_view();
1767 print '</a>';
1768 }
1769 if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated)) {
1770 if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay)) {
1771 print ' '.img_warning($langs->trans("ReconciliationLate"));
1772 }
1773 }
1774 if ($user->rights->banque->modifier) {
1775 print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
1776 print img_delete('', 'class="marginleftonly"');
1777 print '</a>';
1778 }
1779 }
1780
1781 // Action column
1782 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1783 $selected = 0;
1784 if (in_array($obj->rowid, $arrayofselected)) {
1785 $selected = 1;
1786 }
1787 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1788 }
1789 print '</td>';
1790 if (!$i) {
1791 $totalarray['nbfield']++;
1792 }
1793
1794 print "</tr>\n";
1795
1796 $i++;
1797 }
1798
1799 // Show total line
1800 if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield'])) {
1801 print '<tr class="liste_total">';
1802 $i = 0;
1803 while ($i < $totalarray['nbfield']) {
1804 $i++;
1805 if ($i == 1) {
1806 if ($num < $limit && empty($offset)) {
1807 print '<td class="left">'.$langs->trans("Total").'</td>';
1808 } else {
1809 print '<td class="left tdoverflowmax50" title="'.$langs->trans("Totalforthispage").'">'.$langs->trans("Totalforthispage").'</td>';
1810 }
1811 } elseif ($totalarray['totaldebfield'] == $i) {
1812 print '<td class="right"><span class="amount">'.price(-1 * $totalarray['totaldeb']).'</span></td>';
1813 } elseif ($totalarray['totalcredfield'] == $i) {
1814 print '<td class="right"><span class="amount">'.price($totalarray['totalcred']).'</span></td>';
1815 } elseif ($i == $posconciliatecol) {
1816 print '<td class="center">';
1817 if ($user->rights->banque->consolidate && $action == 'reconcile') {
1818 print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">';
1819 }
1820 print '</td>';
1821 } else {
1822 print '<td></td>';
1823 }
1824 }
1825 print '</tr>';
1826 }
1827
1828 // If no record found
1829 if ($num == 0) {
1830 $colspan = 1;
1831 foreach ($arrayfields as $key => $val) {
1832 if (!empty($val['checked'])) {
1833 $colspan++;
1834 }
1835 }
1836 print '<tr><td colspan="'.($colspan + 1).'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1837 }
1838
1839 print "</table>";
1840 print "</div>";
1841
1842 print '</form>';
1843 $db->free($resql);
1844} else {
1845 dol_print_error($db);
1846}
1847
1848// End of page
1849llxFooter();
1850$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Definition bank.lib.php:37
Class to manage bank accounts.
Class to manage bank transaction lines.
Class to manage members of a foundation.
Class to manage bank categories.
Class to manage withdrawal receipts.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
Class to manage donations.
Definition don.class.php:40
Class to manage standard extra fields.
Class to manage generation of HTML components for accounting management.
Class to manage generation of HTML components Only common components must be here.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='minwidth75', $addjscombo=1, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
Classe permettant la generation de composants html autre Only common components are here.
Loan.
Class to manage payments for supplier invoices.
Class to manage payments of customer invoices.
Class to manage payments of donations.
Class to manage payments of expense report.
Class to manage payments of salaries.
Class to manage payments of social contributions.
Class to manage payments of social contributions.
Class to manage various payments.
Class to manage cheque delivery receipts.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
img_view($titlealt='default', $float=0, $other='class="valignmiddle"')
Show logo view card.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_edit_add($titlealt='default', $other='')
Show logo +.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
img_edit_remove($titlealt='default', $other='')
Show logo -.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.