32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/user/class/userbankaccount.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
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');
61 if ($user->socid > 0) {
62 $socid = $user->socid;
64 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
66 $object =
new User($db);
67 if ($id > 0 || !empty($ref)) {
68 $result = $object->fetch($id, $ref,
'', 1);
74 $account->fetch(0,
'', $id);
76 $account->fetch($bankid);
78 if (empty($account->userid)) {
79 $account->userid = $object->id;
84 $canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
85 $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
86 $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer));
91 if ($user->id == $id) {
94 if (!empty($user->rights->salaries->read)) {
97 if (!empty($user->rights->hrm->read)) {
100 if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
112 if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
113 $account->userid = $object->id;
115 $account->bank =
GETPOST(
'bank',
'alpha');
116 $account->label =
GETPOST(
'label',
'alpha');
117 $account->courant =
GETPOST(
'courant',
'alpha');
118 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
119 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
120 $account->number =
GETPOST(
'number',
'alpha');
121 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
122 $account->bic =
GETPOST(
'bic',
'alpha');
123 $account->iban =
GETPOST(
'iban',
'alpha');
124 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
125 $account->proprio =
GETPOST(
'proprio',
'alpha');
126 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
128 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
129 $account->state_id =
GETPOST(
"account_state_id",
'int');
130 $account->country_id =
GETPOST(
"account_country_id",
'int');
132 $result = $account->create($user);
143 if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
144 $account->userid = $object->id;
189 $account->bank =
GETPOST(
'bank',
'alpha');
190 $account->label =
GETPOST(
'label',
'alpha');
191 $account->courant =
GETPOST(
'courant',
'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->domiciliation =
GETPOST(
'domiciliation',
'alpha');
199 $account->proprio =
GETPOST(
'proprio',
'alpha');
200 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
202 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
203 $account->state_id =
GETPOST(
"account_state_id",
'int');
204 $account->country_id =
GETPOST(
"account_country_id",
'int');
206 $result = $account->update($user);
218 if ($action ==
'setbirth' && $canadduser && !$cancel) {
220 $result = $object->update($user);
227 if ($action ==
'setpersonal_email' && $canadduser && !$cancel) {
228 $object->personal_email = (string)
GETPOST(
'personal_email',
'alphanohtml');
229 $result = $object->update($user);
236 if ($action ==
'setpersonal_mobile' && $canadduser && !$cancel) {
237 $object->personal_mobile = (string)
GETPOST(
'personal_mobile',
'alphanohtml');
238 $result = $object->update($user);
245 if ($action ==
'setref_employee' && $canadduser && !$cancel) {
246 $object->ref_employee = (string)
GETPOST(
'ref_employee',
'alphanohtml');
247 $result = $object->update($user);
254 if ($action ==
'setnational_registration_number' && $canadduser && !$cancel) {
255 $object->national_registration_number = (string)
GETPOST(
'national_registration_number',
'alphanohtml');
256 $result = $object->update($user);
262 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
264 if ($action ==
'setdefault_c_exp_tax_cat' && $canadduser) {
265 $object->default_c_exp_tax_cat =
GETPOST(
'default_c_exp_tax_cat',
'int');
266 $result = $object->update($user);
273 if ($action ==
'setdefault_range' && $canadduser) {
274 $object->default_range =
GETPOST(
'default_range',
'int');
275 $result = $object->update($user);
290 $childids = $user->getAllChildIds(1);
292 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
293 $title = $person_name.
" - ".$langs->trans(
'BankAccounts');
299 if ($id && $bankid && $action ==
'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) {
300 if ($conf->use_javascript_ajax) {
302 print
'jQuery(document).ready(function () {
303 jQuery("#type").change(function() {
304 document.formbank.action.value="edit";
305 document.formbank.submit();
307 jQuery("#selectaccount_country_id").change(function() {
308 document.formbank.action.value="edit";
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="update">';
317 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">';
318 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
320 if ($id && $action ==
'create' && $user->rights->user->user->creer) {
321 if ($conf->use_javascript_ajax) {
323 print
'jQuery(document).ready(function () {
324 jQuery("#type").change(function() {
325 document.formbank.action.value="create";
326 document.formbank.submit();
328 jQuery("#selectaccount_country_id").change(function() {
329 document.formbank.action.value="create";
330 document.formbank.submit();
335 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
336 print
'<input type="hidden" name="token" value="'.newToken().
'">';
337 print
'<input type="hidden" name="action" value="add">';
338 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
343 if ($action !=
'edit' && $action !=
'create') {
344 $title = $langs->trans(
"User");
349 if ($user->rights->user->user->lire || $user->admin) {
350 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
353 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
354 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
355 $morehtmlref .=
'</a>';
357 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
359 print
'<div class="fichecenter"><div class="fichehalfleft">';
361 print
'<div class="underbanner clearboth"></div>';
363 print
'<table class="border centpercent tableforfield">';
365 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
366 if (!empty($object->ldap_sid) && $object->statut == 0) {
367 print
'<td class="error">';
368 print $langs->trans(
"LoginAccountDisableInDolibarr");
373 if (property_exists($object,
'admin')) {
374 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
375 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
376 } elseif (!empty($object->admin)) {
377 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
387 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
389 if (empty($object->fk_user)) {
390 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
392 $huser =
new User($db);
393 if ($object->fk_user > 0) {
394 $huser->fetch($object->fk_user);
395 print $huser->getNomUrl(1);
397 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
406 $text = $langs->trans(
"ForceUserExpenseValidator");
407 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
410 if (!empty($object->fk_user_expense_validator)) {
411 $evuser =
new User($db);
412 $evuser->fetch($object->fk_user_expense_validator);
413 print $evuser->getNomUrl(1);
422 $text = $langs->trans(
"ForceUserHolidayValidator");
423 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
426 if (!empty($object->fk_user_holiday_validator)) {
427 $hvuser =
new User($db);
428 $hvuser->fetch($object->fk_user_holiday_validator);
429 print $hvuser->getNomUrl(1);
436 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
437 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
441 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
448 if ((empty($user->socid) && in_array($id, $childids))
449 || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
450 || (
isModEnabled(
'hrm') && !empty($user->rights->hrm->employee->read))) {
451 $langs->load(
"salaries");
454 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
456 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
462 $text = $langs->trans(
"THM");
463 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
466 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
472 $text = $langs->trans(
"TJM");
473 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
476 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
482 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
484 if ($object->dateemployment) {
485 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
488 if ($object->dateemploymentend) {
489 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
496 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
499 print
$form->editfieldkey(
"DateOfBirth",
'birth', $object->birth, $object, $user->rights->user->user->creer);
501 print
$form->editfieldval(
"DateOfBirth",
'birth', $object->birth, $object, $user->rights->user->user->creer,
'day', $object->birth);
507 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
508 print
'<tr class="nowrap">';
510 print
$form->editfieldkey(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
512 print
$form->editfieldval(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write,
'email',
'',
null,
null,
'', 0,
'dol_print_email');
518 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
519 print
'<tr class="nowrap">';
521 print
$form->editfieldkey(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
523 print
$form->editfieldval(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write,
'string',
'',
null,
null,
'', 0,
'dol_print_phone');
528 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
529 print
'<tr class="nowrap">';
531 print
$form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->rights->user->user->creer);
533 if ($action ==
'editdefault_c_exp_tax_cat') {
534 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
535 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
536 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
537 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
538 $ret .=
$form->selectExpenseCategories($object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
539 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
540 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
544 $label_exp_tax_cat =
dol_getIdFromCode($db, $object->default_c_exp_tax_cat,
'c_exp_tax_cat',
'rowid',
'label');
545 print $langs->trans($label_exp_tax_cat);
551 print
'<tr class="nowrap">';
553 print
$form->editfieldkey(
"DefaultRangeNumber",
'default_range', $object->default_range, $object, $user->rights->user->user->creer);
555 if ($action ==
'editdefault_range') {
556 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
557 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
558 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
559 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
562 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
564 $ret .=
$form->selectarray(
'default_range', range(0, $maxRangeNum), $object->default_range);
565 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
566 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
570 print $object->default_range;
578 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
579 print
'<td>'.$object->accountancy_code.
'</td></tr>';
583 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
584 print
'<tr class="nowrap">';
586 print
$form->editfieldkey(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
588 print
$form->editfieldval(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write,
'string', $object->ref_employee);
594 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
595 print
'<tr class="nowrap">';
597 print
$form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
599 print
$form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write,
'string', $object->national_registration_number);
606 print
'</div><div class="fichehalfright">';
609 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
612 if (!empty($conf->salaries->enabled) &&
613 (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
616 $salary =
new Salary($db);
618 $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";
619 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
620 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
621 $sql .=
" WHERE s.fk_user = ".((int) $object->id);
622 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
623 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
624 $sql .=
" ORDER BY s.dateep DESC";
626 $resql = $db->query($sql);
628 $num = $db->num_rows(
$resql);
630 print
'<div class="div-table-responsive-no-min">';
631 print
'<table class="noborder centpercent">';
633 print
'<tr class="liste_titre">';
634 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>';
635 print
'</tr></table></td>';
639 while ($i < $num && $i < $MAXLIST) {
640 $objp = $db->fetch_object(
$resql);
642 $salary->id = $objp->sid;
643 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
644 $salary->label = $objp->label;
645 $salary->datesp = $db->jdate($objp->datesp);
646 $salary->dateep = $db->jdate($objp->dateep);
647 $salary->paye = $objp->paye;
648 $salary->amount = $objp->amount;
650 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
651 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
652 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep :
"");
654 print
'<tr class="oddeven">';
655 print
'<td class="nowraponall">';
656 print $salary->getNomUrl(1);
658 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp),
'day').
"</td>\n";
659 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep),
'day').
"</td>\n";
660 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
661 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
668 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
678 if (
isModEnabled(
'holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
681 $sql =
"SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
682 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
683 $sql .=
" WHERE h.fk_user = ".((int) $object->id);
684 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
685 $sql .=
" ORDER BY h.date_debut DESC";
687 $resql = $db->query($sql);
689 $num = $db->num_rows(
$resql);
691 print
'<div class="div-table-responsive-no-min">';
692 print
'<table class="noborder centpercent">';
694 print
'<tr class="liste_titre">';
695 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>';
696 print
'</tr></table></td>';
700 while ($i < $num && $i < $MAXLIST) {
701 $objp = $db->fetch_object(
$resql);
703 $holiday->id = $objp->rowid;
704 $holiday->ref = $objp->rowid;
706 $holiday->fk_type = $objp->fk_type;
707 $holiday->statut = $objp->status;
708 $holiday->status = $objp->status;
710 $nbopenedday =
num_open_day($db->jdate($objp->date_debut,
'gmt'), $db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday);
712 print
'<tr class="oddeven">';
713 print
'<td class="nowraponall">';
714 print $holiday->getNomUrl(1);
715 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
716 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
717 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
724 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
735 ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
739 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
740 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
741 $sql .=
" WHERE e.fk_user_author = ".((int) $object->id);
742 $sql .=
" AND e.entity = ".((int) $conf->entity);
743 $sql .=
" ORDER BY e.date_debut DESC";
745 $resql = $db->query($sql);
747 $num = $db->num_rows(
$resql);
749 print
'<div class="div-table-responsive-no-min">';
750 print
'<table class="noborder centpercent">';
752 print
'<tr class="liste_titre">';
753 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>';
754 print
'</tr></table></td>';
758 while ($i < $num && $i < $MAXLIST) {
759 $objp = $db->fetch_object(
$resql);
761 $exp->id = $objp->rowid;
762 $exp->ref = $objp->ref;
763 $exp->status = $objp->status;
765 print
'<tr class="oddeven">';
766 print
'<td class="nowraponall">';
767 print $exp->getNomUrl(1);
768 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
769 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
770 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
777 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
786 print
'</div></div>';
787 print
'<div style="clear:both"></div>';
794 if ($account->id == 0) {
795 if ($permissiontoaddbankaccount) {
796 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=create');
798 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
801 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
804 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
806 print
'<div class="div-table-responsive-no-min">';
807 print
'<table class="liste centpercent">';
809 print
'<tr class="liste_titre">';
819 if ($account->id > 0) {
820 print
'<tr class="oddeven">';
822 print
'<td>'.$account->label.
'</td>';
824 print
'<td>'.$account->bank.
'</td>';
828 foreach ($account->getFieldsToShow() as $val) {
829 if ($val ==
'BankCode') {
830 $string .= $account->code_banque.
' ';
831 } elseif ($val ==
'BankAccountNumber') {
832 $string .= $account->number.
' ';
833 } elseif ($val ==
'DeskCode') {
834 $string .= $account->code_guichet.
' ';
835 } elseif ($val ==
'BankAccountNumberKey') {
836 $string .= $account->cle_rib.
' ';
839 if (!empty($account->label) && $account->number) {
841 $string .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
843 $string .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
850 print
'<td>'.getIbanHumanReadable($account);
851 if (!empty($account->iban)) {
853 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
858 print
'<td>'.$account->bic;
859 if (!empty($account->bic)) {
861 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
867 print
'<td>'.$account->currency_code.
'</td>';
870 print
'<td class="right nowraponall">';
871 if ($permissiontoaddbankaccount) {
872 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=edit&token='.
newToken().
'">';
873 print
img_picto($langs->trans(
"Modify"),
'edit');
882 if ($account->id == 0) {
884 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
892 if ($id && ($action ==
'edit' || $action ==
'create') && $user->rights->user->user->creer) {
893 $title = $langs->trans(
"User");
896 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
898 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
902 print
'<div class="underbanner clearboth"></div>';
903 print
'<table class="border centpercent">';
905 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"LabelRIB").
'</td>';
906 print
'<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.
'"></td></tr>';
908 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankName").
'</td>';
909 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
912 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
913 print
'<input type="hidden" value="'.$account->currency_code.
'">';
915 print
'<td class="maxwidth200onsmartphone">';
916 $selectedcode = $account->currency_code;
917 if (!$selectedcode) {
918 $selectedcode = $conf->currency;
920 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
921 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
925 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
926 $selectedcode = $account->country_code;
928 $selectedcode =
GETPOST(
"account_country_id");
929 } elseif (empty($selectedcode)) {
930 $selectedcode = $mysoc->country_code;
932 $account->country_code =
getCountry($selectedcode, 2);
934 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
935 print
'<td class="maxwidth200onsmartphone">';
936 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
938 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
943 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
945 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
946 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
948 print $countrynotdefined;
953 foreach ($account->getFieldsToShow() as $val) {
954 if ($val ==
'BankCode') {
955 $name =
'code_banque';
957 $content = $account->code_banque;
958 } elseif ($val ==
'DeskCode') {
959 $name =
'code_guichet';
961 $content = $account->code_guichet;
962 } elseif ($val ==
'BankAccountNumber') {
965 $content = $account->number;
966 } elseif ($val ==
'BankAccountNumberKey') {
969 $content = $account->cle_rib;
972 print
'<td>'.$langs->trans($val).
'</td>';
973 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
978 print
'<tr><td class="fieldrequired">'.$langs->trans(
"IBAN").
'</td>';
979 print
'<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.
'"></td></tr>';
981 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BIC").
'</td>';
982 print
'<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.
'"></td></tr>';
984 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
985 print
'<textarea name="domiciliation" rows="4" class="quatrevingtpercent">';
987 print
"</textarea></td></tr>";
989 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
990 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.
'"></td></tr>';
991 print
"</td></tr>\n";
993 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
994 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
996 print
"</textarea></td></tr>";
1004 print
$form->buttonsSaveCancel(
"Modify");
1007 if ($id && $action ==
'edit' && $user->rights->user->user->creer) {
1011 if ($id && $action ==
'create' && $user->rights->user->user->creer) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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.