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