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