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