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