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