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