36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/user/class/userbankaccount.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
68$langs->loadLangs(array(
'accountancy',
'companies',
'commercial',
'banks',
'bills',
'trips',
'holiday',
'salaries'));
71 $langs->load(
'compta');
75$ref =
GETPOST(
'ref',
'alphanohtml');
77$action =
GETPOST(
"action",
'alpha');
78$cancel =
GETPOST(
'cancel',
'alpha');
81$hookmanager->initHooks(array(
'usercardBank',
'globalcard'));
85if ($user->socid > 0) {
86 $socid = $user->socid;
88$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
91if ($id > 0 || !empty($ref)) {
92 $result =
$object->fetch($id, $ref,
'', 1);
99 $account->fetch(0,
'', $id);
101 $account->fetch($bankid);
103if (empty($account->userid)) {
104 $account->userid =
$object->id;
108$selfpermission = ($user->id ==
$id && $user->hasRight(
'user',
'self',
'creer'));
109$usercanadd = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer') || $user->hasRight(
'hrm',
'write_personal_information',
'write'));
110$usercanread = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'lire') || $user->hasRight(
'hrm',
'read_personal_information',
'read'));
111$permissiontoaddbankaccount = ($user->hasRight(
'salaries',
'write') || $user->hasRight(
'hrm',
'employee',
'write') || $user->hasRight(
'user',
'user',
'creer') || $selfpermission);
112$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
113$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
114$permissiontosimpleedit = ($selfpermission || $usercanadd);
116$childids = $user->getAllChildIds(1);
121if ($user->id == $id) {
124if ($user->hasRight(
'salaries',
'readall')) {
127if ($user->hasRight(
'hrm',
'read')) {
130if ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') && in_array(
$object->id, $childids))) {
133if ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') && in_array(
$object->id, $childids))) {
145if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
146 $account->userid =
$object->id;
148 $account->bank =
GETPOST(
'bank',
'alpha');
149 $account->label =
GETPOST(
'label',
'alpha');
151 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
152 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
153 $account->number =
GETPOST(
'number',
'alpha');
154 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
155 $account->bic =
GETPOST(
'bic',
'alpha');
156 $account->iban =
GETPOST(
'iban',
'alpha');
157 $account->address =
GETPOST(
'address',
'alpha');
159 $account->owner_name =
GETPOST(
'proprio',
'alpha');
160 $account->proprio = $account->owner_name;
161 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
163 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
164 $account->state_id =
GETPOSTINT(
"account_state_id");
165 $account->country_id =
GETPOSTINT(
"account_country_id");
167 $result = $account->create($user);
178if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
179 $account->userid =
$object->id;
181 $account->bank =
GETPOST(
'bank',
'alpha');
182 $account->label =
GETPOST(
'label',
'alpha');
184 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
185 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
186 $account->number =
GETPOST(
'number',
'alpha');
187 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
188 $account->bic =
GETPOST(
'bic',
'alpha');
189 $account->iban =
GETPOST(
'iban',
'alpha');
190 $account->address =
GETPOST(
'address',
'alpha');
191 $account->owner_name =
GETPOST(
'proprio',
'alpha');
192 $account->proprio = $account->owner_name;
193 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
195 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
196 $account->state_id =
GETPOSTINT(
"account_state_id");
197 $account->country_id =
GETPOSTINT(
"account_country_id");
199 $result = $account->update($user);
210if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
211 $result = $account->delete($user);
216 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.
$object->id);
223if ($action ==
'setbirth' && $permissiontowritehr && !$cancel) {
225 $result =
$object->update($user);
232if ($action ==
'setpersonal_email' && $permissiontosimpleedit && !$cancel) {
234 $result =
$object->update($user);
241if ($action ==
'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) {
243 $result =
$object->update($user);
250if ($action ==
'setaccountancycodeusergeneral' && $usercanadd) {
252 $object->accountancy_code_user_general =
GETPOST(
"accountancycodeusergeneral");
253 $result =
$object->update($user);
256 $action =
'editaccountancycodeusergeneral';
260if ($action ==
'setaccountancy_code' && $usercanadd && !$cancel) {
262 $result =
$object->update($user);
269if ($action ==
'setref_employee' && $usercanadd && !$cancel) {
271 $result =
$object->update($user);
278if ($action ==
'setnational_registration_number' && $permissiontowritehr && !$cancel) {
279 $object->national_registration_number = (
string)
GETPOST(
'national_registration_number',
'alphanohtml');
280 $result =
$object->update($user);
288 if ($action ==
'setdefault_c_exp_tax_cat' && $usercanadd) {
290 $result =
$object->update($user);
297 if ($action ==
'setdefault_range' && $usercanadd) {
299 $result =
$object->update($user);
315$title = $person_name.
" - ".$langs->trans(
'BankAccounts');
317llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-bank');
321if ($id && $bankid && $action ==
'edit' && !$cancel && $permissiontoaddbankaccount) {
322 if (
$conf->use_javascript_ajax) {
324 print
'jQuery(document).ready(function () {
325 jQuery("#type").change(function() {
326 document.formbank.action.value="edit";
327 document.formbank.submit();
329 jQuery("#selectaccount_country_id").change(function() {
330 document.formbank.action.value="edit";
331 document.formbank.submit();
336 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" name="formbank" method="post">';
337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
338 print
'<input type="hidden" name="action" value="update">';
339 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
340 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
342if ($id && $action ==
'create' && !$cancel && $permissiontoaddbankaccount) {
343 if (
$conf->use_javascript_ajax) {
345 print
'jQuery(document).ready(function () {
346 jQuery("#type").change(function() {
347 document.formbank.action.value="create";
348 document.formbank.submit();
350 jQuery("#selectaccount_country_id").change(function() {
351 document.formbank.action.value="create";
352 document.formbank.submit();
357 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" name="formbank" method="post">';
358 print
'<input type="hidden" name="token" value="'.newToken().
'">';
359 print
'<input type="hidden" name="action" value="add">';
360 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
365if ($action !=
'edit' && $action !=
'create') {
366 $title = $langs->trans(
"User");
371 if ($user->hasRight(
'user',
'user',
'lire') || $user->admin) {
372 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
375 $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">';
376 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
377 $morehtmlref .=
'</a>';
379 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
380 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
382 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin,
'rowid',
'ref', $morehtmlref);
384 print
'<div class="fichecenter"><div class="fichehalfleft">';
386 print
'<div class="underbanner clearboth"></div>';
388 print
'<table class="border centpercent tableforfield">';
390 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
392 print
'<td class="error">';
393 print $langs->trans(
"LoginAccountDisableInDolibarr");
398 if (property_exists(
$object,
'admin')) {
400 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
401 } elseif (!empty(
$object->admin)) {
402 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
405 print showValueWithClipboardCPButton(
$object->login).$addadmin;
412 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
415 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
419 $huser->fetch(
$object->fk_user);
420 print $huser->getNomUrl(1);
422 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
426 $arrayApprover = $holidayapprover->fetch_users_approver_holiday();
427 if (!in_array((
string)
$object->fk_user, $arrayApprover)) {
428 print
'<br><span class="opacitymedium">('.$langs->trans(
"NotHolidayApprover").
')</span>';
433 $arrayApprover = $expensereportapprover->fetch_users_approver_expensereport();
434 if (!in_array((
string)
$object->fk_user, $arrayApprover)) {
435 print
'<br><span class="opacitymedium">('.$langs->trans(
"NotExpenseReportApprover").
')</span>';
445 $text = $langs->trans(
"ForceUserExpenseValidator");
446 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
449 if (!empty(
$object->fk_user_expense_validator)) {
451 $evuser->fetch(
$object->fk_user_expense_validator);
452 print $evuser->getNomUrl(1);
461 $text = $langs->trans(
"ForceUserHolidayValidator");
462 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
465 if (!empty(
$object->fk_user_holiday_validator)) {
467 $hvuser->fetch(
$object->fk_user_holiday_validator);
468 print $hvuser->getNomUrl(1);
475 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
476 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
480 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
487 if ((empty($user->socid) && in_array($id, $childids))
488 || (
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'readall'))
489 || (
isModEnabled(
'hrm') && $user->hasRight(
'hrm',
'employee',
'read'))) {
490 $langs->load(
"salaries");
493 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
495 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
501 $text = $langs->trans(
"THM");
502 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
511 $text = $langs->trans(
"TJM");
512 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
521 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
524 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
527 if (
$object->dateemploymentend) {
528 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
535 if ($permissiontoreadhr) {
538 print $form->editfieldkey(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'));
540 print $form->editfieldval(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'),
'day',
$object->birth);
546 if ($permissiontoreadhr || $permissiontosimpleedit) {
547 print
'<tr class="nowrap">';
549 print $form->editfieldkey(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
551 print $form->editfieldval(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'email',
'',
null,
null,
'', 0,
'');
557 if ($permissiontoreadhr || $permissiontosimpleedit) {
558 print
'<tr class="nowrap">';
560 print $form->editfieldkey(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
562 print $form->editfieldval(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'phone',
'',
null,
null,
'', 0,
'');
568 print
'<tr class="nowrap">';
570 print $form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', (
string)
$object->default_c_exp_tax_cat,
$object, $user->hasRight(
'user',
'user',
'creer'));
572 if ($action ==
'editdefault_c_exp_tax_cat') {
573 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
574 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
575 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
576 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
577 $ret .= $form->selectExpenseCategories((
string)
$object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
578 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
579 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
584 print $langs->trans($label_exp_tax_cat);
590 print
'<tr class="nowrap">';
592 print $form->editfieldkey(
"DefaultRangeNumber",
'default_range', (
string)
$object->default_range,
$object, $user->hasRight(
'user',
'user',
'creer'));
594 if ($action ==
'editdefault_range') {
595 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
596 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
597 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
598 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
601 $maxRangeNum = $expensereportik->getMaxRangeNumber(
$object->default_c_exp_tax_cat);
603 $ret .= $form->selectarray(
'default_range', range(0, $maxRangeNum),
$object->default_range);
604 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
605 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
616 if ($permissiontoreadhr || $permissiontosimpleedit) {
617 print
'<tr class="nowrap">';
619 print $form->editfieldkey(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit);
621 print $form->editfieldval(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit,
'string',
$object->ref_employee);
627 if ($permissiontoreadhr) {
628 print
'<tr class="nowrap">';
630 print $form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr);
632 print $form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr,
'string',
$object->national_registration_number);
643 print $form->editfieldkey(
"UserAccountancyCodeGeneral",
'accountancycodeusergeneral',
length_accountg(
$object->accountancy_code_user_general),
$object, $user->hasRight(
'user',
'user',
'creer'));
645 if ($action ==
'editaccountancycodeusergeneral' && $user->hasRight(
'user',
'user',
'creer')) {
646 print $formaccounting->formAccountingAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->accountancy_code_user_general,
'accountancycodeusergeneral', 0, 1,
'', 1);
648 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
650 $accountingaccount->fetch(0,
$object->accountancy_code_user_general, 1);
651 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
654 print
'<span class="opacitymedium">';
655 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
658 $accountingAccountByDefault = $langs->trans(
"AccountingAccountByDefaultShort") .
": " .
length_accountg(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
659 print(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') ? $accountingAccountByDefault :
'');
660 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
667 print
'<tr class="nowrap">';
669 print $form->editfieldkey(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'));
671 print $form->editfieldval(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'),
'string',
'',
null,
null,
'', 0,
'');
678 print
'</div><div class="fichehalfright">';
685 (($user->hasRight(
'salaries',
'read') && (in_array(
$object->id, $childids) ||
$object->id == $user->id)) || ($user->hasRight(
'salaries',
'readall')))
690 $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";
691 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
692 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
693 $sql .=
" WHERE s.fk_user = ".((int)
$object->id);
694 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
695 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
696 $sql .=
" ORDER BY s.dateep DESC";
698 $resql =
$db->query($sql);
700 $num =
$db->num_rows($resql);
702 print
'<div class="div-table-responsive-no-min">';
703 print
'<table class="noborder centpercent">';
705 print
'<tr class="liste_titre">';
706 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>';
707 print
'</tr></table></td>';
711 while ($i < $num && $i < $MAXLIST) {
712 $objp =
$db->fetch_object($resql);
714 $salary->id = $objp->sid;
715 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
716 $salary->label = $objp->label;
717 $salary->datesp =
$db->jdate($objp->datesp);
718 $salary->dateep =
$db->jdate($objp->dateep);
719 $salary->paye = $objp->paye;
720 $salary->amount = $objp->amount;
722 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
723 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
724 $payment_salary->datep =
$db->jdate(!empty($objp->datep) ? $objp->datep :
"");
726 print
'<tr class="oddeven">';
727 print
'<td class="nowraponall">';
728 print $salary->getNomUrl(1);
730 print
'<td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->datesp),
'day').
"</td>\n";
731 print
'<td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->dateep),
'day').
"</td>\n";
732 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
733 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
740 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
750 if (
isModEnabled(
'holiday') && ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') &&
$object->id == $user->id))) {
753 $sql =
"SELECT h.rowid, h.ref, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
754 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
755 $sql .=
" WHERE h.fk_user = ".((int)
$object->id);
756 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
757 $sql .=
" ORDER BY h.date_debut DESC";
759 $resql =
$db->query($sql);
761 $num =
$db->num_rows($resql);
763 print
'<div class="div-table-responsive-no-min">';
764 print
'<table class="noborder centpercent">';
766 print
'<tr class="liste_titre">';
767 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>';
768 print
'</tr></table></td>';
772 while ($i < $num && $i < $MAXLIST) {
773 $objp =
$db->fetch_object($resql);
775 $holiday->id = $objp->rowid;
776 $holiday->ref = $objp->ref;
778 $holiday->fk_type = $objp->fk_type;
779 $holiday->statut = $objp->status;
780 $holiday->status = $objp->status;
782 $nbopenedday =
num_open_day(
$db->jdate($objp->date_debut,
'gmt'),
$db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday,
$object->country_id);
784 print
'<tr class="oddeven">';
785 print
'<td class="nowraponall">';
786 print $holiday->getNomUrl(1);
787 print
'</td><td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->date_debut),
'day').
"</td>\n";
788 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
789 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
796 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
807 ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') &&
$object->id == $user->id))
811 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
812 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
813 $sql .=
" WHERE e.fk_user_author = ".((int)
$object->id);
814 $sql .=
" AND e.entity = ".((int)
$conf->entity);
815 $sql .=
" ORDER BY e.date_debut DESC";
817 $resql =
$db->query($sql);
819 $num =
$db->num_rows($resql);
821 print
'<div class="div-table-responsive-no-min">';
822 print
'<table class="noborder centpercent">';
824 print
'<tr class="liste_titre">';
825 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>';
826 print
'</tr></table></td>';
830 while ($i < $num && $i < $MAXLIST) {
831 $objp =
$db->fetch_object($resql);
833 $exp->id = $objp->rowid;
834 $exp->ref = $objp->ref;
835 $exp->status = $objp->status;
837 print
'<tr class="oddeven">';
838 print
'<td class="nowraponall">';
839 print $exp->getNomUrl(1);
840 print
'</td><td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->date_debut),
'day').
"</td>\n";
841 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
842 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
849 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
858 print
'</div></div>';
859 print
'<div class="clearboth"></div>';
866 if ($account->id == 0) {
867 if ($permissiontoaddbankaccount) {
868 $morehtmlright = dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=create');
870 $morehtmlright = dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
873 $morehtmlright = dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
876 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
878 print
'<div class="div-table-responsive-no-min">';
879 print
'<table class="liste centpercent">';
881 print
'<tr class="liste_titre">';
891 if ($account->id > 0) {
892 print
'<tr class="oddeven">';
894 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
896 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
900 foreach ($account->getFieldsToShow() as $val) {
901 if ($val ==
'BankCode') {
903 } elseif ($val ==
'BankAccountNumber') {
905 } elseif ($val ==
'DeskCode') {
907 } elseif ($val ==
'BankAccountNumberKey') {
911 if (!empty($account->label) && $account->number) {
913 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
915 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
919 print $stringescaped;
922 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
getIbanHumanReadable($account)).
'">';
923 if (!empty($account->iban)) {
925 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
931 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($account->bic).
'">';
932 if (!empty($account->bic)) {
934 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
941 print
'<td>'.$account->currency_code.
'</td>';
944 print
'<td class="right nowraponall">';
945 if ($permissiontoaddbankaccount) {
946 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=edit&token='.newToken().
'">';
947 print
img_picto($langs->trans(
"Modify"),
'edit');
950 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.newToken().
'">';
951 print
img_picto($langs->trans(
"Delete"),
'delete');
960 if ($account->id == 0) {
962 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
971 $parameters = array(
'colspan' =>
' colspan="2"');
972 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
976if ($id && ($action ==
'edit' || $action ==
'create') && $permissiontoaddbankaccount) {
977 $title = $langs->trans(
"User");
980 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
982 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
984 print
'<div class="underbanner clearboth"></div>';
987 print
'<table class="border centpercent">';
989 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Label").
'</td>';
990 print
'<td><input size="30" type="text" name="label" value="'.$account->label.
'" autofocus></td></tr>';
992 print
'<tr><td class="">'.$langs->trans(
"BankName").
'</td>';
993 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
996 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
997 print
'<input type="hidden" value="'.$account->currency_code.
'">';
999 print
'<td class="maxwidth200onsmartphone">';
1000 $selectedcode = $account->currency_code;
1001 if (!$selectedcode) {
1002 $selectedcode =
$conf->currency;
1004 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
1005 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
1009 $account->country_id = $account->country_id ? $account->country_id :
$mysoc->country_id;
1010 $selectedcode = $account->country_code;
1011 if (GETPOSTISSET(
"account_country_id")) {
1012 $selectedcode =
GETPOST(
"account_country_id");
1013 } elseif (empty($selectedcode)) {
1014 $selectedcode =
$mysoc->country_code;
1016 $account->country_code =
getCountry($selectedcode,
'2');
1018 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1019 print
'<td class="maxwidth200onsmartphone">';
1020 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1022 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1027 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1028 if ($selectedcode) {
1029 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1030 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
1036 $bankaccount = $account;
1039 foreach ($bankaccount->getFieldsToShow(1) as $val) {
1044 $content =
'UNKNOWN';
1046 if ($val ==
'BankCode') {
1047 $name =
'code_banque';
1049 $content = $bankaccount->code_banque;
1050 } elseif ($val ==
'DeskCode') {
1051 $name =
'code_guichet';
1053 $content = $bankaccount->code_guichet;
1054 } elseif ($val ==
'BankAccountNumber') {
1057 $content = $bankaccount->number;
1058 } elseif ($val ==
'BankAccountNumberKey') {
1061 $content = $bankaccount->cle_rib;
1062 } elseif ($val ==
'IBAN') {
1065 $content = $bankaccount->iban;
1066 if ($bankaccount->needIBAN()) {
1069 $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';
1070 } elseif ($val ==
'BIC') {
1073 $content = $bankaccount->bic;
1074 if ($bankaccount->needIBAN()) {
1077 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1080 print
'<td'.($require ?
' class="fieldrequired" ' :
'').
'>';
1082 print $form->textwithpicto($langs->trans($val), $tooltip, 4,
'help',
'', 0, 3, $name);
1084 print $langs->trans($val);
1087 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1091 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
1092 print
'<textarea name="address" rows="4" class="quatrevingtpercent">';
1094 print
"</textarea></td></tr>";
1096 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1097 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->owner_name.
'"></td></tr>';
1098 print
"</td></tr>\n";
1100 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
1101 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
1103 print
"</textarea></td></tr>";
1111 print $form->buttonsSaveCancel($action ==
'create' ?
"Create" :
"Modify");
1114if ($id && $action ==
'edit' && $permissiontoaddbankaccount) {
1118if ($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='', $user_id=0)
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.
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)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
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.
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.
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.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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.