32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/userbankaccount.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39if (isModEnabled(
'holiday')) {
40 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
42if (isModEnabled(
'expensereport')) {
43 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
45if (isModEnabled(
'salaries')) {
46 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
51$langs->loadLangs(array(
'companies',
'commercial',
'banks',
'bills',
'trips',
'holiday',
'salaries'));
54$ref =
GETPOST(
'ref',
'alphanohtml');
55$bankid =
GETPOST(
'bankid',
'int');
56$action =
GETPOST(
"action",
'alpha');
57$cancel =
GETPOST(
'cancel',
'alpha');
61if ($user->socid > 0) {
62 $socid = $user->socid;
64$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
66$object =
new User($db);
67if ($id > 0 || !empty($ref)) {
68 $result = $object->fetch($id, $ref,
'', 1);
74 $account->fetch(0,
'', $id);
76 $account->fetch($bankid);
78if (empty($account->userid)) {
79 $account->userid = $object->id;
83$canadduser = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
84$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
85$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || $user->hasRight(
'user',
'creer'));
86$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
87$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
92if ($user->id == $id) {
95if (!empty($user->rights->salaries->read)) {
98if (!empty($user->rights->hrm->read)) {
101if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
113if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
114 $account->userid = $object->id;
116 $account->bank =
GETPOST(
'bank',
'alpha');
117 $account->label =
GETPOST(
'label',
'alpha');
118 $account->courant =
GETPOST(
'courant',
'alpha');
119 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
120 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
121 $account->number =
GETPOST(
'number',
'alpha');
122 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
123 $account->bic =
GETPOST(
'bic',
'alpha');
124 $account->iban =
GETPOST(
'iban',
'alpha');
125 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
126 $account->proprio =
GETPOST(
'proprio',
'alpha');
127 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
129 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
130 $account->state_id =
GETPOST(
"account_state_id",
'int');
131 $account->country_id =
GETPOST(
"account_country_id",
'int');
133 $result = $account->create($user);
144if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
145 $account->userid = $object->id;
147 $account->bank =
GETPOST(
'bank',
'alpha');
148 $account->label =
GETPOST(
'label',
'alpha');
149 $account->courant =
GETPOST(
'courant',
'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->domiciliation =
GETPOST(
'domiciliation',
'alpha');
157 $account->proprio =
GETPOST(
'proprio',
'alpha');
158 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
160 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
161 $account->state_id =
GETPOST(
"account_state_id",
'int');
162 $account->country_id =
GETPOST(
"account_country_id",
'int');
164 $result = $account->update($user);
175if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
176 $result = $account->delete($user);
181 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.$object->id);
188if ($action ==
'setbirth' && $canadduser && !$cancel) {
190 $result = $object->update($user);
197if ($action ==
'setpersonal_email' && $canadduser && !$cancel) {
198 $object->personal_email = (string)
GETPOST(
'personal_email',
'alphanohtml');
199 $result = $object->update($user);
206if ($action ==
'setpersonal_mobile' && $canadduser && !$cancel) {
207 $object->personal_mobile = (string)
GETPOST(
'personal_mobile',
'alphanohtml');
208 $result = $object->update($user);
215if ($action ==
'setaccountancy_code' && $canadduser && !$cancel) {
216 $object->accountancy_code = (string)
GETPOST(
'accountancy_code',
'alphanohtml');
217 $result = $object->update($user);
224if ($action ==
'setref_employee' && $canadduser && !$cancel) {
225 $object->ref_employee = (string)
GETPOST(
'ref_employee',
'alphanohtml');
226 $result = $object->update($user);
233if ($action ==
'setnational_registration_number' && $canadduser && !$cancel) {
234 $object->national_registration_number = (string)
GETPOST(
'national_registration_number',
'alphanohtml');
235 $result = $object->update($user);
241if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
243 if ($action ==
'setdefault_c_exp_tax_cat' && $canadduser) {
244 $object->default_c_exp_tax_cat =
GETPOST(
'default_c_exp_tax_cat',
'int');
245 $result = $object->update($user);
252 if ($action ==
'setdefault_range' && $canadduser) {
253 $object->default_range =
GETPOST(
'default_range',
'int');
254 $result = $object->update($user);
266$form =
new Form($db);
269$childids = $user->getAllChildIds(1);
271$person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
272$title = $person_name.
" - ".$langs->trans(
'BankAccounts');
278if ($id && $bankid && $action ==
'edit' && ($user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write)) {
279 if ($conf->use_javascript_ajax) {
281 print
'jQuery(document).ready(function () {
282 jQuery("#type").change(function() {
283 document.formbank.action.value="edit";
284 document.formbank.submit();
286 jQuery("#selectaccount_country_id").change(function() {
287 document.formbank.action.value="edit";
288 document.formbank.submit();
293 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
294 print
'<input type="hidden" name="token" value="'.newToken().
'">';
295 print
'<input type="hidden" name="action" value="update">';
296 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">';
297 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
299if ($id && $action ==
'create' && $user->hasRight(
'user',
'user',
'creer')) {
300 if ($conf->use_javascript_ajax) {
302 print
'jQuery(document).ready(function () {
303 jQuery("#type").change(function() {
304 document.formbank.action.value="create";
305 document.formbank.submit();
307 jQuery("#selectaccount_country_id").change(function() {
308 document.formbank.action.value="create";
309 document.formbank.submit();
314 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
315 print
'<input type="hidden" name="token" value="'.newToken().
'">';
316 print
'<input type="hidden" name="action" value="add">';
317 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
322if ($action !=
'edit' && $action !=
'create') {
323 $title = $langs->trans(
"User");
328 if ($user->rights->user->user->lire || $user->admin) {
329 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
332 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName($object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener">';
333 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
334 $morehtmlref .=
'</a>';
336 $urltovirtualcard =
'/user/virtualcard.php?id='.((int) $object->id);
337 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->trans(
"PublicVirtualCardUrl").
' - '.$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
339 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
341 print
'<div class="fichecenter"><div class="fichehalfleft">';
343 print
'<div class="underbanner clearboth"></div>';
345 print
'<table class="border centpercent tableforfield">';
347 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
348 if (!empty($object->ldap_sid) && $object->statut == 0) {
349 print
'<td class="error">';
350 print $langs->trans(
"LoginAccountDisableInDolibarr");
355 if (property_exists($object,
'admin')) {
356 if (isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
357 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
358 } elseif (!empty($object->admin)) {
359 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
369 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
371 if (empty($object->fk_user)) {
372 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
374 $huser =
new User($db);
375 if ($object->fk_user > 0) {
376 $huser->fetch($object->fk_user);
377 print $huser->getNomUrl(1);
379 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
386 if (isModEnabled(
'expensereport')) {
388 $text = $langs->trans(
"ForceUserExpenseValidator");
389 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
392 if (!empty($object->fk_user_expense_validator)) {
393 $evuser =
new User($db);
394 $evuser->fetch($object->fk_user_expense_validator);
395 print $evuser->getNomUrl(1);
402 if (isModEnabled(
'holiday')) {
404 $text = $langs->trans(
"ForceUserHolidayValidator");
405 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
408 if (!empty($object->fk_user_holiday_validator)) {
409 $hvuser =
new User($db);
410 $hvuser->fetch($object->fk_user_holiday_validator);
411 print $hvuser->getNomUrl(1);
418 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
419 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
423 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
430 if ((empty($user->socid) && in_array($id, $childids))
431 || (isModEnabled(
'salaries') && !empty($user->rights->salaries->readall))
432 || (isModEnabled(
'hrm') && !empty($user->rights->hrm->employee->read))) {
433 $langs->load(
"salaries");
436 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
438 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
444 $text = $langs->trans(
"THM");
445 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
448 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
454 $text = $langs->trans(
"TJM");
455 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
458 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
464 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
466 if ($object->dateemployment) {
467 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
470 if ($object->dateemploymentend) {
471 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
478 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
481 print $form->editfieldkey(
"DateOfBirth",
'birth', $object->birth, $object, $user->hasRight(
'user',
'user',
'creer'));
483 print $form->editfieldval(
"DateOfBirth",
'birth', $object->birth, $object, $user->hasRight(
'user',
'user',
'creer'),
'day', $object->birth);
489 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
490 print
'<tr class="nowrap">';
492 print $form->editfieldkey(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
494 print $form->editfieldval(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write,
'email',
'',
null,
null,
'', 0,
'');
500 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
501 print
'<tr class="nowrap">';
503 print $form->editfieldkey(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
505 print $form->editfieldval(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write,
'phone',
'',
null,
null,
'', 0,
'');
510 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
511 print
'<tr class="nowrap">';
513 print $form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight(
'user',
'user',
'creer'));
515 if ($action ==
'editdefault_c_exp_tax_cat') {
516 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
517 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
518 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
519 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
520 $ret .= $form->selectExpenseCategories($object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
521 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
522 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
526 $label_exp_tax_cat =
dol_getIdFromCode($db, $object->default_c_exp_tax_cat,
'c_exp_tax_cat',
'rowid',
'label');
527 print $langs->trans($label_exp_tax_cat);
533 print
'<tr class="nowrap">';
535 print $form->editfieldkey(
"DefaultRangeNumber",
'default_range', $object->default_range, $object, $user->hasRight(
'user',
'user',
'creer'));
537 if ($action ==
'editdefault_range') {
538 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
539 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
540 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
541 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
544 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
546 $ret .= $form->selectarray(
'default_range', range(0, $maxRangeNum), $object->default_range);
547 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
548 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
552 print $object->default_range;
559 if (isModEnabled(
'accounting')) {
560 print
'<tr class="nowrap">';
562 print $form->editfieldkey(
"AccountancyCode",
'accountancy_code', $object->accountancy_code, $object, $user->hasRight(
'user',
'user',
'creer'));
564 print $form->editfieldval(
"AccountancyCode",
'accountancy_code', $object->accountancy_code, $object, $user->hasRight(
'user',
'user',
'creer'),
'string',
'',
null,
null,
'', 0,
'');
570 if ($permissiontoreadhr) {
571 print
'<tr class="nowrap">';
573 print $form->editfieldkey(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $permissiontowritehr);
575 print $form->editfieldval(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $permissiontowritehr,
'string', $object->ref_employee);
581 if ($permissiontoreadhr) {
582 print
'<tr class="nowrap">';
584 print $form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr);
586 print $form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr,
'string', $object->national_registration_number);
593 print
'</div><div class="fichehalfright">';
596 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
599 if (isModEnabled(
'salaries') &&
600 (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
603 $salary =
new Salary($db);
605 $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";
606 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
607 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
608 $sql .=
" WHERE s.fk_user = ".((int) $object->id);
609 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
610 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
611 $sql .=
" ORDER BY s.dateep DESC";
613 $resql = $db->query($sql);
615 $num = $db->num_rows($resql);
617 print
'<div class="div-table-responsive-no-min">';
618 print
'<table class="noborder centpercent">';
620 print
'<tr class="liste_titre">';
621 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>';
622 print
'</tr></table></td>';
626 while ($i < $num && $i < $MAXLIST) {
627 $objp = $db->fetch_object($resql);
629 $salary->id = $objp->sid;
630 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
631 $salary->label = $objp->label;
632 $salary->datesp = $db->jdate($objp->datesp);
633 $salary->dateep = $db->jdate($objp->dateep);
634 $salary->paye = $objp->paye;
635 $salary->amount = $objp->amount;
637 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
638 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
639 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep :
"");
641 print
'<tr class="oddeven">';
642 print
'<td class="nowraponall">';
643 print $salary->getNomUrl(1);
645 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp),
'day').
"</td>\n";
646 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep),
'day').
"</td>\n";
647 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
648 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
655 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
665 if (isModEnabled(
'holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
668 $sql =
"SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
669 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
670 $sql .=
" WHERE h.fk_user = ".((int) $object->id);
671 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
672 $sql .=
" ORDER BY h.date_debut DESC";
674 $resql = $db->query($sql);
676 $num = $db->num_rows($resql);
678 print
'<div class="div-table-responsive-no-min">';
679 print
'<table class="noborder centpercent">';
681 print
'<tr class="liste_titre">';
682 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>';
683 print
'</tr></table></td>';
687 while ($i < $num && $i < $MAXLIST) {
688 $objp = $db->fetch_object($resql);
690 $holiday->id = $objp->rowid;
691 $holiday->ref = $objp->rowid;
693 $holiday->fk_type = $objp->fk_type;
694 $holiday->statut = $objp->status;
695 $holiday->status = $objp->status;
697 $nbopenedday =
num_open_day($db->jdate($objp->date_debut,
'gmt'), $db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday);
699 print
'<tr class="oddeven">';
700 print
'<td class="nowraponall">';
701 print $holiday->getNomUrl(1);
702 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
703 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
704 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
711 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
721 if (isModEnabled(
'expensereport') &&
722 ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
726 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
727 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
728 $sql .=
" WHERE e.fk_user_author = ".((int) $object->id);
729 $sql .=
" AND e.entity = ".((int) $conf->entity);
730 $sql .=
" ORDER BY e.date_debut DESC";
732 $resql = $db->query($sql);
734 $num = $db->num_rows($resql);
736 print
'<div class="div-table-responsive-no-min">';
737 print
'<table class="noborder centpercent">';
739 print
'<tr class="liste_titre">';
740 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>';
741 print
'</tr></table></td>';
745 while ($i < $num && $i < $MAXLIST) {
746 $objp = $db->fetch_object($resql);
748 $exp->id = $objp->rowid;
749 $exp->ref = $objp->ref;
750 $exp->status = $objp->status;
752 print
'<tr class="oddeven">';
753 print
'<td class="nowraponall">';
754 print $exp->getNomUrl(1);
755 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
756 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
757 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
764 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
773 print
'</div></div>';
774 print
'<div class="clearboth"></div>';
781 if ($account->id == 0) {
782 if ($permissiontoaddbankaccount) {
783 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=create');
785 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
788 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
791 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
793 print
'<div class="div-table-responsive-no-min">';
794 print
'<table class="liste centpercent">';
796 print
'<tr class="liste_titre">';
806 if ($account->id > 0) {
807 print
'<tr class="oddeven">';
809 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
811 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
815 foreach ($account->getFieldsToShow() as $val) {
816 if ($val ==
'BankCode') {
818 } elseif ($val ==
'BankAccountNumber') {
820 } elseif ($val ==
'DeskCode') {
822 } elseif ($val ==
'BankAccountNumberKey') {
826 if (!empty($account->label) && $account->number) {
828 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
830 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
834 print $stringescaped;
837 print
'<td>'.getIbanHumanReadable($account);
838 if (!empty($account->iban)) {
840 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
847 if (!empty($account->bic)) {
849 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
855 print
'<td>'.$account->currency_code.
'</td>';
858 print
'<td class="right nowraponall">';
859 if ($permissiontoaddbankaccount) {
860 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=edit&token='.newToken().
'">';
861 print
img_picto($langs->trans(
"Modify"),
'edit');
864 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.newToken().
'">';
865 print
img_picto($langs->trans(
"Delete"),
'delete');
874 if ($account->id == 0) {
876 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
884if ($id && ($action ==
'edit' || $action ==
'create') && $user->hasRight(
'user',
'user',
'creer')) {
885 $title = $langs->trans(
"User");
888 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
890 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
894 print
'<div class="underbanner clearboth"></div>';
895 print
'<table class="border centpercent">';
897 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"LabelRIB").
'</td>';
898 print
'<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.
'"></td></tr>';
900 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankName").
'</td>';
901 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
904 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
905 print
'<input type="hidden" value="'.$account->currency_code.
'">';
907 print
'<td class="maxwidth200onsmartphone">';
908 $selectedcode = $account->currency_code;
909 if (!$selectedcode) {
910 $selectedcode = $conf->currency;
912 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
913 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
917 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
918 $selectedcode = $account->country_code;
919 if (GETPOSTISSET(
"account_country_id")) {
920 $selectedcode =
GETPOST(
"account_country_id");
921 } elseif (empty($selectedcode)) {
922 $selectedcode = $mysoc->country_code;
924 $account->country_code =
getCountry($selectedcode, 2);
926 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
927 print
'<td class="maxwidth200onsmartphone">';
928 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
930 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
935 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
937 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
938 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
940 print $countrynotdefined;
945 foreach ($account->getFieldsToShow() as $val) {
946 if ($val ==
'BankCode') {
947 $name =
'code_banque';
949 $content = $account->code_banque;
950 } elseif ($val ==
'DeskCode') {
951 $name =
'code_guichet';
953 $content = $account->code_guichet;
954 } elseif ($val ==
'BankAccountNumber') {
957 $content = $account->number;
958 } elseif ($val ==
'BankAccountNumberKey') {
961 $content = $account->cle_rib;
964 print
'<td>'.$langs->trans($val).
'</td>';
965 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
970 print
'<tr><td class="fieldrequired">'.$langs->trans(
"IBAN").
'</td>';
971 print
'<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.
'"></td></tr>';
973 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BIC").
'</td>';
974 print
'<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.
'"></td></tr>';
976 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
977 print
'<textarea name="domiciliation" rows="4" class="quatrevingtpercent">';
979 print
"</textarea></td></tr>";
981 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
982 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.
'"></td></tr>';
983 print
"</td></tr>\n";
985 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
986 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
988 print
"</textarea></td></tr>";
996 print $form->buttonsSaveCancel(
"Modify");
999if ($id && $action ==
'edit' && $user->hasRight(
'user',
'user',
'creer')) {
1003if ($id && $action ==
'create' && $user->hasRight(
'user',
'user',
'creer')) {
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
checkIbanForAccount(Account $account)
Check IBAN number informations for a bank account.
checkBanForAccount($account)
Check account number informations for a bank account.
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
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=0, $outputlangs='', $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, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_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.