dolibarr 20.0.5
bank.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
7 * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
8 * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
10 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
33// Load Dolibarr environment
34require '../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
41if (isModEnabled('holiday')) {
42 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
43}
44if (isModEnabled('expensereport')) {
45 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
46}
47if (isModEnabled('salaries')) {
48 require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
49 require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
50}
51
52// Load translation files required by page
53$langs->loadLangs(array('companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries'));
54
55$id = GETPOSTINT('id');
56$ref = GETPOST('ref', 'alphanohtml');
57$bankid = GETPOSTINT('bankid');
58$action = GETPOST("action", 'alpha');
59$cancel = GETPOST('cancel', 'alpha');
60
61// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
62$hookmanager->initHooks(array('usercardBank', 'globalcard'));
63
64// Security check
65$socid = 0;
66if ($user->socid > 0) {
67 $socid = $user->socid;
68}
69$feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user');
70
71$object = new User($db);
72if ($id > 0 || !empty($ref)) {
73 $result = $object->fetch($id, $ref, '', 1);
74 $object->getrights();
75}
76
77$account = new UserBankAccount($db);
78if (!$bankid) {
79 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
80 $account->fetch(0, '', $id);
81} else {
82 $account->fetch($bankid);
83}
84if (empty($account->userid)) {
85 $account->userid = $object->id;
86}
87
88// Define value to know what current user can do on users
89$selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer'));
90$canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') );
91$canreaduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') );
92$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission);
93$permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write');
94$permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write');
95$permissiontosimpleedit = ($selfpermission || $canadduser);
96
97$childids = $user->getAllChildIds(1);
98
99// Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read')
100//$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2);
101$ok = false;
102if ($user->id == $id) {
103 $ok = true; // A user can always read its own card
104}
105if ($user->hasRight('salaries', 'readall')) {
106 $ok = true;
107}
108if ($user->hasRight('hrm', 'read')) {
109 $ok = true;
110}
111if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'readall') && in_array($object->id, $childids))) {
112 $ok = true;
113}
114if ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && in_array($object->id, $childids))) {
115 $ok = true;
116}
117if (!$ok) {
119}
120
121
122/*
123 * Actions
124 */
125
126if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) {
127 $account->userid = $object->id;
128
129 $account->bank = GETPOST('bank', 'alpha');
130 $account->label = GETPOST('label', 'alpha');
131 $account->type = GETPOSTINT('courant'); // not used
132 $account->code_banque = GETPOST('code_banque', 'alpha');
133 $account->code_guichet = GETPOST('code_guichet', 'alpha');
134 $account->number = GETPOST('number', 'alpha');
135 $account->cle_rib = GETPOST('cle_rib', 'alpha');
136 $account->bic = GETPOST('bic', 'alpha');
137 $account->iban = GETPOST('iban', 'alpha');
138 $account->domiciliation = GETPOST('address', 'alpha');
139 $account->address = GETPOST('address', 'alpha');
140 $account->owner_name = GETPOST('proprio', 'alpha');
141 $account->proprio = $account->owner_name;
142 $account->owner_address = GETPOST('owner_address', 'alpha');
143
144 $account->currency_code = trim(GETPOST("account_currency_code"));
145 $account->state_id = GETPOSTINT("account_state_id");
146 $account->country_id = GETPOSTINT("account_country_id");
147
148 $result = $account->create($user);
149
150 if (!$result) {
151 setEventMessages($account->error, $account->errors, 'errors');
152 $action = 'edit'; // Force chargement page edition
153 } else {
154 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
155 $action = '';
156 }
157}
158
159if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
160 $account->userid = $object->id;
161
162 $account->bank = GETPOST('bank', 'alpha');
163 $account->label = GETPOST('label', 'alpha');
164 $account->type = GETPOSTINT('courant'); // not used
165 $account->code_banque = GETPOST('code_banque', 'alpha');
166 $account->code_guichet = GETPOST('code_guichet', 'alpha');
167 $account->number = GETPOST('number', 'alpha');
168 $account->cle_rib = GETPOST('cle_rib', 'alpha');
169 $account->bic = GETPOST('bic', 'alpha');
170 $account->iban = GETPOST('iban', 'alpha');
171 $account->domiciliation = GETPOST('address', 'alpha');
172 $account->address = GETPOST('address', 'alpha');
173 $account->proprio = GETPOST('proprio', 'alpha');
174 $account->owner_address = GETPOST('owner_address', 'alpha');
175
176 $account->currency_code = trim(GETPOST("account_currency_code"));
177 $account->state_id = GETPOSTINT("account_state_id");
178 $account->country_id = GETPOSTINT("account_country_id");
179
180 $result = $account->update($user);
181
182 if (!$result) {
183 setEventMessages($account->error, $account->errors, 'errors');
184 $action = 'edit'; // Force chargement page edition
185 } else {
186 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
187 $action = '';
188 }
189}
190
191if ($action == 'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
192 $result = $account->delete($user);
193 if ($result < 0) {
194 setEventMessages($account->error, $account->errors, 'errors');
195 } else {
196 setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
197 header("Location: ".DOL_URL_ROOT.'/user/bank.php?id='.$object->id);
198 exit;
199 }
200 $action = '';
201}
202
203// update birth
204if ($action == 'setbirth' && $canadduser && !$cancel) {
205 $object->birth = dol_mktime(0, 0, 0, GETPOSTINT('birthmonth'), GETPOSTINT('birthday'), GETPOSTINT('birthyear'));
206 $result = $object->update($user);
207 if ($result < 0) {
208 setEventMessages($object->error, $object->errors, 'errors');
209 }
210}
211
212// update personal email
213if ($action == 'setpersonal_email' && $permissiontosimpleedit && !$cancel) {
214 $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml');
215 $result = $object->update($user);
216 if ($result < 0) {
217 setEventMessages($object->error, $object->errors, 'errors');
218 }
219}
220
221// update personal mobile
222if ($action == 'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) {
223 $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml');
224 $result = $object->update($user);
225 if ($result < 0) {
226 setEventMessages($object->error, $object->errors, 'errors');
227 }
228}
229
230// update accountancy_code
231if ($action == 'setaccountancy_code' && $canadduser && !$cancel) {
232 $object->accountancy_code = (string) GETPOST('accountancy_code', 'alphanohtml');
233 $result = $object->update($user);
234 if ($result < 0) {
235 setEventMessages($object->error, $object->errors, 'errors');
236 }
237}
238
239// update ref_employee
240if ($action == 'setref_employee' && $canadduser && !$cancel) {
241 $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml');
242 $result = $object->update($user);
243 if ($result < 0) {
244 setEventMessages($object->error, $object->errors, 'errors');
245 }
246}
247
248// update national_registration_number
249if ($action == 'setnational_registration_number' && $canadduser && !$cancel) {
250 $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
251 $result = $object->update($user);
252 if ($result < 0) {
253 setEventMessages($object->error, $object->errors, 'errors');
254 }
255}
256
257if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) {
258 // update default_c_exp_tax_cat
259 if ($action == 'setdefault_c_exp_tax_cat' && $canadduser) {
260 $object->default_c_exp_tax_cat = GETPOSTINT('default_c_exp_tax_cat');
261 $result = $object->update($user);
262 if ($result < 0) {
263 setEventMessages($object->error, $object->errors, 'errors');
264 }
265 }
266
267 // update default range
268 if ($action == 'setdefault_range' && $canadduser) {
269 $object->default_range = GETPOSTINT('default_range');
270 $result = $object->update($user);
271 if ($result < 0) {
272 setEventMessages($object->error, $object->errors, 'errors');
273 }
274 }
275}
276
277
278/*
279 * View
280 */
281
282$form = new Form($db);
283$formcompany = new FormCompany($db);
284
285$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
286$title = $person_name." - ".$langs->trans('BankAccounts');
287$help_url = '';
288llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-bank');
289
291
292if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccount) {
293 if ($conf->use_javascript_ajax) {
294 print "\n<script>";
295 print 'jQuery(document).ready(function () {
296 jQuery("#type").change(function() {
297 document.formbank.action.value="edit";
298 document.formbank.submit();
299 });
300 jQuery("#selectaccount_country_id").change(function() {
301 document.formbank.action.value="edit";
302 document.formbank.submit();
303 });
304 })';
305 print "</script>\n";
306 }
307 print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
308 print '<input type="hidden" name="token" value="'.newToken().'">';
309 print '<input type="hidden" name="action" value="update">';
310 print '<input type="hidden" name="id" value="'.GETPOSTINT("id").'">';
311 print '<input type="hidden" name="bankid" value="'.$bankid.'">';
312}
313if ($id && $action == 'create' && !$cancel && $permissiontoaddbankaccount) {
314 if ($conf->use_javascript_ajax) {
315 print "\n<script>";
316 print 'jQuery(document).ready(function () {
317 jQuery("#type").change(function() {
318 document.formbank.action.value="create";
319 document.formbank.submit();
320 });
321 jQuery("#selectaccount_country_id").change(function() {
322 document.formbank.action.value="create";
323 document.formbank.submit();
324 });
325 })';
326 print "</script>\n";
327 }
328 print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
329 print '<input type="hidden" name="token" value="'.newToken().'">';
330 print '<input type="hidden" name="action" value="add">';
331 print '<input type="hidden" name="bankid" value="'.$bankid.'">';
332}
333
334
335// View
336if ($action != 'edit' && $action != 'create') { // If not bank account yet, $account may be empty
337 $title = $langs->trans("User");
338 print dol_get_fiche_head($head, 'bank', $title, -1, 'user');
339
340 $linkback = '';
341
342 if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
343 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
344 }
345
346 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
347 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
348 $morehtmlref .= '</a>';
349
350 $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
351 $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
352
353 dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref);
354
355 print '<div class="fichecenter"><div class="fichehalfleft">';
356
357 print '<div class="underbanner clearboth"></div>';
358
359 print '<table class="border centpercent tableforfield">';
360
361 print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
362 if (!empty($object->ldap_sid) && $object->statut == 0) {
363 print '<td class="error">';
364 print $langs->trans("LoginAccountDisableInDolibarr");
365 print '</td>';
366 } else {
367 print '<td>';
368 $addadmin = '';
369 if (property_exists($object, 'admin')) {
370 if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
371 $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
372 } elseif (!empty($object->admin)) {
373 $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
374 }
375 }
376 print showValueWithClipboardCPButton($object->login).$addadmin;
377 print '</td>';
378 }
379 print '</tr>';
380
381
382 // Hierarchy
383 print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
384 print '<td>';
385 if (empty($object->fk_user)) {
386 print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
387 } else {
388 $huser = new User($db);
389 if ($object->fk_user > 0) {
390 $huser->fetch($object->fk_user);
391 print $huser->getNomUrl(1);
392 } else {
393 print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
394 }
395 }
396 print '</td>';
397 print "</tr>\n";
398
399 // Expense report validator
400 if (isModEnabled('expensereport')) {
401 print '<tr><td>';
402 $text = $langs->trans("ForceUserExpenseValidator");
403 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
404 print '</td>';
405 print '<td>';
406 if (!empty($object->fk_user_expense_validator)) {
407 $evuser = new User($db);
408 $evuser->fetch($object->fk_user_expense_validator);
409 print $evuser->getNomUrl(1);
410 }
411 print '</td>';
412 print "</tr>\n";
413 }
414
415 // Holiday request validator
416 if (isModEnabled('holiday')) {
417 print '<tr><td>';
418 $text = $langs->trans("ForceUserHolidayValidator");
419 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
420 print '</td>';
421 print '<td>';
422 if (!empty($object->fk_user_holiday_validator)) {
423 $hvuser = new User($db);
424 $hvuser->fetch($object->fk_user_holiday_validator);
425 print $hvuser->getNomUrl(1);
426 }
427 print '</td>';
428 print "</tr>\n";
429 }
430
431 // Position/Job
432 print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
433 print '<td>'.dol_escape_htmltag($object->job).'</td>';
434 print '</tr>'."\n";
435
436 // Weeklyhours
437 print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
438 print '<td>';
439 print price2num($object->weeklyhours);
440 print '</td>';
441 print "</tr>\n";
442
443 // Sensitive salary/value information
444 if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
445 || (isModEnabled('salaries') && $user->hasRight('salaries', 'readall'))
446 || (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read'))) {
447 $langs->load("salaries");
448
449 // Salary
450 print '<tr><td>'.$langs->trans("Salary").'</td>';
451 print '<td>';
452 print($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, 0, $langs, 1, -1, -1, $conf->currency) : '').'</span>';
453 print '</td>';
454 print "</tr>\n";
455
456 // THM
457 print '<tr><td>';
458 $text = $langs->trans("THM");
459 print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
460 print '</td>';
461 print '<td>';
462 print($object->thm != '' ? price($object->thm, 0, $langs, 1, -1, -1, $conf->currency) : '');
463 print '</td>';
464 print "</tr>\n";
465
466 // TJM
467 print '<tr><td>';
468 $text = $langs->trans("TJM");
469 print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm');
470 print '</td>';
471 print '<td>';
472 print($object->tjm != '' ? price($object->tjm, 0, $langs, 1, -1, -1, $conf->currency) : '');
473 print '</td>';
474 print "</tr>\n";
475 }
476
477 // Date employment
478 print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
479 print '<td>';
480 if ($object->dateemployment) {
481 print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
482 print dol_print_date($object->dateemployment, 'day');
483 }
484 if ($object->dateemploymentend) {
485 print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
486 print dol_print_date($object->dateemploymentend, 'day');
487 }
488 print '</td>';
489 print "</tr>\n";
490
491 // Date of birth
492 if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
493 print '<tr>';
494 print '<td>';
495 print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'));
496 print '</td><td>';
497 print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'), 'day', $object->birth);
498 print '</td>';
499 print "</tr>\n";
500 }
501
502 // Personal email
503 if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) {
504 print '<tr class="nowrap">';
505 print '<td>';
506 print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
507 print '</td><td>';
508 print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'email', '', null, null, '', 0, '');
509 print '</td>';
510 print '</tr>';
511 }
512
513 // Personal phone
514 if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) {
515 print '<tr class="nowrap">';
516 print '<td>';
517 print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
518 print '</td><td>';
519 print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'phone', '', null, null, '', 0, '');
520 print '</td>';
521 print '</tr>';
522 }
523
524 if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) {
525 print '<tr class="nowrap">';
526 print '<td>';
527 print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer'));
528 print '</td><td>';
529 if ($action == 'editdefault_c_exp_tax_cat') {
530 $ret = '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
531 $ret .= '<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
532 $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
533 $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
534 $ret .= $form->selectExpenseCategories($object->default_c_exp_tax_cat, 'default_c_exp_tax_cat', 1);
535 $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
536 $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
537 $ret .= '</form>';
538 print $ret;
539 } else {
540 $label_exp_tax_cat = dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
541 print $langs->trans($label_exp_tax_cat);
542 //print $form->editfieldval("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer'), 'string', ($object->default_c_exp_tax_cat != '' ? $object->default_c_exp_tax_cat : ''));
543 }
544 print '</td>';
545 print '</tr>';
546
547 print '<tr class="nowrap">';
548 print '<td>';
549 print $form->editfieldkey("DefaultRangeNumber", 'default_range', $object->default_range, $object, $user->hasRight('user', 'user', 'creer'));
550 print '</td><td>';
551 if ($action == 'editdefault_range') {
552 $ret = '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
553 $ret .= '<input type="hidden" name="action" value="setdefault_range">';
554 $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
555 $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
556
557 $expensereportik = new ExpenseReportIk($db);
558 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
559
560 $ret .= $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range);
561 $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
562 $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
563 $ret .= '</form>';
564 print $ret;
565 } else {
566 print $object->default_range;
567 }
568 print '</td>';
569 print '</tr>';
570 }
571
572 // Accountancy code
573 if (isModEnabled('accounting')) {
574 print '<tr class="nowrap">';
575 print '<td>';
576 print $form->editfieldkey("AccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer'));
577 print '</td><td>';
578 print $form->editfieldval("AccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer'), 'string', '', null, null, '', 0, '');
579 print '</td>';
580 print '</tr>';
581 }
582
583 // Employee Number
584 if ($permissiontoreadhr) {
585 print '<tr class="nowrap">';
586 print '<td>';
587 print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr);
588 print '</td><td>';
589 print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr, 'string', $object->ref_employee);
590 print '</td>';
591 print '</tr>';
592 }
593
594 // National registration number
595 if ($permissiontoreadhr) {
596 print '<tr class="nowrap">';
597 print '<td>';
598 print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr);
599 print '</td><td>';
600 print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr, 'string', $object->national_registration_number);
601 print '</td>';
602 print '</tr>';
603 }
604
605 print '</table>';
606
607 print '</div><div class="fichehalfright">';
608
609 // Max number of elements in small lists
610 $MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
611
612 // Latest payments of salaries
613 if (isModEnabled('salaries') &&
614 (($user->hasRight('salaries', 'read') && (in_array($object->id, $childids) || $object->id == $user->id)) || ($user->hasRight('salaries', 'readall')))
615 ) {
616 $payment_salary = new PaymentSalary($db);
617 $salary = new Salary($db);
618
619 $sql = "SELECT s.rowid as sid, s.ref as sref, s.label, s.datesp, s.dateep, s.paye, s.amount, SUM(ps.amount) as alreadypaid";
620 $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
621 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)";
622 $sql .= " WHERE s.fk_user = ".((int) $object->id);
623 $sql .= " AND s.entity IN (".getEntity('salary').")";
624 $sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
625 $sql .= " ORDER BY s.dateep DESC";
626
627 $resql = $db->query($sql);
628 if ($resql) {
629 $num = $db->num_rows($resql);
630
631 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
632 print '<table class="noborder centpercent">';
633
634 print '<tr class="liste_titre">';
635 print '<td colspan="5"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/salaries/list.php?search_user='.$object->login.'">'.$langs->trans("AllSalaries").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
636 print '</tr></table></td>';
637 print '</tr>';
638
639 $i = 0;
640 while ($i < $num && $i < $MAXLIST) {
641 $objp = $db->fetch_object($resql);
642
643 $salary->id = $objp->sid;
644 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
645 $salary->label = $objp->label;
646 $salary->datesp = $db->jdate($objp->datesp);
647 $salary->dateep = $db->jdate($objp->dateep);
648 $salary->paye = $objp->paye;
649 $salary->amount = $objp->amount;
650
651 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
652 $payment_salary->ref = !empty($objp->ref) ? $objp->ref : "";
653 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep : "");
654
655 print '<tr class="oddeven">';
656 print '<td class="nowraponall">';
657 print $salary->getNomUrl(1);
658 print '</td>';
659 print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp), 'day')."</td>\n";
660 print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep), 'day')."</td>\n";
661 print '<td class="right nowraponall"><span class="amount">'.price($objp->amount).'</span></td>';
662 print '<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).'</td>';
663 print '</tr>';
664 $i++;
665 }
666 $db->free($resql);
667
668 if ($num <= 0) {
669 print '<td colspan="5"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
670 }
671 print "</table>";
672 print "</div>";
673 } else {
674 dol_print_error($db);
675 }
676 }
677
678 // Latest leave requests
679 if (isModEnabled('holiday') && ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && $object->id == $user->id))) {
680 $holiday = new Holiday($db);
681
682 $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
683 $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
684 $sql .= " WHERE h.fk_user = ".((int) $object->id);
685 $sql .= " AND h.entity IN (".getEntity('holiday').")";
686 $sql .= " ORDER BY h.date_debut DESC";
687
688 $resql = $db->query($sql);
689 if ($resql) {
690 $num = $db->num_rows($resql);
691
692 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
693 print '<table class="noborder centpercent">';
694
695 print '<tr class="liste_titre">';
696 print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastHolidays", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$object->id.'">'.$langs->trans("AllHolidays").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
697 print '</tr></table></td>';
698 print '</tr>';
699
700 $i = 0;
701 while ($i < $num && $i < $MAXLIST) {
702 $objp = $db->fetch_object($resql);
703
704 $holiday->id = $objp->rowid;
705 $holiday->ref = $objp->rowid;
706
707 $holiday->fk_type = $objp->fk_type;
708 $holiday->statut = $objp->status;
709 $holiday->status = $objp->status;
710
711 $nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday);
712
713 print '<tr class="oddeven">';
714 print '<td class="nowraponall">';
715 print $holiday->getNomUrl(1);
716 print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
717 print '<td class="right nowraponall">'.$nbopenedday.' '.$langs->trans('DurationDays').'</td>';
718 print '<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).'</td>';
719 print '</tr>';
720 $i++;
721 }
722 $db->free($resql);
723
724 if ($num <= 0) {
725 print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
726 }
727 print "</table>";
728 print "</div>";
729 } else {
730 dol_print_error($db);
731 }
732 }
733
734 // Latest expense report
735 if (isModEnabled('expensereport') &&
736 ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'lire') && $object->id == $user->id))
737 ) {
738 $exp = new ExpenseReport($db);
739
740 $sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
741 $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e";
742 $sql .= " WHERE e.fk_user_author = ".((int) $object->id);
743 $sql .= " AND e.entity = ".((int) $conf->entity);
744 $sql .= " ORDER BY e.date_debut DESC";
745
746 $resql = $db->query($sql);
747 if ($resql) {
748 $num = $db->num_rows($resql);
749
750 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
751 print '<table class="noborder centpercent">';
752
753 print '<tr class="liste_titre">';
754 print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastExpenseReports", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expensereport/list.php?id='.$object->id.'">'.$langs->trans("AllExpenseReports").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
755 print '</tr></table></td>';
756 print '</tr>';
757
758 $i = 0;
759 while ($i < $num && $i < $MAXLIST) {
760 $objp = $db->fetch_object($resql);
761
762 $exp->id = $objp->rowid;
763 $exp->ref = $objp->ref;
764 $exp->status = $objp->status;
765
766 print '<tr class="oddeven">';
767 print '<td class="nowraponall">';
768 print $exp->getNomUrl(1);
769 print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
770 print '<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).'</span></td>';
771 print '<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).'</td>';
772 print '</tr>';
773 $i++;
774 }
775 $db->free($resql);
776
777 if ($num <= 0) {
778 print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
779 }
780 print "</table>";
781 print "</div>";
782 } else {
783 dol_print_error($db);
784 }
785 }
786
787 print '</div></div>';
788 print '<div class="clearboth"></div>';
789
790 print dol_get_fiche_end();
791
792 // List of bank accounts (Currently only one bank account possible for each employee)
793
794 $morehtmlright = '';
795 if ($account->id == 0) {
796 if ($permissiontoaddbankaccount) {
797 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create');
798 } else {
799 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2);
800 }
801 } else {
802 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('AlreadyOneBankAccount'), 'fa fa-plus-circle', '', '', -2);
803 }
804
805 print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');
806
807 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
808 print '<table class="liste centpercent">';
809
810 print '<tr class="liste_titre">';
811 print_liste_field_titre("LabelRIB");
816 print_liste_field_titre("Currency");
817 print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
818 print "</tr>\n";
819
820 if ($account->id > 0) {
821 print '<tr class="oddeven">';
822 // Label
823 print '<td>'.dol_escape_htmltag($account->label).'</td>';
824 // Bank name
825 print '<td>'.dol_escape_htmltag($account->bank).'</td>';
826 // Account number
827 print '<td>';
828 $stringescaped = '';
829 foreach ($account->getFieldsToShow() as $val) {
830 if ($val == 'BankCode') {
831 $stringescaped .= dol_escape_htmltag($account->code_banque).' ';
832 } elseif ($val == 'BankAccountNumber') {
833 $stringescaped .= dol_escape_htmltag($account->number).' ';
834 } elseif ($val == 'DeskCode') {
835 $stringescaped .= dol_escape_htmltag($account->code_guichet).' ';
836 } elseif ($val == 'BankAccountNumberKey') {
837 $stringescaped .= dol_escape_htmltag($account->cle_rib).' ';
838 }
839 }
840 if (!empty($account->label) && $account->number) {
841 if (!checkBanForAccount($account)) {
842 $stringescaped .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning');
843 } else {
844 $stringescaped .= ' '.img_picto($langs->trans("ValueIsValid"), 'info');
845 }
846 }
847
848 print $stringescaped;
849 print '</td>';
850 // IBAN
851 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag(getIbanHumanReadable($account)).'">';
852 if (!empty($account->iban)) {
853 if (!checkIbanForAccount($account)) {
854 print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
855 }
856 }
857 print getIbanHumanReadable($account);
858 print '</td>';
859 // BIC
860 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($account->bic).'">';
861 if (!empty($account->bic)) {
862 if (!checkSwiftForAccount($account)) {
863 print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
864 }
865 }
866 print dol_escape_htmltag($account->bic);
867 print '</td>';
868
869 // Currency
870 print '<td>'.$account->currency_code.'</td>';
871
872 // Edit/Delete
873 print '<td class="right nowraponall">';
874 if ($permissiontoaddbankaccount) {
875 print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=edit&token='.newToken().'">';
876 print img_picto($langs->trans("Modify"), 'edit');
877 print '</a>';
878
879 print '<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=delete_confirmed&token='.newToken().'">';
880 print img_picto($langs->trans("Delete"), 'delete');
881 print '</a>';
882 }
883 print '</td>';
884
885 print '</tr>';
886 }
887
888
889 if ($account->id == 0) {
890 $colspan = 7;
891 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoBANRecord").'</span></td></tr>';
892 }
893
894
895
896 print '</table>';
897 print '</div>';
898
899 // Add hook in fields
900 $parameters = array('colspan' => ' colspan="2"');
901 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
902}
903
904// Edit
905if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankaccount) {
906 $title = $langs->trans("User");
907 print dol_get_fiche_head($head, 'bank', $title, 0, 'user');
908
909 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
910
911 dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin);
912
913 print '<div class="underbanner clearboth"></div>';
914 print '<br>';
915
916 print '<table class="border centpercent">';
917
918 print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Label").'</td>';
919 print '<td><input size="30" type="text" name="label" value="'.$account->label.'" autofocus></td></tr>';
920
921 print '<tr><td class="">'.$langs->trans("BankName").'</td>';
922 print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
923
924 // Currency
925 print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
926 print '<input type="hidden" value="'.$account->currency_code.'">';
927 print '</td>';
928 print '<td class="maxwidth200onsmartphone">';
929 $selectedcode = $account->currency_code;
930 if (!$selectedcode) {
931 $selectedcode = $conf->currency;
932 }
933 print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
934 print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
935 print '</td></tr>';
936
937 // Country
938 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
939 $selectedcode = $account->country_code;
940 if (GETPOSTISSET("account_country_id")) {
941 $selectedcode = GETPOST("account_country_id");
942 } elseif (empty($selectedcode)) {
943 $selectedcode = $mysoc->country_code;
944 }
945 $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
946
947 print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
948 print '<td class="maxwidth200onsmartphone">';
949 print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
950 if ($user->admin) {
951 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
952 }
953 print '</td></tr>';
954
955 // State
956 print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
957 if ($selectedcode) {
958 print img_picto('', 'state', 'class="pictofixedwidth"');
959 print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id');
960 } else {
961 print $countrynotdefined;
962 }
963 print '</td></tr>';
964
965
966 // Show fields of bank account
967 $bankaccount = $account;
968
969 // Code here is similar as in paymentmodes.php for third-parties
970 foreach ($bankaccount->getFieldsToShow(1) as $val) {
971 $require = false;
972 $tooltip = '';
973 if ($val == 'BankCode') {
974 $name = 'code_banque';
975 $size = 8;
976 $content = $bankaccount->code_banque;
977 } elseif ($val == 'DeskCode') {
978 $name = 'code_guichet';
979 $size = 8;
980 $content = $bankaccount->code_guichet;
981 } elseif ($val == 'BankAccountNumber') {
982 $name = 'number';
983 $size = 18;
984 $content = $bankaccount->number;
985 } elseif ($val == 'BankAccountNumberKey') {
986 $name = 'cle_rib';
987 $size = 3;
988 $content = $bankaccount->cle_rib;
989 } elseif ($val == 'IBAN') {
990 $name = 'iban';
991 $size = 30;
992 $content = $bankaccount->iban;
993 if ($bankaccount->needIBAN()) {
994 $require = true;
995 }
996 $tooltip = $langs->trans("Example").':<br>CH93 0076 2011 6238 5295 7<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
997 } elseif ($val == 'BIC') {
998 $name = 'bic';
999 $size = 12;
1000 $content = $bankaccount->bic;
1001 if ($bankaccount->needIBAN()) {
1002 $require = true;
1003 }
1004 $tooltip = $langs->trans("Example").': LIABLT2XXXX';
1005 }
1006 print '<tr>';
1007 print '<td'.($require ? ' class="fieldrequired" ' : '').'>';
1008 if ($tooltip) {
1009 print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name);
1010 } else {
1011 print $langs->trans($val);
1012 }
1013 print '</td>';
1014 print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
1015 print '</tr>';
1016 }
1017
1018 print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
1019 print '<textarea name="address" rows="4" class="quatrevingtpercent">';
1020 print dol_escape_htmltag($account->address);
1021 print "</textarea></td></tr>";
1022
1023 print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
1024 print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
1025 print "</td></tr>\n";
1026
1027 print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
1028 print '<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
1029 print dol_escape_htmltag($account->owner_address);
1030 print "</textarea></td></tr>";
1031
1032 print '</table>';
1033
1034 //print '</div>';
1035
1036 print dol_get_fiche_end();
1037
1038 print $form->buttonsSaveCancel($action == 'create' ? "Create" : "Modify");
1039}
1040
1041if ($id && $action == 'edit' && $permissiontoaddbankaccount) {
1042 print '</form>';
1043}
1044
1045if ($id && $action == 'create' && $permissiontoaddbankaccount) {
1046 print '</form>';
1047}
1048
1049// End of page
1050llxFooter();
1051$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
checkSwiftForAccount(Account $account=null, $swift=null)
Check SWIFT information for a bank account.
Definition bank.lib.php:284
checkIbanForAccount(Account $account=null, $ibantocheck=null)
Check IBAN number information for a bank account.
Definition bank.lib.php:305
checkBanForAccount($account)
Check account number information for a bank account.
Definition bank.lib.php:348
getIbanHumanReadable(Account $account)
Returns the iban human readable.
Definition bank.lib.php:330
Class to manage Trips and Expenses.
Class to manage inventories.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class of the module paid holiday.
Class to manage payments of salaries.
Class to manage salary payments.
Class to manage bank accounts description of users.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 '.
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.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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 dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.