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;
83 $canadduser = (!empty($user->admin) || $user->rights->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) || !empty($user->rights->user->creer));
90 if ($user->id == $id) {
93 if (!empty($user->rights->salaries->read)) {
96 if (!empty($user->rights->hrm->read)) {
99 if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
111 if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
112 $account->userid = $object->id;
114 $account->bank =
GETPOST(
'bank',
'alpha');
115 $account->label =
GETPOST(
'label',
'alpha');
116 $account->courant =
GETPOST(
'courant',
'alpha');
117 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
118 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
119 $account->number =
GETPOST(
'number',
'alpha');
120 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
121 $account->bic =
GETPOST(
'bic',
'alpha');
122 $account->iban =
GETPOST(
'iban',
'alpha');
123 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
124 $account->proprio =
GETPOST(
'proprio',
'alpha');
125 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
127 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
128 $account->state_id =
GETPOST(
"account_state_id",
'int');
129 $account->country_id =
GETPOST(
"account_country_id",
'int');
131 $result = $account->create($user);
142 if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
143 $account->userid = $object->id;
145 $account->bank =
GETPOST(
'bank',
'alpha');
146 $account->label =
GETPOST(
'label',
'alpha');
147 $account->courant =
GETPOST(
'courant',
'alpha');
148 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
149 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
150 $account->number =
GETPOST(
'number',
'alpha');
151 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
152 $account->bic =
GETPOST(
'bic',
'alpha');
153 $account->iban =
GETPOST(
'iban',
'alpha');
154 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
155 $account->proprio =
GETPOST(
'proprio',
'alpha');
156 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
158 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
159 $account->state_id =
GETPOST(
"account_state_id",
'int');
160 $account->country_id =
GETPOST(
"account_country_id",
'int');
162 $result = $account->update($user);
173 if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
174 $result = $account->delete($user);
179 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.$object->id);
186 if ($action ==
'setbirth' && $canadduser && !$cancel) {
188 $result = $object->update($user);
195 if ($action ==
'setpersonal_email' && $canadduser && !$cancel) {
196 $object->personal_email = (string)
GETPOST(
'personal_email',
'alphanohtml');
197 $result = $object->update($user);
204 if ($action ==
'setpersonal_mobile' && $canadduser && !$cancel) {
205 $object->personal_mobile = (string)
GETPOST(
'personal_mobile',
'alphanohtml');
206 $result = $object->update($user);
213 if ($action ==
'setref_employee' && $canadduser && !$cancel) {
214 $object->ref_employee = (string)
GETPOST(
'ref_employee',
'alphanohtml');
215 $result = $object->update($user);
222 if ($action ==
'setnational_registration_number' && $canadduser && !$cancel) {
223 $object->national_registration_number = (string)
GETPOST(
'national_registration_number',
'alphanohtml');
224 $result = $object->update($user);
230 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
232 if ($action ==
'setdefault_c_exp_tax_cat' && $canadduser) {
233 $object->default_c_exp_tax_cat =
GETPOST(
'default_c_exp_tax_cat',
'int');
234 $result = $object->update($user);
241 if ($action ==
'setdefault_range' && $canadduser) {
242 $object->default_range =
GETPOST(
'default_range',
'int');
243 $result = $object->update($user);
258 $childids = $user->getAllChildIds(1);
260 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
261 $title = $person_name.
" - ".$langs->trans(
'BankAccounts');
267 if ($id && $bankid && $action ==
'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) {
268 if ($conf->use_javascript_ajax) {
270 print
'jQuery(document).ready(function () {
271 jQuery("#type").change(function() {
272 document.formbank.action.value="edit";
273 document.formbank.submit();
275 jQuery("#selectaccount_country_id").change(function() {
276 document.formbank.action.value="edit";
277 document.formbank.submit();
282 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
283 print
'<input type="hidden" name="token" value="'.newToken().
'">';
284 print
'<input type="hidden" name="action" value="update">';
285 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">';
286 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
288 if ($id && $action ==
'create' && $user->rights->user->user->creer) {
289 if ($conf->use_javascript_ajax) {
291 print
'jQuery(document).ready(function () {
292 jQuery("#type").change(function() {
293 document.formbank.action.value="create";
294 document.formbank.submit();
296 jQuery("#selectaccount_country_id").change(function() {
297 document.formbank.action.value="create";
298 document.formbank.submit();
303 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
304 print
'<input type="hidden" name="token" value="'.newToken().
'">';
305 print
'<input type="hidden" name="action" value="add">';
306 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
311 if ($action !=
'edit' && $action !=
'create') {
312 $title = $langs->trans(
"User");
317 if ($user->rights->user->user->lire || $user->admin) {
318 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
321 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
322 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
323 $morehtmlref .=
'</a>';
325 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
327 print
'<div class="fichecenter"><div class="fichehalfleft">';
329 print
'<div class="underbanner clearboth"></div>';
331 print
'<table class="border centpercent tableforfield">';
333 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
334 if (!empty($object->ldap_sid) && $object->statut == 0) {
335 print
'<td class="error">';
336 print $langs->trans(
"LoginAccountDisableInDolibarr");
341 if (property_exists($object,
'admin')) {
342 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
343 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
344 } elseif (!empty($object->admin)) {
345 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
355 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
357 if (empty($object->fk_user)) {
358 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
360 $huser =
new User($db);
361 if ($object->fk_user > 0) {
362 $huser->fetch($object->fk_user);
363 print $huser->getNomUrl(1);
365 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
374 $text = $langs->trans(
"ForceUserExpenseValidator");
375 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
378 if (!empty($object->fk_user_expense_validator)) {
379 $evuser =
new User($db);
380 $evuser->fetch($object->fk_user_expense_validator);
381 print $evuser->getNomUrl(1);
390 $text = $langs->trans(
"ForceUserHolidayValidator");
391 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
394 if (!empty($object->fk_user_holiday_validator)) {
395 $hvuser =
new User($db);
396 $hvuser->fetch($object->fk_user_holiday_validator);
397 print $hvuser->getNomUrl(1);
404 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
405 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
409 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
416 if ((empty($user->socid) && in_array($id, $childids))
417 || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
418 || (
isModEnabled(
'hrm') && !empty($user->rights->hrm->employee->read))) {
419 $langs->load(
"salaries");
422 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
424 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
430 $text = $langs->trans(
"THM");
431 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
434 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
440 $text = $langs->trans(
"TJM");
441 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
444 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
450 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
452 if ($object->dateemployment) {
453 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
456 if ($object->dateemploymentend) {
457 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
464 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
467 print
$form->editfieldkey(
"DateOfBirth",
'birth', $object->birth, $object, $user->rights->user->user->creer);
469 print
$form->editfieldval(
"DateOfBirth",
'birth', $object->birth, $object, $user->rights->user->user->creer,
'day', $object->birth);
475 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
476 print
'<tr class="nowrap">';
478 print
$form->editfieldkey(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
480 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');
486 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
487 print
'<tr class="nowrap">';
489 print
$form->editfieldkey(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
491 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');
496 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
497 print
'<tr class="nowrap">';
499 print
$form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->rights->user->user->creer);
501 if ($action ==
'editdefault_c_exp_tax_cat') {
502 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
503 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
504 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
505 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
506 $ret .=
$form->selectExpenseCategories($object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
507 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
508 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
512 $label_exp_tax_cat =
dol_getIdFromCode($db, $object->default_c_exp_tax_cat,
'c_exp_tax_cat',
'rowid',
'label');
513 print $langs->trans($label_exp_tax_cat);
519 print
'<tr class="nowrap">';
521 print
$form->editfieldkey(
"DefaultRangeNumber",
'default_range', $object->default_range, $object, $user->rights->user->user->creer);
523 if ($action ==
'editdefault_range') {
524 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
525 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
526 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
527 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
530 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
532 $ret .=
$form->selectarray(
'default_range', range(0, $maxRangeNum), $object->default_range);
533 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
534 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
538 print $object->default_range;
546 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
547 print
'<td>'.$object->accountancy_code.
'</td></tr>';
551 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
552 print
'<tr class="nowrap">';
554 print
$form->editfieldkey(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
556 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);
562 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
563 print
'<tr class="nowrap">';
565 print
$form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
567 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);
574 print
'</div><div class="fichehalfright">';
577 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
580 if (!empty($conf->salaries->enabled) &&
581 (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
584 $salary =
new Salary($db);
586 $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";
587 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
588 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
589 $sql .=
" WHERE s.fk_user = ".((int) $object->id);
590 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
591 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
592 $sql .=
" ORDER BY s.dateep DESC";
594 $resql = $db->query($sql);
596 $num = $db->num_rows(
$resql);
598 print
'<div class="div-table-responsive-no-min">';
599 print
'<table class="noborder centpercent">';
601 print
'<tr class="liste_titre">';
602 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>';
603 print
'</tr></table></td>';
607 while ($i < $num && $i < $MAXLIST) {
608 $objp = $db->fetch_object(
$resql);
610 $salary->id = $objp->sid;
611 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
612 $salary->label = $objp->label;
613 $salary->datesp = $db->jdate($objp->datesp);
614 $salary->dateep = $db->jdate($objp->dateep);
615 $salary->paye = $objp->paye;
616 $salary->amount = $objp->amount;
618 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
619 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
620 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep :
"");
622 print
'<tr class="oddeven">';
623 print
'<td class="nowraponall">';
624 print $salary->getNomUrl(1);
626 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp),
'day').
"</td>\n";
627 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep),
'day').
"</td>\n";
628 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
629 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
636 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
646 if (
isModEnabled(
'holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
649 $sql =
"SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
650 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
651 $sql .=
" WHERE h.fk_user = ".((int) $object->id);
652 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
653 $sql .=
" ORDER BY h.date_debut DESC";
655 $resql = $db->query($sql);
657 $num = $db->num_rows(
$resql);
659 print
'<div class="div-table-responsive-no-min">';
660 print
'<table class="noborder centpercent">';
662 print
'<tr class="liste_titre">';
663 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>';
664 print
'</tr></table></td>';
668 while ($i < $num && $i < $MAXLIST) {
669 $objp = $db->fetch_object(
$resql);
671 $holiday->id = $objp->rowid;
672 $holiday->ref = $objp->rowid;
674 $holiday->fk_type = $objp->fk_type;
675 $holiday->statut = $objp->status;
676 $holiday->status = $objp->status;
678 $nbopenedday =
num_open_day($db->jdate($objp->date_debut,
'gmt'), $db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday);
680 print
'<tr class="oddeven">';
681 print
'<td class="nowraponall">';
682 print $holiday->getNomUrl(1);
683 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
684 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
685 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
692 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
703 ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
707 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
708 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
709 $sql .=
" WHERE e.fk_user_author = ".((int) $object->id);
710 $sql .=
" AND e.entity = ".((int) $conf->entity);
711 $sql .=
" ORDER BY e.date_debut DESC";
713 $resql = $db->query($sql);
715 $num = $db->num_rows(
$resql);
717 print
'<div class="div-table-responsive-no-min">';
718 print
'<table class="noborder centpercent">';
720 print
'<tr class="liste_titre">';
721 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>';
722 print
'</tr></table></td>';
726 while ($i < $num && $i < $MAXLIST) {
727 $objp = $db->fetch_object(
$resql);
729 $exp->id = $objp->rowid;
730 $exp->ref = $objp->ref;
731 $exp->status = $objp->status;
733 print
'<tr class="oddeven">';
734 print
'<td class="nowraponall">';
735 print $exp->getNomUrl(1);
736 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
737 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
738 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
745 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
754 print
'</div></div>';
755 print
'<div style="clear:both"></div>';
762 if ($account->id == 0) {
763 if ($permissiontoaddbankaccount) {
764 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=create');
766 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
769 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
772 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
774 print
'<div class="div-table-responsive-no-min">';
775 print
'<table class="liste centpercent">';
777 print
'<tr class="liste_titre">';
787 if ($account->id > 0) {
788 print
'<tr class="oddeven">';
790 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
792 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
796 foreach ($account->getFieldsToShow() as $val) {
797 if ($val ==
'BankCode') {
799 } elseif ($val ==
'BankAccountNumber') {
801 } elseif ($val ==
'DeskCode') {
803 } elseif ($val ==
'BankAccountNumberKey') {
807 if (!empty($account->label) && $account->number) {
809 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
811 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
815 print $stringescaped;
818 print
'<td>'.getIbanHumanReadable($account);
819 if (!empty($account->iban)) {
821 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
828 if (!empty($account->bic)) {
830 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
836 print
'<td>'.$account->currency_code.
'</td>';
839 print
'<td class="right nowraponall">';
840 if ($permissiontoaddbankaccount) {
841 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=edit&token='.
newToken().
'">';
842 print
img_picto($langs->trans(
"Modify"),
'edit');
845 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.
newToken().
'">';
846 print
img_picto($langs->trans(
"Delete"),
'delete');
855 if ($account->id == 0) {
857 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
865 if ($id && ($action ==
'edit' || $action ==
'create') && $user->rights->user->user->creer) {
866 $title = $langs->trans(
"User");
869 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
871 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
875 print
'<div class="underbanner clearboth"></div>';
876 print
'<table class="border centpercent">';
878 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"LabelRIB").
'</td>';
879 print
'<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.
'"></td></tr>';
881 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankName").
'</td>';
882 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
885 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
886 print
'<input type="hidden" value="'.$account->currency_code.
'">';
888 print
'<td class="maxwidth200onsmartphone">';
889 $selectedcode = $account->currency_code;
890 if (!$selectedcode) {
891 $selectedcode = $conf->currency;
893 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
894 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
898 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
899 $selectedcode = $account->country_code;
901 $selectedcode =
GETPOST(
"account_country_id");
902 } elseif (empty($selectedcode)) {
903 $selectedcode = $mysoc->country_code;
905 $account->country_code =
getCountry($selectedcode, 2);
907 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
908 print
'<td class="maxwidth200onsmartphone">';
909 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
911 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
916 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
918 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
919 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
921 print $countrynotdefined;
926 foreach ($account->getFieldsToShow() as $val) {
927 if ($val ==
'BankCode') {
928 $name =
'code_banque';
930 $content = $account->code_banque;
931 } elseif ($val ==
'DeskCode') {
932 $name =
'code_guichet';
934 $content = $account->code_guichet;
935 } elseif ($val ==
'BankAccountNumber') {
938 $content = $account->number;
939 } elseif ($val ==
'BankAccountNumberKey') {
942 $content = $account->cle_rib;
945 print
'<td>'.$langs->trans($val).
'</td>';
946 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
951 print
'<tr><td class="fieldrequired">'.$langs->trans(
"IBAN").
'</td>';
952 print
'<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.
'"></td></tr>';
954 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BIC").
'</td>';
955 print
'<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.
'"></td></tr>';
957 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
958 print
'<textarea name="domiciliation" rows="4" class="quatrevingtpercent">';
960 print
"</textarea></td></tr>";
962 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
963 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.
'"></td></tr>';
964 print
"</td></tr>\n";
966 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
967 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
969 print
"</textarea></td></tr>";
977 print
$form->buttonsSaveCancel(
"Modify");
980 if ($id && $action ==
'edit' && $user->rights->user->user->creer) {
984 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.