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