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