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