35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/user/class/userbankaccount.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
67$langs->loadLangs(array(
'accountancy',
'companies',
'commercial',
'banks',
'bills',
'trips',
'holiday',
'salaries'));
70 $langs->load(
'compta');
74$ref =
GETPOST(
'ref',
'alphanohtml');
76$action =
GETPOST(
"action",
'alpha');
77$cancel =
GETPOST(
'cancel',
'alpha');
80$hookmanager->initHooks(array(
'usercardBank',
'globalcard'));
84if ($user->socid > 0) {
85 $socid = $user->socid;
87$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
90if ($id > 0 || !empty($ref)) {
91 $result =
$object->fetch($id, $ref,
'', 1);
98 $account->fetch(0,
'', $id);
100 $account->fetch($bankid);
102if (empty($account->userid)) {
103 $account->userid =
$object->id;
107$selfpermission = ($user->id ==
$id && $user->hasRight(
'user',
'self',
'creer'));
108$usercanadd = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer') || $user->hasRight(
'hrm',
'write_personal_information',
'write'));
109$usercanread = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'lire') || $user->hasRight(
'hrm',
'read_personal_information',
'read'));
110$permissiontoaddbankaccount = ($user->hasRight(
'salaries',
'write') || $user->hasRight(
'hrm',
'employee',
'write') || $user->hasRight(
'user',
'user',
'creer') || $selfpermission);
111$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
112$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
113$permissiontosimpleedit = ($selfpermission || $usercanadd);
115$childids = $user->getAllChildIds(1);
120if ($user->id == $id) {
123if ($user->hasRight(
'salaries',
'readall')) {
126if ($user->hasRight(
'hrm',
'read')) {
129if ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') && in_array(
$object->id, $childids))) {
132if ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') && in_array(
$object->id, $childids))) {
144if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
145 $account->userid =
$object->id;
147 $account->bank =
GETPOST(
'bank',
'alpha');
148 $account->label =
GETPOST(
'label',
'alpha');
150 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
151 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
152 $account->number =
GETPOST(
'number',
'alpha');
153 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
154 $account->bic =
GETPOST(
'bic',
'alpha');
155 $account->iban =
GETPOST(
'iban',
'alpha');
156 $account->address =
GETPOST(
'address',
'alpha');
158 $account->owner_name =
GETPOST(
'proprio',
'alpha');
159 $account->proprio = $account->owner_name;
160 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
162 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
163 $account->state_id =
GETPOSTINT(
"account_state_id");
164 $account->country_id =
GETPOSTINT(
"account_country_id");
166 $result = $account->create($user);
177if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
178 $account->userid =
$object->id;
180 $account->bank =
GETPOST(
'bank',
'alpha');
181 $account->label =
GETPOST(
'label',
'alpha');
183 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
184 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
185 $account->number =
GETPOST(
'number',
'alpha');
186 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
187 $account->bic =
GETPOST(
'bic',
'alpha');
188 $account->iban =
GETPOST(
'iban',
'alpha');
189 $account->address =
GETPOST(
'address',
'alpha');
190 $account->owner_name =
GETPOST(
'proprio',
'alpha');
191 $account->proprio = $account->owner_name;
192 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
194 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
195 $account->state_id =
GETPOSTINT(
"account_state_id");
196 $account->country_id =
GETPOSTINT(
"account_country_id");
198 $result = $account->update($user);
209if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
210 $result = $account->delete($user);
215 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.
$object->id);
222if ($action ==
'setbirth' && $permissiontowritehr && !$cancel) {
224 $result =
$object->update($user);
231if ($action ==
'setpersonal_email' && $permissiontosimpleedit && !$cancel) {
232 $object->personal_email = (string)
GETPOST(
'personal_email',
'alphanohtml');
233 $result =
$object->update($user);
240if ($action ==
'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) {
241 $object->personal_mobile = (string)
GETPOST(
'personal_mobile',
'alphanohtml');
242 $result =
$object->update($user);
249if ($action ==
'setaccountancycodeusergeneral' && $usercanadd) {
251 $object->accountancy_code_user_general =
GETPOST(
"accountancycodeusergeneral");
252 $result =
$object->update($user);
255 $action =
'editaccountancycodeusergeneral';
259if ($action ==
'setaccountancy_code' && $usercanadd && !$cancel) {
260 $object->accountancy_code = (string)
GETPOST(
'accountancy_code',
'alphanohtml');
261 $result =
$object->update($user);
268if ($action ==
'setref_employee' && $usercanadd && !$cancel) {
269 $object->ref_employee = (string)
GETPOST(
'ref_employee',
'alphanohtml');
270 $result =
$object->update($user);
277if ($action ==
'setnational_registration_number' && $permissiontowritehr && !$cancel) {
278 $object->national_registration_number = (string)
GETPOST(
'national_registration_number',
'alphanohtml');
279 $result =
$object->update($user);
287 if ($action ==
'setdefault_c_exp_tax_cat' && $usercanadd) {
289 $result =
$object->update($user);
296 if ($action ==
'setdefault_range' && $usercanadd) {
298 $result =
$object->update($user);
310$form =
new Form($db);
314$title = $person_name.
" - ".$langs->trans(
'BankAccounts');
316llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-bank');
320if ($id && $bankid && $action ==
'edit' && !$cancel && $permissiontoaddbankaccount) {
321 if ($conf->use_javascript_ajax) {
323 print
'jQuery(document).ready(function () {
324 jQuery("#type").change(function() {
325 document.formbank.action.value="edit";
326 document.formbank.submit();
328 jQuery("#selectaccount_country_id").change(function() {
329 document.formbank.action.value="edit";
330 document.formbank.submit();
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="update">';
338 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
339 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
341if ($id && $action ==
'create' && !$cancel && $permissiontoaddbankaccount) {
342 if ($conf->use_javascript_ajax) {
344 print
'jQuery(document).ready(function () {
345 jQuery("#type").change(function() {
346 document.formbank.action.value="create";
347 document.formbank.submit();
349 jQuery("#selectaccount_country_id").change(function() {
350 document.formbank.action.value="create";
351 document.formbank.submit();
356 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" name="formbank" method="post">';
357 print
'<input type="hidden" name="token" value="'.newToken().
'">';
358 print
'<input type="hidden" name="action" value="add">';
359 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
364if ($action !=
'edit' && $action !=
'create') {
365 $title = $langs->trans(
"User");
370 if ($user->hasRight(
'user',
'user',
'lire') || $user->admin) {
371 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
374 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
375 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
376 $morehtmlref .=
'</a>';
378 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
379 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
381 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin,
'rowid',
'ref', $morehtmlref);
383 print
'<div class="fichecenter"><div class="fichehalfleft">';
385 print
'<div class="underbanner clearboth"></div>';
387 print
'<table class="border centpercent tableforfield">';
389 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
391 print
'<td class="error">';
392 print $langs->trans(
"LoginAccountDisableInDolibarr");
397 if (property_exists(
$object,
'admin')) {
399 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
400 } elseif (!empty(
$object->admin)) {
401 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
411 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
414 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
416 $huser =
new User($db);
418 $huser->fetch(
$object->fk_user);
419 print $huser->getNomUrl(1);
421 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
430 $text = $langs->trans(
"ForceUserExpenseValidator");
431 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
434 if (!empty(
$object->fk_user_expense_validator)) {
435 $evuser =
new User($db);
436 $evuser->fetch(
$object->fk_user_expense_validator);
437 print $evuser->getNomUrl(1);
446 $text = $langs->trans(
"ForceUserHolidayValidator");
447 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
450 if (!empty(
$object->fk_user_holiday_validator)) {
451 $hvuser =
new User($db);
452 $hvuser->fetch(
$object->fk_user_holiday_validator);
453 print $hvuser->getNomUrl(1);
460 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
461 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
465 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
472 if ((empty($user->socid) && in_array($id, $childids))
473 || (
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'readall'))
474 || (
isModEnabled(
'hrm') && $user->hasRight(
'hrm',
'employee',
'read'))) {
475 $langs->load(
"salaries");
478 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
480 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
486 $text = $langs->trans(
"THM");
487 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
490 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
496 $text = $langs->trans(
"TJM");
497 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
500 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
506 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
509 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
512 if (
$object->dateemploymentend) {
513 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
520 if ($permissiontoreadhr) {
523 print $form->editfieldkey(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'));
525 print $form->editfieldval(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'),
'day',
$object->birth);
531 if ($permissiontoreadhr || $permissiontosimpleedit) {
532 print
'<tr class="nowrap">';
534 print $form->editfieldkey(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
536 print $form->editfieldval(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'email',
'',
null,
null,
'', 0,
'');
542 if ($permissiontoreadhr || $permissiontosimpleedit) {
543 print
'<tr class="nowrap">';
545 print $form->editfieldkey(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
547 print $form->editfieldval(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'phone',
'',
null,
null,
'', 0,
'');
553 print
'<tr class="nowrap">';
555 print $form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', (
string)
$object->default_c_exp_tax_cat,
$object, $user->hasRight(
'user',
'user',
'creer'));
557 if ($action ==
'editdefault_c_exp_tax_cat') {
558 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
559 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
560 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
561 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
562 $ret .= $form->selectExpenseCategories((
string)
$object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
563 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
564 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
569 print $langs->trans($label_exp_tax_cat);
575 print
'<tr class="nowrap">';
577 print $form->editfieldkey(
"DefaultRangeNumber",
'default_range', (
string)
$object->default_range,
$object, $user->hasRight(
'user',
'user',
'creer'));
579 if ($action ==
'editdefault_range') {
580 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
581 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
582 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
583 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
586 $maxRangeNum = $expensereportik->getMaxRangeNumber(
$object->default_c_exp_tax_cat);
588 $ret .= $form->selectarray(
'default_range', range(0, $maxRangeNum),
$object->default_range);
589 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
590 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
601 if ($permissiontoreadhr || $permissiontosimpleedit) {
602 print
'<tr class="nowrap">';
604 print $form->editfieldkey(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit);
606 print $form->editfieldval(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit,
'string',
$object->ref_employee);
612 if ($permissiontoreadhr) {
613 print
'<tr class="nowrap">';
615 print $form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr);
617 print $form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr,
'string',
$object->national_registration_number);
628 print $form->editfieldkey(
"UserAccountancyCodeGeneral",
'accountancycodeusergeneral',
length_accountg(
$object->accountancy_code_user_general),
$object, $user->hasRight(
'user',
'user',
'creer'));
630 if ($action ==
'editaccountancycodeusergeneral' && $user->hasRight(
'user',
'user',
'creer')) {
631 print $formaccounting->formAccountingAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->accountancy_code_user_general,
'accountancycodeusergeneral', 0, 1,
'', 1);
633 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
635 $accountingaccount->fetch(0,
$object->accountancy_code_user_general, 1);
636 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
639 print
'<span class="opacitymedium">';
640 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
643 $accountingAccountByDefault = $langs->trans(
"AccountingAccountByDefaultShort") .
": " .
length_accountg(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
644 print(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') ? $accountingAccountByDefault :
'');
645 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
652 print
'<tr class="nowrap">';
654 print $form->editfieldkey(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'));
656 print $form->editfieldval(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'),
'string',
'',
null,
null,
'', 0,
'');
663 print
'</div><div class="fichehalfright">';
670 (($user->hasRight(
'salaries',
'read') && (in_array(
$object->id, $childids) ||
$object->id == $user->id)) || ($user->hasRight(
'salaries',
'readall')))
673 $salary =
new Salary($db);
675 $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";
676 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
677 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
678 $sql .=
" WHERE s.fk_user = ".((int)
$object->id);
679 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
680 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
681 $sql .=
" ORDER BY s.dateep DESC";
683 $resql = $db->query($sql);
685 $num = $db->num_rows($resql);
687 print
'<div class="div-table-responsive-no-min">';
688 print
'<table class="noborder centpercent">';
690 print
'<tr class="liste_titre">';
691 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>';
692 print
'</tr></table></td>';
696 while ($i < $num && $i < $MAXLIST) {
697 $objp = $db->fetch_object($resql);
699 $salary->id = $objp->sid;
700 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
701 $salary->label = $objp->label;
702 $salary->datesp = $db->jdate($objp->datesp);
703 $salary->dateep = $db->jdate($objp->dateep);
704 $salary->paye = $objp->paye;
705 $salary->amount = $objp->amount;
707 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
708 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
709 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep :
"");
711 print
'<tr class="oddeven">';
712 print
'<td class="nowraponall">';
713 print $salary->getNomUrl(1);
715 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp),
'day').
"</td>\n";
716 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep),
'day').
"</td>\n";
717 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
718 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
725 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
735 if (
isModEnabled(
'holiday') && ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') &&
$object->id == $user->id))) {
738 $sql =
"SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
739 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
740 $sql .=
" WHERE h.fk_user = ".((int)
$object->id);
741 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
742 $sql .=
" ORDER BY h.date_debut DESC";
744 $resql = $db->query($sql);
746 $num = $db->num_rows($resql);
748 print
'<div class="div-table-responsive-no-min">';
749 print
'<table class="noborder centpercent">';
751 print
'<tr class="liste_titre">';
752 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>';
753 print
'</tr></table></td>';
757 while ($i < $num && $i < $MAXLIST) {
758 $objp = $db->fetch_object($resql);
760 $holiday->id = $objp->rowid;
761 $holiday->ref = $objp->rowid;
763 $holiday->fk_type = $objp->fk_type;
764 $holiday->statut = $objp->status;
765 $holiday->status = $objp->status;
767 $nbopenedday =
num_open_day($db->jdate($objp->date_debut,
'gmt'), $db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday,
$object->country_id);
769 print
'<tr class="oddeven">';
770 print
'<td class="nowraponall">';
771 print $holiday->getNomUrl(1);
772 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
773 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
774 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
781 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
792 ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') &&
$object->id == $user->id))
796 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
797 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
798 $sql .=
" WHERE e.fk_user_author = ".((int)
$object->id);
799 $sql .=
" AND e.entity = ".((int) $conf->entity);
800 $sql .=
" ORDER BY e.date_debut DESC";
802 $resql = $db->query($sql);
804 $num = $db->num_rows($resql);
806 print
'<div class="div-table-responsive-no-min">';
807 print
'<table class="noborder centpercent">';
809 print
'<tr class="liste_titre">';
810 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>';
811 print
'</tr></table></td>';
815 while ($i < $num && $i < $MAXLIST) {
816 $objp = $db->fetch_object($resql);
818 $exp->id = $objp->rowid;
819 $exp->ref = $objp->ref;
820 $exp->status = $objp->status;
822 print
'<tr class="oddeven">';
823 print
'<td class="nowraponall">';
824 print $exp->getNomUrl(1);
825 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
826 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
827 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
834 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
843 print
'</div></div>';
844 print
'<div class="clearboth"></div>';
851 if ($account->id == 0) {
852 if ($permissiontoaddbankaccount) {
853 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=create');
855 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
858 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
861 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
863 print
'<div class="div-table-responsive-no-min">';
864 print
'<table class="liste centpercent">';
866 print
'<tr class="liste_titre">';
876 if ($account->id > 0) {
877 print
'<tr class="oddeven">';
879 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
881 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
885 foreach ($account->getFieldsToShow() as $val) {
886 if ($val ==
'BankCode') {
888 } elseif ($val ==
'BankAccountNumber') {
890 } elseif ($val ==
'DeskCode') {
892 } elseif ($val ==
'BankAccountNumberKey') {
896 if (!empty($account->label) && $account->number) {
898 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
900 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
904 print $stringescaped;
907 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
getIbanHumanReadable($account)).
'">';
908 if (!empty($account->iban)) {
910 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
916 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($account->bic).
'">';
917 if (!empty($account->bic)) {
919 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
926 print
'<td>'.$account->currency_code.
'</td>';
929 print
'<td class="right nowraponall">';
930 if ($permissiontoaddbankaccount) {
931 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=edit&token='.
newToken().
'">';
932 print
img_picto($langs->trans(
"Modify"),
'edit');
935 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.
newToken().
'">';
936 print
img_picto($langs->trans(
"Delete"),
'delete');
945 if ($account->id == 0) {
947 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
956 $parameters = array(
'colspan' =>
' colspan="2"');
957 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
961if ($id && ($action ==
'edit' || $action ==
'create') && $permissiontoaddbankaccount) {
962 $title = $langs->trans(
"User");
965 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
967 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
969 print
'<div class="underbanner clearboth"></div>';
972 print
'<table class="border centpercent">';
974 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Label").
'</td>';
975 print
'<td><input size="30" type="text" name="label" value="'.$account->label.
'" autofocus></td></tr>';
977 print
'<tr><td class="">'.$langs->trans(
"BankName").
'</td>';
978 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
981 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
982 print
'<input type="hidden" value="'.$account->currency_code.
'">';
984 print
'<td class="maxwidth200onsmartphone">';
985 $selectedcode = $account->currency_code;
986 if (!$selectedcode) {
987 $selectedcode = $conf->currency;
989 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
990 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
994 $account->country_id = $account->country_id ? $account->country_id :
$mysoc->country_id;
995 $selectedcode = $account->country_code;
996 if (GETPOSTISSET(
"account_country_id")) {
997 $selectedcode =
GETPOST(
"account_country_id");
998 } elseif (empty($selectedcode)) {
999 $selectedcode =
$mysoc->country_code;
1001 $account->country_code =
getCountry($selectedcode,
'2');
1003 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1004 print
'<td class="maxwidth200onsmartphone">';
1005 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1007 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1012 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1013 if ($selectedcode) {
1014 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1015 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
1021 $bankaccount = $account;
1024 foreach ($bankaccount->getFieldsToShow(1) as $val) {
1029 $content =
'UNKNOWN';
1031 if ($val ==
'BankCode') {
1032 $name =
'code_banque';
1034 $content = $bankaccount->code_banque;
1035 } elseif ($val ==
'DeskCode') {
1036 $name =
'code_guichet';
1038 $content = $bankaccount->code_guichet;
1039 } elseif ($val ==
'BankAccountNumber') {
1042 $content = $bankaccount->number;
1043 } elseif ($val ==
'BankAccountNumberKey') {
1046 $content = $bankaccount->cle_rib;
1047 } elseif ($val ==
'IBAN') {
1050 $content = $bankaccount->iban;
1051 if ($bankaccount->needIBAN()) {
1054 $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';
1055 } elseif ($val ==
'BIC') {
1058 $content = $bankaccount->bic;
1059 if ($bankaccount->needIBAN()) {
1062 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1065 print
'<td'.($require ?
' class="fieldrequired" ' :
'').
'>';
1067 print $form->textwithpicto($langs->trans($val), $tooltip, 4,
'help',
'', 0, 3, $name);
1069 print $langs->trans($val);
1072 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1076 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
1077 print
'<textarea name="address" rows="4" class="quatrevingtpercent">';
1079 print
"</textarea></td></tr>";
1081 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1082 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->owner_name.
'"></td></tr>';
1083 print
"</td></tr>\n";
1085 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
1086 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
1088 print
"</textarea></td></tr>";
1096 print $form->buttonsSaveCancel($action ==
'create' ?
"Create" :
"Modify");
1099if ($id && $action ==
'edit' && $permissiontoaddbankaccount) {
1103if ($id && $action ==
'create' && $permissiontoaddbankaccount) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
checkIbanForAccount($account=null, $ibantocheck=null)
Check IBAN number information for a bank account.
checkBanForAccount($account)
Check account number information for a bank account.
getIbanHumanReadable(Account $account)
Returns the iban human readable.
checkSwiftForAccount($account=null, $swift=null)
Check SWIFT information for a bank account.
Class to manage accounting accounts.
Class to manage Trips and Expenses.
Class to manage inventories.
Class of the module paid holiday.
Class to manage payments of salaries.
Class to manage salary payments.
Class to manage bank accounts description of users.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $countryCodeOrId='')
Function to return number of working days (and text of units) between two dates (working days)
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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.