dolibarr 24.0.0-beta
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}
103if (empty($account->userid)) {
104 $account->userid = $object->id;
105}
106
107// Define value to know what current user can do on users
108$selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer'));
109$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
110$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read'));
111$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission);
112$permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write');
113$permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write');
114$permissiontosimpleedit = ($selfpermission || $usercanadd);
115
116$childids = $user->getAllChildIds(1);
117
118// Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read')
119//restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2);
120$ok = false;
121if ($user->id == $id) {
122 $ok = true; // A user can always read its own card
123}
124if ($user->hasRight('salaries', 'readall')) {
125 $ok = true;
126}
127if ($user->hasRight('hrm', 'read')) {
128 $ok = true;
129}
130if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && in_array($object->id, $childids))) {
131 $ok = true;
132}
133if ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && in_array($object->id, $childids))) {
134 $ok = true;
135}
136if (!$ok) {
138}
139
140
141/*
142 * Actions
143 */
144
145if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) {
146 $account->userid = $object->id;
147
148 $account->bank = GETPOST('bank', 'alpha');
149 $account->label = GETPOST('label', 'alpha');
150 $account->type = GETPOSTINT('courant'); // not used
151 $account->code_banque = GETPOST('code_banque', 'alpha');
152 $account->code_guichet = GETPOST('code_guichet', 'alpha');
153 $account->number = GETPOST('number', 'alpha');
154 $account->cle_rib = GETPOST('cle_rib', 'alpha');
155 $account->bic = GETPOST('bic', 'alpha');
156 $account->iban = GETPOST('iban', 'alpha');
157 $account->address = GETPOST('address', 'alpha');
158
159 $account->owner_name = GETPOST('proprio', 'alpha');
160 $account->proprio = $account->owner_name;
161 $account->owner_address = GETPOST('owner_address', 'alpha');
162
163 $account->currency_code = trim(GETPOST("account_currency_code"));
164 $account->state_id = GETPOSTINT("account_state_id");
165 $account->country_id = GETPOSTINT("account_country_id");
166
167 $result = $account->create($user);
168
169 if (!$result) {
170 setEventMessages($account->error, $account->errors, 'errors');
171 $action = 'edit'; // Force chargement page edition
172 } else {
173 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
174 $action = '';
175 }
176}
177
178if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
179 $account->userid = $object->id;
180
181 $account->bank = GETPOST('bank', 'alpha');
182 $account->label = GETPOST('label', 'alpha');
183 $account->type = GETPOSTINT('courant'); // not used
184 $account->code_banque = GETPOST('code_banque', 'alpha');
185 $account->code_guichet = GETPOST('code_guichet', 'alpha');
186 $account->number = GETPOST('number', 'alpha');
187 $account->cle_rib = GETPOST('cle_rib', 'alpha');
188 $account->bic = GETPOST('bic', 'alpha');
189 $account->iban = GETPOST('iban', 'alpha');
190 $account->address = GETPOST('address', 'alpha');
191 $account->owner_name = GETPOST('proprio', 'alpha');
192 $account->proprio = $account->owner_name;
193 $account->owner_address = GETPOST('owner_address', 'alpha');
194
195 $account->currency_code = trim(GETPOST("account_currency_code"));
196 $account->state_id = GETPOSTINT("account_state_id");
197 $account->country_id = GETPOSTINT("account_country_id");
198
199 $result = $account->update($user);
200
201 if (!$result) {
202 setEventMessages($account->error, $account->errors, 'errors');
203 $action = 'edit'; // Force chargement page edition
204 } else {
205 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
206 $action = '';
207 }
208}
209
210if ($action == 'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
211 $result = $account->delete($user);
212 if ($result < 0) {
213 setEventMessages($account->error, $account->errors, 'errors');
214 } else {
215 setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
216 header("Location: ".DOL_URL_ROOT.'/user/bank.php?id='.$object->id);
217 exit;
218 }
219 $action = '';
220}
221
222// update birth (pure personal information)
223if ($action == 'setbirth' && $permissiontowritehr && !$cancel) {
224 $object->birth = dol_mktime(0, 0, 0, GETPOSTINT('birthmonth'), GETPOSTINT('birthday'), GETPOSTINT('birthyear'));
225 $result = $object->update($user);
226 if ($result < 0) {
227 setEventMessages($object->error, $object->errors, 'errors');
228 }
229}
230
231// update personal email
232if ($action == 'setpersonal_email' && $permissiontosimpleedit && !$cancel) {
233 $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml');
234 $result = $object->update($user);
235 if ($result < 0) {
236 setEventMessages($object->error, $object->errors, 'errors');
237 }
238}
239
240// update personal mobile
241if ($action == 'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) {
242 $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml');
243 $result = $object->update($user);
244 if ($result < 0) {
245 setEventMessages($object->error, $object->errors, 'errors');
246 }
247}
248
249// update accountancy_code_user_general
250if ($action == 'setaccountancycodeusergeneral' && $usercanadd) {
251 $result = $object->fetch($id);
252 $object->accountancy_code_user_general = GETPOST("accountancycodeusergeneral");
253 $result = $object->update($user);
254 if ($result < 0) {
255 setEventMessages($object->error, $object->errors, 'errors');
256 $action = 'editaccountancycodeusergeneral';
257 }
258}
259
260if ($action == 'setaccountancy_code' && $usercanadd && !$cancel) {
261 $object->accountancy_code = (string) GETPOST('accountancy_code', 'alphanohtml');
262 $result = $object->update($user);
263 if ($result < 0) {
264 setEventMessages($object->error, $object->errors, 'errors');
265 }
266}
267
268// update ref_employee
269if ($action == 'setref_employee' && $usercanadd && !$cancel) {
270 $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml');
271 $result = $object->update($user);
272 if ($result < 0) {
273 setEventMessages($object->error, $object->errors, 'errors');
274 }
275}
276
277// update national_registration_number (pure personal information)
278if ($action == 'setnational_registration_number' && $permissiontowritehr && !$cancel) {
279 $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
280 $result = $object->update($user);
281 if ($result < 0) {
282 setEventMessages($object->error, $object->errors, 'errors');
283 }
284}
285
286if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) {
287 // update default_c_exp_tax_cat
288 if ($action == 'setdefault_c_exp_tax_cat' && $usercanadd) {
289 $object->default_c_exp_tax_cat = GETPOSTINT('default_c_exp_tax_cat');
290 $result = $object->update($user);
291 if ($result < 0) {
292 setEventMessages($object->error, $object->errors, 'errors');
293 }
294 }
295
296 // update default range
297 if ($action == 'setdefault_range' && $usercanadd) {
298 $object->default_range = GETPOSTINT('default_range');
299 $result = $object->update($user);
300 if ($result < 0) {
301 setEventMessages($object->error, $object->errors, 'errors');
302 }
303 }
304}
305
306
307/*
308 * View
309 */
310
311$form = new Form($db);
312$formcompany = new FormCompany($db);
313
314$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
315$title = $person_name." - ".$langs->trans('BankAccounts');
316$help_url = '';
317llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-bank');
318
320
321if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccount) {
322 if ($conf->use_javascript_ajax) {
323 print "\n<script>";
324 print 'jQuery(document).ready(function () {
325 jQuery("#type").change(function() {
326 document.formbank.action.value="edit";
327 document.formbank.submit();
328 });
329 jQuery("#selectaccount_country_id").change(function() {
330 document.formbank.action.value="edit";
331 document.formbank.submit();
332 });
333 })';
334 print "</script>\n";
335 }
336 print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
337 print '<input type="hidden" name="token" value="'.newToken().'">';
338 print '<input type="hidden" name="action" value="update">';
339 print '<input type="hidden" name="id" value="'.GETPOSTINT("id").'">';
340 print '<input type="hidden" name="bankid" value="'.$bankid.'">';
341}
342if ($id && $action == 'create' && !$cancel && $permissiontoaddbankaccount) {
343 if ($conf->use_javascript_ajax) {
344 print "\n<script>";
345 print 'jQuery(document).ready(function () {
346 jQuery("#type").change(function() {
347 document.formbank.action.value="create";
348 document.formbank.submit();
349 });
350 jQuery("#selectaccount_country_id").change(function() {
351 document.formbank.action.value="create";
352 document.formbank.submit();
353 });
354 })';
355 print "</script>\n";
356 }
357 print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
358 print '<input type="hidden" name="token" value="'.newToken().'">';
359 print '<input type="hidden" name="action" value="add">';
360 print '<input type="hidden" name="bankid" value="'.$bankid.'">';
361}
362
363
364// View
365if ($action != 'edit' && $action != 'create') { // If not bank account yet, $account may be empty
366 $title = $langs->trans("User");
367 print dol_get_fiche_head($head, 'bank', $title, -1, 'user');
368
369 $linkback = '';
370
371 if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
372 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
373 }
374
375 $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">';
376 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard', 'class="valignmiddle marginleftonly paddingrightonly"');
377 $morehtmlref .= '</a>';
378
379 $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
380 $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'refid valignmiddle nohover');
381
382 dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref);
383
384 print '<div class="fichecenter"><div class="fichehalfleft">';
385
386 print '<div class="underbanner clearboth"></div>';
387
388 print '<table class="border centpercent tableforfield">';
389
390 print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
391 if (!empty($object->ldap_sid) && $object->statut == 0) {
392 print '<td class="error">';
393 print $langs->trans("LoginAccountDisableInDolibarr");
394 print '</td>';
395 } else {
396 print '<td>';
397 $addadmin = '';
398 if (property_exists($object, 'admin')) {
399 if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
400 $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "superadmin", 'class="paddingleft valignmiddle"');
401 } elseif (!empty($object->admin)) {
402 $addadmin .= img_picto($langs->trans("AdministratorDesc"), "admin", 'class="paddingleft valignmiddle"');
403 }
404 }
405 print showValueWithClipboardCPButton($object->login).$addadmin;
406 print '</td>';
407 }
408 print '</tr>';
409
410
411 // Hierarchy
412 print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
413 print '<td>';
414 if (empty($object->fk_user)) {
415 print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
416 } else {
417 $huser = new User($db);
418 if ($object->fk_user > 0) {
419 $huser->fetch($object->fk_user);
420 print $huser->getNomUrl(1);
421 } else {
422 print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
423 }
424 if (isModEnabled('holiday')) {
425 $holidayapprover = new Holiday($db);
426 $arrayApprover = $holidayapprover->fetch_users_approver_holiday();
427 if (!in_array((string) $object->fk_user, $arrayApprover)) {
428 print '<br><span class="opacitymedium">('.$langs->trans("NotHolidayApprover").')</span>';
429 }
430 }
431 if (isModEnabled('expensereport')) {
432 $expensereportapprover = new ExpenseReport($db);
433 $arrayApprover = $expensereportapprover->fetch_users_approver_expensereport();
434 if (!in_array((string) $object->fk_user, $arrayApprover)) {
435 print '<br><span class="opacitymedium">('.$langs->trans("NotExpenseReportApprover").')</span>';
436 }
437 }
438 }
439 print '</td>';
440 print "</tr>\n";
441
442 // Expense report validator
443 if (isModEnabled('expensereport')) {
444 print '<tr><td>';
445 $text = $langs->trans("ForceUserExpenseValidator");
446 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
447 print '</td>';
448 print '<td>';
449 if (!empty($object->fk_user_expense_validator)) {
450 $evuser = new User($db);
451 $evuser->fetch($object->fk_user_expense_validator);
452 print $evuser->getNomUrl(1);
453 }
454 print '</td>';
455 print "</tr>\n";
456 }
457
458 // Holiday request validator
459 if (isModEnabled('holiday')) {
460 print '<tr><td>';
461 $text = $langs->trans("ForceUserHolidayValidator");
462 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
463 print '</td>';
464 print '<td>';
465 if (!empty($object->fk_user_holiday_validator)) {
466 $hvuser = new User($db);
467 $hvuser->fetch($object->fk_user_holiday_validator);
468 print $hvuser->getNomUrl(1);
469 }
470 print '</td>';
471 print "</tr>\n";
472 }
473
474 // Position/Job
475 print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
476 print '<td>'.dol_escape_htmltag($object->job).'</td>';
477 print '</tr>'."\n";
478
479 // Weeklyhours
480 print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
481 print '<td>';
482 print price2num($object->weeklyhours);
483 print '</td>';
484 print "</tr>\n";
485
486 // Sensitive salary/value information
487 if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
488 || (isModEnabled('salaries') && $user->hasRight('salaries', 'readall'))
489 || (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read'))) {
490 $langs->load("salaries");
491
492 // Salary
493 print '<tr><td>'.$langs->trans("Salary").'</td>';
494 print '<td>';
495 print($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, 0, $langs, 1, -1, -1, $conf->currency) : '').'</span>';
496 print '</td>';
497 print "</tr>\n";
498
499 // THM
500 print '<tr><td>';
501 $text = $langs->trans("THM");
502 print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
503 print '</td>';
504 print '<td>';
505 print($object->thm != '' ? price($object->thm, 0, $langs, 1, -1, -1, $conf->currency) : '');
506 print '</td>';
507 print "</tr>\n";
508
509 // TJM
510 print '<tr><td>';
511 $text = $langs->trans("TJM");
512 print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm');
513 print '</td>';
514 print '<td>';
515 print($object->tjm != '' ? price($object->tjm, 0, $langs, 1, -1, -1, $conf->currency) : '');
516 print '</td>';
517 print "</tr>\n";
518 }
519
520 // Date employment
521 print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
522 print '<td>';
523 if ($object->dateemployment) {
524 print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
525 print dol_print_date($object->dateemployment, 'day');
526 }
527 if ($object->dateemploymentend) {
528 print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
529 print dol_print_date($object->dateemploymentend, 'day');
530 }
531 print '</td>';
532 print "</tr>\n";
533
534 // Date of birth (pure personal information)
535 if ($permissiontoreadhr) {
536 print '<tr>';
537 print '<td>';
538 print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'));
539 print '</td><td>';
540 print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'), 'day', $object->birth);
541 print '</td>';
542 print "</tr>\n";
543 }
544
545 // Personal email
546 if ($permissiontoreadhr || $permissiontosimpleedit) {
547 print '<tr class="nowrap">';
548 print '<td>';
549 print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr);
550 print '</td><td>';
551 print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr, 'email', '', null, null, '', 0, '');
552 print '</td>';
553 print '</tr>';
554 }
555
556 // Personal phone
557 if ($permissiontoreadhr || $permissiontosimpleedit) {
558 print '<tr class="nowrap">';
559 print '<td>';
560 print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr);
561 print '</td><td>';
562 print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr, 'phone', '', null, null, '', 0, '');
563 print '</td>';
564 print '</tr>';
565 }
566
567 if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) {
568 print '<tr class="nowrap">';
569 print '<td>';
570 print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', (string) $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer'));
571 print '</td><td>';
572 if ($action == 'editdefault_c_exp_tax_cat') {
573 $ret = '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
574 $ret .= '<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
575 $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
576 $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
577 $ret .= $form->selectExpenseCategories((string) $object->default_c_exp_tax_cat, 'default_c_exp_tax_cat', 1);
578 $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
579 $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
580 $ret .= '</form>';
581 print $ret;
582 } else {
583 $label_exp_tax_cat = dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
584 print $langs->trans($label_exp_tax_cat);
585 //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 : ''));
586 }
587 print '</td>';
588 print '</tr>';
589
590 print '<tr class="nowrap">';
591 print '<td>';
592 print $form->editfieldkey("DefaultRangeNumber", 'default_range', (string) $object->default_range, $object, $user->hasRight('user', 'user', 'creer'));
593 print '</td><td>';
594 if ($action == 'editdefault_range') {
595 $ret = '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
596 $ret .= '<input type="hidden" name="action" value="setdefault_range">';
597 $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
598 $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
599
600 $expensereportik = new ExpenseReportIk($db);
601 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
602
603 $ret .= $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range);
604 $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
605 $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
606 $ret .= '</form>';
607 print $ret;
608 } else {
609 print $object->default_range;
610 }
611 print '</td>';
612 print '</tr>';
613 }
614
615 // Employee Number
616 if ($permissiontoreadhr || $permissiontosimpleedit) {
617 print '<tr class="nowrap">';
618 print '<td>';
619 print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr || $permissiontosimpleedit);
620 print '</td><td>';
621 print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr || $permissiontosimpleedit, 'string', $object->ref_employee);
622 print '</td>';
623 print '</tr>';
624 }
625
626 // National registration number (pure personal information)
627 if ($permissiontoreadhr) {
628 print '<tr class="nowrap">';
629 print '<td>';
630 print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr);
631 print '</td><td>';
632 print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr, 'string', $object->national_registration_number);
633 print '</td>';
634 print '</tr>';
635 }
636
637 if (isModEnabled('accounting')) {
638 // General accountancy code of user
639 $formaccounting = new FormAccounting($db);
640
641 print '<tr>';
642 print '<td>';
643 print $form->editfieldkey("UserAccountancyCodeGeneral", 'accountancycodeusergeneral', length_accountg($object->accountancy_code_user_general), $object, $user->hasRight('user', 'user', 'creer'));
644 print '</td><td>';
645 if ($action == 'editaccountancycodeusergeneral' && $user->hasRight('user', 'user', 'creer')) {
646 print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_user_general, 'accountancycodeusergeneral', 0, 1, '', 1);
647 } else {
648 if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') {
649 $accountingaccount = new AccountingAccount($db);
650 $accountingaccount->fetch(0, $object->accountancy_code_user_general, 1);
651 print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
652 }
653 }
654 print '<span class="opacitymedium">';
655 if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') {
656 print ' (';
657 }
658 $accountingAccountByDefault = $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
659 print(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') ? $accountingAccountByDefault : '');
660 if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') {
661 print ')';
662 }
663 print '</span>';
664 print '</td>';
665
666 // Subledger accountancy code of user
667 print '<tr class="nowrap">';
668 print '<td>';
669 print $form->editfieldkey("UserSubledgerAccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer'));
670 print '</td><td>';
671 print $form->editfieldval("UserSubledgerAccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer'), 'string', '', null, null, '', 0, '');
672 print '</td>';
673 print '</tr>';
674 }
675
676 print '</table>';
677
678 print '</div><div class="fichehalfright">';
679
680 // Max number of elements in small lists
681 $MAXLIST = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
682
683 // Latest payments of salaries
684 if (isModEnabled('salaries') &&
685 (($user->hasRight('salaries', 'read') && (in_array($object->id, $childids) || $object->id == $user->id)) || ($user->hasRight('salaries', 'readall')))
686 ) {
687 $payment_salary = new PaymentSalary($db);
688 $salary = new Salary($db);
689
690 $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";
691 $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
692 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)";
693 $sql .= " WHERE s.fk_user = ".((int) $object->id);
694 $sql .= " AND s.entity IN (".getEntity('salary').")";
695 $sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
696 $sql .= " ORDER BY s.dateep DESC";
697
698 $resql = $db->query($sql);
699 if ($resql) {
700 $num = $db->num_rows($resql);
701
702 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
703 print '<table class="noborder centpercent">';
704
705 print '<tr class="liste_titre">';
706 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>';
707 print '</tr></table></td>';
708 print '</tr>';
709
710 $i = 0;
711 while ($i < $num && $i < $MAXLIST) {
712 $objp = $db->fetch_object($resql);
713
714 $salary->id = $objp->sid;
715 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
716 $salary->label = $objp->label;
717 $salary->datesp = $db->jdate($objp->datesp);
718 $salary->dateep = $db->jdate($objp->dateep);
719 $salary->paye = $objp->paye;
720 $salary->amount = $objp->amount;
721
722 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
723 $payment_salary->ref = !empty($objp->ref) ? $objp->ref : "";
724 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep : "");
725
726 print '<tr class="oddeven">';
727 print '<td class="nowraponall">';
728 print $salary->getNomUrl(1);
729 print '</td>';
730 print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp), 'day')."</td>\n";
731 print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep), 'day')."</td>\n";
732 print '<td class="right nowraponall"><span class="amount">'.price($objp->amount).'</span></td>';
733 print '<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).'</td>';
734 print '</tr>';
735 $i++;
736 }
737 $db->free($resql);
738
739 if ($num <= 0) {
740 print '<td colspan="5"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
741 }
742 print "</table>";
743 print "</div>";
744 } else {
746 }
747 }
748
749 // Latest leave requests
750 if (isModEnabled('holiday') && ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && $object->id == $user->id))) {
751 $holiday = new Holiday($db);
752
753 $sql = "SELECT h.rowid, h.ref, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
754 $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
755 $sql .= " WHERE h.fk_user = ".((int) $object->id);
756 $sql .= " AND h.entity IN (".getEntity('holiday').")";
757 $sql .= " ORDER BY h.date_debut DESC";
758
759 $resql = $db->query($sql);
760 if ($resql) {
761 $num = $db->num_rows($resql);
762
763 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
764 print '<table class="noborder centpercent">';
765
766 print '<tr class="liste_titre">';
767 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>';
768 print '</tr></table></td>';
769 print '</tr>';
770
771 $i = 0;
772 while ($i < $num && $i < $MAXLIST) {
773 $objp = $db->fetch_object($resql);
774
775 $holiday->id = $objp->rowid;
776 $holiday->ref = $objp->ref;
777
778 $holiday->fk_type = $objp->fk_type;
779 $holiday->statut = $objp->status;
780 $holiday->status = $objp->status;
781
782 $nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday, $object->country_id);
783
784 print '<tr class="oddeven">';
785 print '<td class="nowraponall">';
786 print $holiday->getNomUrl(1);
787 print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
788 print '<td class="right nowraponall">'.$nbopenedday.' '.$langs->trans('DurationDays').'</td>';
789 print '<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).'</td>';
790 print '</tr>';
791 $i++;
792 }
793 $db->free($resql);
794
795 if ($num <= 0) {
796 print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
797 }
798 print "</table>";
799 print "</div>";
800 } else {
802 }
803 }
804
805 // Latest expense report
806 if (isModEnabled('expensereport') &&
807 ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && $object->id == $user->id))
808 ) {
809 $exp = new ExpenseReport($db);
810
811 $sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
812 $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e";
813 $sql .= " WHERE e.fk_user_author = ".((int) $object->id);
814 $sql .= " AND e.entity = ".((int) $conf->entity);
815 $sql .= " ORDER BY e.date_debut DESC";
816
817 $resql = $db->query($sql);
818 if ($resql) {
819 $num = $db->num_rows($resql);
820
821 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
822 print '<table class="noborder centpercent">';
823
824 print '<tr class="liste_titre">';
825 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>';
826 print '</tr></table></td>';
827 print '</tr>';
828
829 $i = 0;
830 while ($i < $num && $i < $MAXLIST) {
831 $objp = $db->fetch_object($resql);
832
833 $exp->id = $objp->rowid;
834 $exp->ref = $objp->ref;
835 $exp->status = $objp->status;
836
837 print '<tr class="oddeven">';
838 print '<td class="nowraponall">';
839 print $exp->getNomUrl(1);
840 print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
841 print '<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).'</span></td>';
842 print '<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).'</td>';
843 print '</tr>';
844 $i++;
845 }
846 $db->free($resql);
847
848 if ($num <= 0) {
849 print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
850 }
851 print "</table>";
852 print "</div>";
853 } else {
855 }
856 }
857
858 print '</div></div>';
859 print '<div class="clearboth"></div>';
860
861 print dol_get_fiche_end();
862
863 // List of bank accounts (Currently only one bank account possible for each employee)
864
865 $morehtmlright = '';
866 if ($account->id == 0) {
867 if ($permissiontoaddbankaccount) {
868 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create');
869 } else {
870 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2);
871 }
872 } else {
873 $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('AlreadyOneBankAccount'), 'fa fa-plus-circle', '', '', -2);
874 }
875
876 print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');
877
878 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
879 print '<table class="liste centpercent">';
880
881 print '<tr class="liste_titre">';
882 print_liste_field_titre("LabelRIB");
887 print_liste_field_titre("Currency");
888 print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
889 print "</tr>\n";
890
891 if ($account->id > 0) {
892 print '<tr class="oddeven">';
893 // Label
894 print '<td>'.dol_escape_htmltag($account->label).'</td>';
895 // Bank name
896 print '<td>'.dol_escape_htmltag($account->bank).'</td>';
897 // Account number
898 print '<td>';
899 $stringescaped = '';
900 foreach ($account->getFieldsToShow() as $val) {
901 if ($val == 'BankCode') {
902 $stringescaped .= dol_escape_htmltag($account->code_banque).' ';
903 } elseif ($val == 'BankAccountNumber') {
904 $stringescaped .= dol_escape_htmltag($account->number).' ';
905 } elseif ($val == 'DeskCode') {
906 $stringescaped .= dol_escape_htmltag($account->code_guichet).' ';
907 } elseif ($val == 'BankAccountNumberKey') {
908 $stringescaped .= dol_escape_htmltag($account->cle_rib).' ';
909 }
910 }
911 if (!empty($account->label) && $account->number) {
912 if (!checkBanForAccount($account)) {
913 $stringescaped .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning');
914 } else {
915 $stringescaped .= ' '.img_picto($langs->trans("ValueIsValid"), 'info');
916 }
917 }
918
919 print $stringescaped;
920 print '</td>';
921 // IBAN
922 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag(getIbanHumanReadable($account)).'">';
923 if (!empty($account->iban)) {
924 if (!checkIbanForAccount($account)) {
925 print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
926 }
927 }
928 print getIbanHumanReadable($account);
929 print '</td>';
930 // BIC
931 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($account->bic).'">';
932 if (!empty($account->bic)) {
933 if (!checkSwiftForAccount($account)) {
934 print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
935 }
936 }
937 print dol_escape_htmltag($account->bic);
938 print '</td>';
939
940 // Currency
941 print '<td>'.$account->currency_code.'</td>';
942
943 // Edit/Delete
944 print '<td class="right nowraponall">';
945 if ($permissiontoaddbankaccount) {
946 print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=edit&token='.newToken().'">';
947 print img_picto($langs->trans("Modify"), 'edit');
948 print '</a>';
949
950 print '<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=delete_confirmed&token='.newToken().'">';
951 print img_picto($langs->trans("Delete"), 'delete');
952 print '</a>';
953 }
954 print '</td>';
955
956 print '</tr>';
957 }
958
959
960 if ($account->id == 0) {
961 $colspan = 7;
962 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoBANRecord").'</span></td></tr>';
963 }
964
965
966
967 print '</table>';
968 print '</div>';
969
970 // Add hook in fields
971 $parameters = array('colspan' => ' colspan="2"');
972 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
973}
974
975// Edit
976if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankaccount) {
977 $title = $langs->trans("User");
978 print dol_get_fiche_head($head, 'bank', $title, 0, 'user');
979
980 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
981
982 dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin);
983
984 print '<div class="underbanner clearboth"></div>';
985 print '<br>';
986
987 print '<table class="border centpercent">';
988
989 print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Label").'</td>';
990 print '<td><input size="30" type="text" name="label" value="'.$account->label.'" autofocus></td></tr>';
991
992 print '<tr><td class="">'.$langs->trans("BankName").'</td>';
993 print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
994
995 // Currency
996 print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
997 print '<input type="hidden" value="'.$account->currency_code.'">';
998 print '</td>';
999 print '<td class="maxwidth200onsmartphone">';
1000 $selectedcode = $account->currency_code;
1001 if (!$selectedcode) {
1002 $selectedcode = $conf->currency;
1003 }
1004 print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
1005 print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
1006 print '</td></tr>';
1007
1008 // Country
1009 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
1010 $selectedcode = $account->country_code;
1011 if (GETPOSTISSET("account_country_id")) {
1012 $selectedcode = GETPOST("account_country_id");
1013 } elseif (empty($selectedcode)) {
1014 $selectedcode = $mysoc->country_code;
1015 }
1016 $account->country_code = getCountry($selectedcode, '2'); // Force country code on account to have following field on bank fields matching country rules
1017
1018 print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
1019 print '<td class="maxwidth200onsmartphone">';
1020 print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
1021 if ($user->admin) {
1022 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1023 }
1024 print '</td></tr>';
1025
1026 // State
1027 print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
1028 if ($selectedcode) {
1029 print img_picto('', 'state', 'class="pictofixedwidth"');
1030 print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id');
1031 }
1032 print '</td></tr>';
1033
1034
1035 // Show fields of bank account
1036 $bankaccount = $account;
1037
1038 // Code here is similar as in paymentmodes.php for third-parties
1039 foreach ($bankaccount->getFieldsToShow(1) as $val) {
1040 $require = false;
1041 $tooltip = '';
1042 $name = 'UNKNOWN';
1043 $size = '8';
1044 $content = 'UNKNOWN';
1045
1046 if ($val == 'BankCode') {
1047 $name = 'code_banque';
1048 $size = 8;
1049 $content = $bankaccount->code_banque;
1050 } elseif ($val == 'DeskCode') {
1051 $name = 'code_guichet';
1052 $size = 8;
1053 $content = $bankaccount->code_guichet;
1054 } elseif ($val == 'BankAccountNumber') {
1055 $name = 'number';
1056 $size = 18;
1057 $content = $bankaccount->number;
1058 } elseif ($val == 'BankAccountNumberKey') {
1059 $name = 'cle_rib';
1060 $size = 3;
1061 $content = $bankaccount->cle_rib;
1062 } elseif ($val == 'IBAN') {
1063 $name = 'iban';
1064 $size = 30;
1065 $content = $bankaccount->iban;
1066 if ($bankaccount->needIBAN()) {
1067 $require = true;
1068 }
1069 $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';
1070 } elseif ($val == 'BIC') {
1071 $name = 'bic';
1072 $size = 12;
1073 $content = $bankaccount->bic;
1074 if ($bankaccount->needIBAN()) {
1075 $require = true;
1076 }
1077 $tooltip = $langs->trans("Example").': LIABLT2XXXX';
1078 }
1079 print '<tr>';
1080 print '<td'.($require ? ' class="fieldrequired" ' : '').'>';
1081 if ($tooltip) {
1082 print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name);
1083 } else {
1084 print $langs->trans($val);
1085 }
1086 print '</td>';
1087 print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
1088 print '</tr>';
1089 }
1090
1091 print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
1092 print '<textarea name="address" rows="4" class="quatrevingtpercent">';
1093 print dol_escape_htmltag($account->address);
1094 print "</textarea></td></tr>";
1095
1096 print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
1097 print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->owner_name.'"></td></tr>';
1098 print "</td></tr>\n";
1099
1100 print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
1101 print '<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
1102 print dol_escape_htmltag($account->owner_address);
1103 print "</textarea></td></tr>";
1104
1105 print '</table>';
1106
1107 //print '</div>';
1108
1109 print dol_get_fiche_end();
1110
1111 print $form->buttonsSaveCancel($action == 'create' ? "Create" : "Modify");
1112}
1113
1114if ($id && $action == 'edit' && $permissiontoaddbankaccount) {
1115 print '</form>';
1116}
1117
1118if ($id && $action == 'create' && $permissiontoaddbankaccount) {
1119 print '</form>';
1120}
1121
1122// End of page
1123llxFooter();
1124$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.
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.
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)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
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, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
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
buildzip.php
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.