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);
102 if ($account->id > 0) {
103 if ((
int) $account->userid !== (
int)
$object->id) {
106 if ((
int) $account->entity !== (
int)
$conf->entity) {
111if (empty($account->userid)) {
112 $account->userid =
$object->id;
116$selfpermission = ($user->id ==
$id && $user->hasRight(
'user',
'self',
'creer'));
117$usercanadd = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer') || $user->hasRight(
'hrm',
'write_personal_information',
'write'));
118$usercanread = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'lire') || $user->hasRight(
'hrm',
'read_personal_information',
'read'));
119$permissiontoaddbankaccount = ($user->hasRight(
'salaries',
'write') || $user->hasRight(
'hrm',
'employee',
'write') || $user->hasRight(
'user',
'user',
'creer') || $selfpermission);
120$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
121$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
122$permissiontosimpleedit = ($selfpermission || $usercanadd);
124$childids = $user->getAllChildIds(1);
129if ($user->id == $id) {
132if ($user->hasRight(
'salaries',
'readall')) {
135if ($user->hasRight(
'hrm',
'read')) {
138if ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') && in_array(
$object->id, $childids))) {
141if ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') && in_array(
$object->id, $childids))) {
153if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
154 $account->userid =
$object->id;
156 $account->bank =
GETPOST(
'bank',
'alpha');
157 $account->label =
GETPOST(
'label',
'alpha');
159 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
160 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
161 $account->number =
GETPOST(
'number',
'alpha');
162 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
163 $account->bic =
GETPOST(
'bic',
'alpha');
164 $account->iban =
GETPOST(
'iban',
'alpha');
165 $account->address =
GETPOST(
'address',
'alpha');
167 $account->owner_name =
GETPOST(
'proprio',
'alpha');
168 $account->proprio = $account->owner_name;
169 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
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");
175 $result = $account->create($user);
186if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
187 $account->userid =
$object->id;
189 $account->bank =
GETPOST(
'bank',
'alpha');
190 $account->label =
GETPOST(
'label',
'alpha');
192 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
193 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
194 $account->number =
GETPOST(
'number',
'alpha');
195 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
196 $account->bic =
GETPOST(
'bic',
'alpha');
197 $account->iban =
GETPOST(
'iban',
'alpha');
198 $account->address =
GETPOST(
'address',
'alpha');
199 $account->owner_name =
GETPOST(
'proprio',
'alpha');
200 $account->proprio = $account->owner_name;
201 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
203 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
204 $account->state_id =
GETPOSTINT(
"account_state_id");
205 $account->country_id =
GETPOSTINT(
"account_country_id");
207 $result = $account->update($user);
218if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
219 $result = $account->delete($user);
224 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.
$object->id);
231if ($action ==
'setbirth' && $permissiontowritehr && !$cancel) {
233 $result =
$object->update($user);
240if ($action ==
'setpersonal_email' && $permissiontosimpleedit && !$cancel) {
242 $result =
$object->update($user);
249if ($action ==
'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) {
251 $result =
$object->update($user);
258if ($action ==
'setaccountancycodeusergeneral' && $usercanadd) {
260 $object->accountancy_code_user_general =
GETPOST(
"accountancycodeusergeneral");
261 $result =
$object->update($user);
264 $action =
'editaccountancycodeusergeneral';
268if ($action ==
'setaccountancy_code' && $usercanadd && !$cancel) {
270 $result =
$object->update($user);
277if ($action ==
'setref_employee' && $usercanadd && !$cancel) {
279 $result =
$object->update($user);
286if ($action ==
'setnational_registration_number' && $permissiontowritehr && !$cancel) {
287 $object->national_registration_number = (
string)
GETPOST(
'national_registration_number',
'alphanohtml');
288 $result =
$object->update($user);
296 if ($action ==
'setdefault_c_exp_tax_cat' && $usercanadd) {
298 $result =
$object->update($user);
305 if ($action ==
'setdefault_range' && $usercanadd) {
307 $result =
$object->update($user);
323$title = $person_name.
" - ".$langs->trans(
'BankAccounts');
325llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-bank');
329if ($id && $bankid && $action ==
'edit' && !$cancel && $permissiontoaddbankaccount) {
330 if (
$conf->use_javascript_ajax) {
332 print
'jQuery(document).ready(function () {
333 jQuery("#type").change(function() {
334 document.formbank.action.value="edit";
335 document.formbank.submit();
337 jQuery("#selectaccount_country_id").change(function() {
338 document.formbank.action.value="edit";
339 document.formbank.submit();
344 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" name="formbank" method="post">';
345 print
'<input type="hidden" name="token" value="'.newToken().
'">';
346 print
'<input type="hidden" name="action" value="update">';
347 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
348 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
350if ($id && $action ==
'create' && !$cancel && $permissiontoaddbankaccount) {
351 if (
$conf->use_javascript_ajax) {
353 print
'jQuery(document).ready(function () {
354 jQuery("#type").change(function() {
355 document.formbank.action.value="create";
356 document.formbank.submit();
358 jQuery("#selectaccount_country_id").change(function() {
359 document.formbank.action.value="create";
360 document.formbank.submit();
365 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" name="formbank" method="post">';
366 print
'<input type="hidden" name="token" value="'.newToken().
'">';
367 print
'<input type="hidden" name="action" value="add">';
368 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
373if ($action !=
'edit' && $action !=
'create') {
374 $title = $langs->trans(
"User");
379 if ($user->hasRight(
'user',
'user',
'lire') || $user->admin) {
380 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
383 $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">';
384 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
385 $morehtmlref .=
'</a>';
387 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
388 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
390 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin,
'rowid',
'ref', $morehtmlref);
392 print
'<div class="fichecenter"><div class="fichehalfleft">';
394 print
'<div class="underbanner clearboth"></div>';
396 print
'<table class="border centpercent tableforfield">';
398 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
400 print
'<td class="error">';
401 print $langs->trans(
"LoginAccountDisableInDolibarr");
406 if (property_exists(
$object,
'admin')) {
408 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
409 } elseif (!empty(
$object->admin)) {
410 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
420 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
423 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
427 $huser->fetch(
$object->fk_user);
428 print $huser->getNomUrl(1);
430 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
434 $arrayApprover = $holidayapprover->fetch_users_approver_holiday();
435 if (!in_array((
string)
$object->fk_user, $arrayApprover)) {
436 print
'<br><span class="opacitymedium">('.$langs->trans(
"NotHolidayApprover").
')</span>';
441 $arrayApprover = $expensereportapprover->fetch_users_approver_expensereport();
442 if (!in_array((
string)
$object->fk_user, $arrayApprover)) {
443 print
'<br><span class="opacitymedium">('.$langs->trans(
"NotExpenseReportApprover").
')</span>';
453 $text = $langs->trans(
"ForceUserExpenseValidator");
454 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
457 if (!empty(
$object->fk_user_expense_validator)) {
459 $evuser->fetch(
$object->fk_user_expense_validator);
460 print $evuser->getNomUrl(1);
469 $text = $langs->trans(
"ForceUserHolidayValidator");
470 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
473 if (!empty(
$object->fk_user_holiday_validator)) {
475 $hvuser->fetch(
$object->fk_user_holiday_validator);
476 print $hvuser->getNomUrl(1);
483 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
484 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
488 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
495 if ((empty($user->socid) && in_array($id, $childids))
496 || (
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'readall'))
497 || (
isModEnabled(
'hrm') && $user->hasRight(
'hrm',
'employee',
'read'))) {
498 $langs->load(
"salaries");
501 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
503 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
509 $text = $langs->trans(
"THM");
510 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
519 $text = $langs->trans(
"TJM");
520 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
529 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
532 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
535 if (
$object->dateemploymentend) {
536 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
543 if ($permissiontoreadhr) {
546 print $form->editfieldkey(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'));
548 print $form->editfieldval(
"DateOfBirth",
'birth',
$object->birth,
$object, $user->hasRight(
'user',
'user',
'creer'),
'day',
$object->birth);
554 if ($permissiontoreadhr || $permissiontosimpleedit) {
555 print
'<tr class="nowrap">';
557 print $form->editfieldkey(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
559 print $form->editfieldval(
"UserPersonalEmail",
'personal_email',
$object->personal_email,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'email',
'',
null,
null,
'', 0,
'');
565 if ($permissiontoreadhr || $permissiontosimpleedit) {
566 print
'<tr class="nowrap">';
568 print $form->editfieldkey(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr);
570 print $form->editfieldval(
"UserPersonalMobile",
'personal_mobile',
$object->personal_mobile,
$object, $user->hasRight(
'user',
'user',
'creer') || $permissiontowritehr,
'phone',
'',
null,
null,
'', 0,
'');
576 print
'<tr class="nowrap">';
578 print $form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', (
string)
$object->default_c_exp_tax_cat,
$object, $user->hasRight(
'user',
'user',
'creer'));
580 if ($action ==
'editdefault_c_exp_tax_cat') {
581 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
582 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
583 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
584 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
585 $ret .= $form->selectExpenseCategories((
string)
$object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
586 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
587 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
592 print $langs->trans($label_exp_tax_cat);
598 print
'<tr class="nowrap">';
600 print $form->editfieldkey(
"DefaultRangeNumber",
'default_range', (
string)
$object->default_range,
$object, $user->hasRight(
'user',
'user',
'creer'));
602 if ($action ==
'editdefault_range') {
603 $ret =
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
604 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
605 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
606 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
609 $maxRangeNum = $expensereportik->getMaxRangeNumber(
$object->default_c_exp_tax_cat);
611 $ret .= $form->selectarray(
'default_range', range(0, $maxRangeNum),
$object->default_range);
612 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
613 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
624 if ($permissiontoreadhr || $permissiontosimpleedit) {
625 print
'<tr class="nowrap">';
627 print $form->editfieldkey(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit);
629 print $form->editfieldval(
"RefEmployee",
'ref_employee',
$object->ref_employee,
$object, $permissiontowritehr || $permissiontosimpleedit,
'string',
$object->ref_employee);
635 if ($permissiontoreadhr) {
636 print
'<tr class="nowrap">';
638 print $form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr);
640 print $form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number',
$object->national_registration_number,
$object, $permissiontowritehr,
'string',
$object->national_registration_number);
651 print $form->editfieldkey(
"UserAccountancyCodeGeneral",
'accountancycodeusergeneral',
length_accountg(
$object->accountancy_code_user_general),
$object, $user->hasRight(
'user',
'user',
'creer'));
653 if ($action ==
'editaccountancycodeusergeneral' && $user->hasRight(
'user',
'user',
'creer')) {
654 print $formaccounting->formAccountingAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->accountancy_code_user_general,
'accountancycodeusergeneral', 0, 1,
'', 1);
656 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
658 $accountingaccount->fetch(0,
$object->accountancy_code_user_general, 1);
659 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
662 print
'<span class="opacitymedium">';
663 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
666 $accountingAccountByDefault = $langs->trans(
"AccountingAccountByDefaultShort") .
": " .
length_accountg(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
667 print(
getDolGlobalString(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') ? $accountingAccountByDefault :
'');
668 if (!empty(
$object->accountancy_code_user_general) &&
$object->accountancy_code_user_general !=
'-1') {
675 print
'<tr class="nowrap">';
677 print $form->editfieldkey(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'));
679 print $form->editfieldval(
"UserSubledgerAccountancyCode",
'accountancy_code',
$object->accountancy_code,
$object, $user->hasRight(
'user',
'user',
'creer'),
'string',
'',
null,
null,
'', 0,
'');
686 print
'</div><div class="fichehalfright">';
693 (($user->hasRight(
'salaries',
'read') && (in_array(
$object->id, $childids) ||
$object->id == $user->id)) || ($user->hasRight(
'salaries',
'readall')))
698 $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";
699 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
700 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
701 $sql .=
" WHERE s.fk_user = ".((int)
$object->id);
702 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
703 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
704 $sql .=
" ORDER BY s.dateep DESC";
706 $resql =
$db->query($sql);
708 $num =
$db->num_rows($resql);
710 print
'<div class="div-table-responsive-no-min">';
711 print
'<table class="noborder centpercent">';
713 print
'<tr class="liste_titre">';
714 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>';
715 print
'</tr></table></td>';
719 while ($i < $num && $i < $MAXLIST) {
720 $objp =
$db->fetch_object($resql);
722 $salary->id = $objp->sid;
723 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
724 $salary->label = $objp->label;
725 $salary->datesp =
$db->jdate($objp->datesp);
726 $salary->dateep =
$db->jdate($objp->dateep);
727 $salary->paye = $objp->paye;
728 $salary->amount = $objp->amount;
730 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
731 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
732 $payment_salary->datep =
$db->jdate(!empty($objp->datep) ? $objp->datep :
"");
734 print
'<tr class="oddeven">';
735 print
'<td class="nowraponall">';
736 print $salary->getNomUrl(1);
738 print
'<td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->datesp),
'day').
"</td>\n";
739 print
'<td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->dateep),
'day').
"</td>\n";
740 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
741 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
748 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
758 if (
isModEnabled(
'holiday') && ($user->hasRight(
'holiday',
'readall') || ($user->hasRight(
'holiday',
'read') &&
$object->id == $user->id))) {
761 $sql =
"SELECT h.rowid, h.ref, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
762 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
763 $sql .=
" WHERE h.fk_user = ".((int)
$object->id);
764 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
765 $sql .=
" ORDER BY h.date_debut DESC";
767 $resql =
$db->query($sql);
769 $num =
$db->num_rows($resql);
771 print
'<div class="div-table-responsive-no-min">';
772 print
'<table class="noborder centpercent">';
774 print
'<tr class="liste_titre">';
775 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>';
776 print
'</tr></table></td>';
780 while ($i < $num && $i < $MAXLIST) {
781 $objp =
$db->fetch_object($resql);
783 $holiday->id = $objp->rowid;
784 $holiday->ref = $objp->ref;
786 $holiday->fk_type = $objp->fk_type;
787 $holiday->statut = $objp->status;
788 $holiday->status = $objp->status;
790 $nbopenedday =
num_open_day(
$db->jdate($objp->date_debut,
'gmt'),
$db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday,
$object->country_id);
792 print
'<tr class="oddeven">';
793 print
'<td class="nowraponall">';
794 print $holiday->getNomUrl(1);
795 print
'</td><td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->date_debut),
'day').
"</td>\n";
796 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
797 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
804 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
815 ($user->hasRight(
'expensereport',
'readall') || ($user->hasRight(
'expensereport',
'read') &&
$object->id == $user->id))
819 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
820 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
821 $sql .=
" WHERE e.fk_user_author = ".((int)
$object->id);
822 $sql .=
" AND e.entity = ".((int)
$conf->entity);
823 $sql .=
" ORDER BY e.date_debut DESC";
825 $resql =
$db->query($sql);
827 $num =
$db->num_rows($resql);
829 print
'<div class="div-table-responsive-no-min">';
830 print
'<table class="noborder centpercent">';
832 print
'<tr class="liste_titre">';
833 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>';
834 print
'</tr></table></td>';
838 while ($i < $num && $i < $MAXLIST) {
839 $objp =
$db->fetch_object($resql);
841 $exp->id = $objp->rowid;
842 $exp->ref = $objp->ref;
843 $exp->status = $objp->status;
845 print
'<tr class="oddeven">';
846 print
'<td class="nowraponall">';
847 print $exp->getNomUrl(1);
848 print
'</td><td class="right nowraponall">'.dol_print_date(
$db->jdate($objp->date_debut),
'day').
"</td>\n";
849 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
850 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
857 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
866 print
'</div></div>';
867 print
'<div class="clearboth"></div>';
874 if ($account->id == 0) {
875 if ($permissiontoaddbankaccount) {
876 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=create');
878 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
881 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
884 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
886 print
'<div class="div-table-responsive-no-min">';
887 print
'<table class="liste centpercent">';
889 print
'<tr class="liste_titre">';
899 if ($account->id > 0) {
900 print
'<tr class="oddeven">';
902 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
904 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
908 foreach ($account->getFieldsToShow() as $val) {
909 if ($val ==
'BankCode') {
911 } elseif ($val ==
'BankAccountNumber') {
913 } elseif ($val ==
'DeskCode') {
915 } elseif ($val ==
'BankAccountNumberKey') {
919 if (!empty($account->label) && $account->number) {
921 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
923 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
927 print $stringescaped;
930 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
getIbanHumanReadable($account)).
'">';
931 if (!empty($account->iban)) {
933 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
939 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($account->bic).
'">';
940 if (!empty($account->bic)) {
942 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
949 print
'<td>'.$account->currency_code.
'</td>';
952 print
'<td class="right nowraponall">';
953 if ($permissiontoaddbankaccount) {
954 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=edit&token='.
newToken().
'">';
955 print
img_picto($langs->trans(
"Modify"),
'edit');
958 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.
newToken().
'">';
959 print
img_picto($langs->trans(
"Delete"),
'delete');
968 if ($account->id == 0) {
970 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
979 $parameters = array(
'colspan' =>
' colspan="2"');
980 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
984if ($id && ($action ==
'edit' || $action ==
'create') && $permissiontoaddbankaccount) {
985 $title = $langs->trans(
"User");
988 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
990 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
992 print
'<div class="underbanner clearboth"></div>';
995 print
'<table class="border centpercent">';
997 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Label").
'</td>';
998 print
'<td><input size="30" type="text" name="label" value="'.$account->label.
'" autofocus></td></tr>';
1000 print
'<tr><td class="">'.$langs->trans(
"BankName").
'</td>';
1001 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
1004 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
1005 print
'<input type="hidden" value="'.$account->currency_code.
'">';
1007 print
'<td class="maxwidth200onsmartphone">';
1008 $selectedcode = $account->currency_code;
1009 if (!$selectedcode) {
1010 $selectedcode =
$conf->currency;
1012 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
1013 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
1017 $account->country_id = $account->country_id ? $account->country_id :
$mysoc->country_id;
1018 $selectedcode = $account->country_code;
1019 if (GETPOSTISSET(
"account_country_id")) {
1020 $selectedcode =
GETPOST(
"account_country_id");
1021 } elseif (empty($selectedcode)) {
1022 $selectedcode =
$mysoc->country_code;
1024 $account->country_code =
getCountry($selectedcode,
'2');
1026 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1027 print
'<td class="maxwidth200onsmartphone">';
1028 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1030 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1035 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1036 if ($selectedcode) {
1037 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1038 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
1044 $bankaccount = $account;
1047 foreach ($bankaccount->getFieldsToShow(1) as $val) {
1052 $content =
'UNKNOWN';
1054 if ($val ==
'BankCode') {
1055 $name =
'code_banque';
1057 $content = $bankaccount->code_banque;
1058 } elseif ($val ==
'DeskCode') {
1059 $name =
'code_guichet';
1061 $content = $bankaccount->code_guichet;
1062 } elseif ($val ==
'BankAccountNumber') {
1065 $content = $bankaccount->number;
1066 } elseif ($val ==
'BankAccountNumberKey') {
1069 $content = $bankaccount->cle_rib;
1070 } elseif ($val ==
'IBAN') {
1073 $content = $bankaccount->iban;
1074 if ($bankaccount->needIBAN()) {
1077 $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';
1078 } elseif ($val ==
'BIC') {
1081 $content = $bankaccount->bic;
1082 if ($bankaccount->needIBAN()) {
1085 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1088 print
'<td'.($require ?
' class="fieldrequired" ' :
'').
'>';
1090 print $form->textwithpicto($langs->trans($val), $tooltip, 4,
'help',
'', 0, 3, $name);
1092 print $langs->trans($val);
1095 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1099 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
1100 print
'<textarea name="address" rows="4" class="quatrevingtpercent">';
1102 print
"</textarea></td></tr>";
1104 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1105 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->owner_name.
'"></td></tr>';
1106 print
"</td></tr>\n";
1108 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
1109 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
1111 print
"</textarea></td></tr>";
1119 print $form->buttonsSaveCancel($action ==
'create' ?
"Create" :
"Modify");
1122if ($id && $action ==
'edit' && $permissiontoaddbankaccount) {
1126if ($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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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)
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.
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_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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
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...
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
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.