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');
60 $hookmanager->initHooks(array(
'usercardBank',
'globalcard'));
64 if ($user->socid > 0) {
65 $socid = $user->socid;
67 $feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
69 $object =
new User($db);
70 if ($id > 0 || !empty($ref)) {
71 $result = $object->fetch($id, $ref,
'', 1);
77 $account->fetch(0,
'', $id);
79 $account->fetch($bankid);
81 if (empty($account->userid)) {
82 $account->userid = $object->id;
86 $canadduser = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
87 $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
88 $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || $user->hasRight(
'user',
'creer'));
89 $permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
90 $permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
95 if ($user->id == $id) {
98 if (!empty($user->rights->salaries->read)) {
101 if (!empty($user->rights->hrm->read)) {
104 if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
116 if ($action ==
'add' && !$cancel && $permissiontoaddbankaccount) {
117 $account->userid = $object->id;
119 $account->bank =
GETPOST(
'bank',
'alpha');
120 $account->label =
GETPOST(
'label',
'alpha');
121 $account->courant =
GETPOST(
'courant',
'alpha');
122 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
123 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
124 $account->number =
GETPOST(
'number',
'alpha');
125 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
126 $account->bic =
GETPOST(
'bic',
'alpha');
127 $account->iban =
GETPOST(
'iban',
'alpha');
128 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
129 $account->proprio =
GETPOST(
'proprio',
'alpha');
130 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
132 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
133 $account->state_id =
GETPOST(
"account_state_id",
'int');
134 $account->country_id =
GETPOST(
"account_country_id",
'int');
136 $result = $account->create($user);
147 if ($action ==
'update' && !$cancel && $permissiontoaddbankaccount) {
148 $account->userid = $object->id;
150 $account->bank =
GETPOST(
'bank',
'alpha');
151 $account->label =
GETPOST(
'label',
'alpha');
152 $account->courant =
GETPOST(
'courant',
'alpha');
153 $account->code_banque =
GETPOST(
'code_banque',
'alpha');
154 $account->code_guichet =
GETPOST(
'code_guichet',
'alpha');
155 $account->number =
GETPOST(
'number',
'alpha');
156 $account->cle_rib =
GETPOST(
'cle_rib',
'alpha');
157 $account->bic =
GETPOST(
'bic',
'alpha');
158 $account->iban =
GETPOST(
'iban',
'alpha');
159 $account->domiciliation =
GETPOST(
'domiciliation',
'alpha');
160 $account->proprio =
GETPOST(
'proprio',
'alpha');
161 $account->owner_address =
GETPOST(
'owner_address',
'alpha');
163 $account->currency_code = trim(
GETPOST(
"account_currency_code"));
164 $account->state_id =
GETPOST(
"account_state_id",
'int');
165 $account->country_id =
GETPOST(
"account_country_id",
'int');
167 $result = $account->update($user);
178 if ($action ==
'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
179 $result = $account->delete($user);
184 header(
"Location: ".DOL_URL_ROOT.
'/user/bank.php?id='.$object->id);
191 if ($action ==
'setbirth' && $canadduser && !$cancel) {
193 $result = $object->update($user);
200 if ($action ==
'setpersonal_email' && $canadduser && !$cancel) {
201 $object->personal_email = (string)
GETPOST(
'personal_email',
'alphanohtml');
202 $result = $object->update($user);
209 if ($action ==
'setpersonal_mobile' && $canadduser && !$cancel) {
210 $object->personal_mobile = (string)
GETPOST(
'personal_mobile',
'alphanohtml');
211 $result = $object->update($user);
218 if ($action ==
'setaccountancy_code' && $canadduser && !$cancel) {
219 $object->accountancy_code = (string)
GETPOST(
'accountancy_code',
'alphanohtml');
220 $result = $object->update($user);
227 if ($action ==
'setref_employee' && $canadduser && !$cancel) {
228 $object->ref_employee = (string)
GETPOST(
'ref_employee',
'alphanohtml');
229 $result = $object->update($user);
236 if ($action ==
'setnational_registration_number' && $canadduser && !$cancel) {
237 $object->national_registration_number = (string)
GETPOST(
'national_registration_number',
'alphanohtml');
238 $result = $object->update($user);
244 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
246 if ($action ==
'setdefault_c_exp_tax_cat' && $canadduser) {
247 $object->default_c_exp_tax_cat =
GETPOST(
'default_c_exp_tax_cat',
'int');
248 $result = $object->update($user);
255 if ($action ==
'setdefault_range' && $canadduser) {
256 $object->default_range =
GETPOST(
'default_range',
'int');
257 $result = $object->update($user);
272 $childids = $user->getAllChildIds(1);
274 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
275 $title = $person_name.
" - ".$langs->trans(
'BankAccounts');
281 if ($id && $bankid && $action ==
'edit' && ($user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write)) {
282 if ($conf->use_javascript_ajax) {
284 print
'jQuery(document).ready(function () {
285 jQuery("#type").change(function() {
286 document.formbank.action.value="edit";
287 document.formbank.submit();
289 jQuery("#selectaccount_country_id").change(function() {
290 document.formbank.action.value="edit";
291 document.formbank.submit();
296 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
297 print
'<input type="hidden" name="token" value="'.newToken().
'">';
298 print
'<input type="hidden" name="action" value="update">';
299 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">';
300 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
302 if ($id && $action ==
'create' && $user->hasRight(
'user',
'user',
'creer')) {
303 if ($conf->use_javascript_ajax) {
305 print
'jQuery(document).ready(function () {
306 jQuery("#type").change(function() {
307 document.formbank.action.value="create";
308 document.formbank.submit();
310 jQuery("#selectaccount_country_id").change(function() {
311 document.formbank.action.value="create";
312 document.formbank.submit();
317 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" name="formbank" method="post">';
318 print
'<input type="hidden" name="token" value="'.newToken().
'">';
319 print
'<input type="hidden" name="action" value="add">';
320 print
'<input type="hidden" name="bankid" value="'.$bankid.
'">';
325 if ($action !=
'edit' && $action !=
'create') {
326 $title = $langs->trans(
"User");
331 if ($user->rights->user->user->lire || $user->admin) {
332 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
335 $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">';
336 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
337 $morehtmlref .=
'</a>';
339 $urltovirtualcard =
'/user/virtualcard.php?id='.((int) $object->id);
340 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->trans(
"PublicVirtualCardUrl").
' - '.$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
342 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
344 print
'<div class="fichecenter"><div class="fichehalfleft">';
346 print
'<div class="underbanner clearboth"></div>';
348 print
'<table class="border centpercent tableforfield">';
350 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
351 if (!empty($object->ldap_sid) && $object->statut == 0) {
352 print
'<td class="error">';
353 print $langs->trans(
"LoginAccountDisableInDolibarr");
358 if (property_exists($object,
'admin')) {
359 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
360 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
361 } elseif (!empty($object->admin)) {
362 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
372 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
374 if (empty($object->fk_user)) {
375 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
377 $huser =
new User($db);
378 if ($object->fk_user > 0) {
379 $huser->fetch($object->fk_user);
380 print $huser->getNomUrl(1);
382 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
391 $text = $langs->trans(
"ForceUserExpenseValidator");
392 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
395 if (!empty($object->fk_user_expense_validator)) {
396 $evuser =
new User($db);
397 $evuser->fetch($object->fk_user_expense_validator);
398 print $evuser->getNomUrl(1);
407 $text = $langs->trans(
"ForceUserHolidayValidator");
408 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
411 if (!empty($object->fk_user_holiday_validator)) {
412 $hvuser =
new User($db);
413 $hvuser->fetch($object->fk_user_holiday_validator);
414 print $hvuser->getNomUrl(1);
421 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
422 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
426 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
433 if ((empty($user->socid) && in_array($id, $childids))
434 || (
isModEnabled(
'salaries') && !empty($user->rights->salaries->readall))
435 || (
isModEnabled(
'hrm') && !empty($user->rights->hrm->employee->read))) {
436 $langs->load(
"salaries");
439 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
441 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
447 $text = $langs->trans(
"THM");
448 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
451 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
457 $text = $langs->trans(
"TJM");
458 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
461 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
467 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
469 if ($object->dateemployment) {
470 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
473 if ($object->dateemploymentend) {
474 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
481 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
484 print
$form->editfieldkey(
"DateOfBirth",
'birth', $object->birth, $object, $user->hasRight(
'user',
'user',
'creer'));
486 print
$form->editfieldval(
"DateOfBirth",
'birth', $object->birth, $object, $user->hasRight(
'user',
'user',
'creer'),
'day', $object->birth);
492 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
493 print
'<tr class="nowrap">';
495 print
$form->editfieldkey(
"UserPersonalEmail",
'personal_email', $object->personal_email, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
497 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,
'');
503 if ($user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write')) {
504 print
'<tr class="nowrap">';
506 print
$form->editfieldkey(
"UserPersonalMobile",
'personal_mobile', $object->personal_mobile, $object, $user->hasRight(
'user',
'user',
'creer') || $user->rights->hrm->write_personal_information->write);
508 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,
'');
513 if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
514 print
'<tr class="nowrap">';
516 print
$form->editfieldkey(
"DefaultCategoryCar",
'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight(
'user',
'user',
'creer'));
518 if ($action ==
'editdefault_c_exp_tax_cat') {
519 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
520 $ret .=
'<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
521 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
522 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
523 $ret .=
$form->selectExpenseCategories($object->default_c_exp_tax_cat,
'default_c_exp_tax_cat', 1);
524 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
525 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
529 $label_exp_tax_cat =
dol_getIdFromCode($db, $object->default_c_exp_tax_cat,
'c_exp_tax_cat',
'rowid',
'label');
530 print $langs->trans($label_exp_tax_cat);
536 print
'<tr class="nowrap">';
538 print
$form->editfieldkey(
"DefaultRangeNumber",
'default_range', $object->default_range, $object, $user->hasRight(
'user',
'user',
'creer'));
540 if ($action ==
'editdefault_range') {
541 $ret =
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].($moreparam ?
'?'.$moreparam :
'').
'">';
542 $ret .=
'<input type="hidden" name="action" value="setdefault_range">';
543 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
544 $ret .=
'<input type="hidden" name="id" value="'.$object->id.
'">';
547 $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
549 $ret .=
$form->selectarray(
'default_range', range(0, $maxRangeNum), $object->default_range);
550 $ret .=
'<input type="submit" class="button" name="modify" value="'.$langs->trans(
"Modify").
'"> ';
551 $ret .=
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
555 print $object->default_range;
563 print
'<tr class="nowrap">';
565 print
$form->editfieldkey(
"AccountancyCode",
'accountancy_code', $object->accountancy_code, $object, $user->hasRight(
'user',
'user',
'creer'));
567 print
$form->editfieldval(
"AccountancyCode",
'accountancy_code', $object->accountancy_code, $object, $user->hasRight(
'user',
'user',
'creer'),
'string',
'',
null,
null,
'', 0,
'');
573 if ($permissiontoreadhr) {
574 print
'<tr class="nowrap">';
576 print
$form->editfieldkey(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $permissiontowritehr);
578 print
$form->editfieldval(
"RefEmployee",
'ref_employee', $object->ref_employee, $object, $permissiontowritehr,
'string', $object->ref_employee);
584 if ($permissiontoreadhr) {
585 print
'<tr class="nowrap">';
587 print
$form->editfieldkey(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr);
589 print
$form->editfieldval(
"NationalRegistrationNumber",
'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr,
'string', $object->national_registration_number);
596 print
'</div><div class="fichehalfright">';
599 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
603 (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
606 $salary =
new Salary($db);
608 $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";
609 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
610 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (s.rowid = ps.fk_salary)";
611 $sql .=
" WHERE s.fk_user = ".((int) $object->id);
612 $sql .=
" AND s.entity IN (".getEntity(
'salary').
")";
613 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
614 $sql .=
" ORDER BY s.dateep DESC";
616 $resql = $db->query(
$sql);
618 $num = $db->num_rows($resql);
620 print
'<div class="div-table-responsive-no-min">';
621 print
'<table class="noborder centpercent">';
623 print
'<tr class="liste_titre">';
624 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>';
625 print
'</tr></table></td>';
629 while ($i < $num && $i < $MAXLIST) {
630 $objp = $db->fetch_object($resql);
632 $salary->id = $objp->sid;
633 $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
634 $salary->label = $objp->label;
635 $salary->datesp = $db->jdate($objp->datesp);
636 $salary->dateep = $db->jdate($objp->dateep);
637 $salary->paye = $objp->paye;
638 $salary->amount = $objp->amount;
640 $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
641 $payment_salary->ref = !empty($objp->ref) ? $objp->ref :
"";
642 $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep :
"");
644 print
'<tr class="oddeven">';
645 print
'<td class="nowraponall">';
646 print $salary->getNomUrl(1);
648 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp),
'day').
"</td>\n";
649 print
'<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep),
'day').
"</td>\n";
650 print
'<td class="right nowraponall"><span class="amount">'.price($objp->amount).
'</span></td>';
651 print
'<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).
'</td>';
658 print
'<td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
668 if (
isModEnabled(
'holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
671 $sql =
"SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
672 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as h";
673 $sql .=
" WHERE h.fk_user = ".((int) $object->id);
674 $sql .=
" AND h.entity IN (".getEntity(
'holiday').
")";
675 $sql .=
" ORDER BY h.date_debut DESC";
677 $resql = $db->query(
$sql);
679 $num = $db->num_rows($resql);
681 print
'<div class="div-table-responsive-no-min">';
682 print
'<table class="noborder centpercent">';
684 print
'<tr class="liste_titre">';
685 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>';
686 print
'</tr></table></td>';
690 while ($i < $num && $i < $MAXLIST) {
691 $objp = $db->fetch_object($resql);
693 $holiday->id = $objp->rowid;
694 $holiday->ref = $objp->rowid;
696 $holiday->fk_type = $objp->fk_type;
697 $holiday->statut = $objp->status;
698 $holiday->status = $objp->status;
700 $nbopenedday =
num_open_day($db->jdate($objp->date_debut,
'gmt'), $db->jdate($objp->date_fin,
'gmt'), 0, 1, $objp->halfday);
702 print
'<tr class="oddeven">';
703 print
'<td class="nowraponall">';
704 print $holiday->getNomUrl(1);
705 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
706 print
'<td class="right nowraponall">'.$nbopenedday.
' '.$langs->trans(
'DurationDays').
'</td>';
707 print
'<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).
'</td>';
714 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
725 ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
729 $sql =
"SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
730 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as e";
731 $sql .=
" WHERE e.fk_user_author = ".((int) $object->id);
732 $sql .=
" AND e.entity = ".((int) $conf->entity);
733 $sql .=
" ORDER BY e.date_debut DESC";
735 $resql = $db->query(
$sql);
737 $num = $db->num_rows($resql);
739 print
'<div class="div-table-responsive-no-min">';
740 print
'<table class="noborder centpercent">';
742 print
'<tr class="liste_titre">';
743 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>';
744 print
'</tr></table></td>';
748 while ($i < $num && $i < $MAXLIST) {
749 $objp = $db->fetch_object($resql);
751 $exp->id = $objp->rowid;
752 $exp->ref = $objp->ref;
753 $exp->status = $objp->status;
755 print
'<tr class="oddeven">';
756 print
'<td class="nowraponall">';
757 print $exp->getNomUrl(1);
758 print
'</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut),
'day').
"</td>\n";
759 print
'<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).
'</span></td>';
760 print
'<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).
'</td>';
767 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></a>';
776 print
'</div></div>';
777 print
'<div class="clearboth"></div>';
784 if ($account->id == 0) {
785 if ($permissiontoaddbankaccount) {
786 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=create');
788 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'NotEnoughPermissions'),
'fa fa-plus-circle',
'',
'', -2);
791 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'), $langs->trans(
'AlreadyOneBankAccount'),
'fa fa-plus-circle',
'',
'', -2);
794 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank_account');
796 print
'<div class="div-table-responsive-no-min">';
797 print
'<table class="liste centpercent">';
799 print
'<tr class="liste_titre">';
809 if ($account->id > 0) {
810 print
'<tr class="oddeven">';
812 print
'<td>'.dol_escape_htmltag($account->label).
'</td>';
814 print
'<td>'.dol_escape_htmltag($account->bank).
'</td>';
818 foreach ($account->getFieldsToShow() as $val) {
819 if ($val ==
'BankCode') {
821 } elseif ($val ==
'BankAccountNumber') {
823 } elseif ($val ==
'DeskCode') {
825 } elseif ($val ==
'BankAccountNumberKey') {
829 if (!empty($account->label) && $account->number) {
831 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
833 $stringescaped .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
837 print $stringescaped;
840 print
'<td>'.getIbanHumanReadable($account);
841 if (!empty($account->iban)) {
843 print
' '.img_picto($langs->trans(
"IbanNotValid"),
'warning');
850 if (!empty($account->bic)) {
852 print
' '.img_picto($langs->trans(
"SwiftNotValid"),
'warning');
858 print
'<td>'.$account->currency_code.
'</td>';
861 print
'<td class="right nowraponall">';
862 if ($permissiontoaddbankaccount) {
863 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=edit&token='.
newToken().
'">';
864 print
img_picto($langs->trans(
"Modify"),
'edit');
867 print
'<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&bankid='.$account->id.
'&action=delete_confirmed&token='.
newToken().
'">';
868 print
img_picto($langs->trans(
"Delete"),
'delete');
877 if ($account->id == 0) {
879 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
888 $parameters = array(
'colspan' =>
' colspan="2"');
889 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
893 if ($id && ($action ==
'edit' || $action ==
'create') && $user->hasRight(
'user',
'user',
'creer')) {
894 $title = $langs->trans(
"User");
897 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
899 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
903 print
'<div class="underbanner clearboth"></div>';
904 print
'<table class="border centpercent">';
906 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"LabelRIB").
'</td>';
907 print
'<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.
'"></td></tr>';
909 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankName").
'</td>';
910 print
'<td><input size="30" type="text" name="bank" value="'.$account->bank.
'"></td></tr>';
913 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
914 print
'<input type="hidden" value="'.$account->currency_code.
'">';
916 print
'<td class="maxwidth200onsmartphone">';
917 $selectedcode = $account->currency_code;
918 if (!$selectedcode) {
919 $selectedcode = $conf->currency;
921 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
922 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
926 $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
927 $selectedcode = $account->country_code;
929 $selectedcode =
GETPOST(
"account_country_id");
930 } elseif (empty($selectedcode)) {
931 $selectedcode = $mysoc->country_code;
933 $account->country_code =
getCountry($selectedcode, 2);
935 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
936 print
'<td class="maxwidth200onsmartphone">';
937 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
939 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
944 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
946 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
947 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $account->state_id, $selectedcode,
'account_state_id');
949 print $countrynotdefined;
954 foreach ($account->getFieldsToShow() as $val) {
955 if ($val ==
'BankCode') {
956 $name =
'code_banque';
958 $content = $account->code_banque;
959 } elseif ($val ==
'DeskCode') {
960 $name =
'code_guichet';
962 $content = $account->code_guichet;
963 } elseif ($val ==
'BankAccountNumber') {
966 $content = $account->number;
967 } elseif ($val ==
'BankAccountNumberKey') {
970 $content = $account->cle_rib;
973 print
'<td>'.$langs->trans($val).
'</td>';
974 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
979 print
'<tr><td class="fieldrequired">'.$langs->trans(
"IBAN").
'</td>';
980 print
'<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.
'"></td></tr>';
982 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BIC").
'</td>';
983 print
'<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.
'"></td></tr>';
985 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td colspan="4">';
986 print
'<textarea name="domiciliation" rows="4" class="quatrevingtpercent">';
988 print
"</textarea></td></tr>";
990 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
991 print
'<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.
'"></td></tr>';
992 print
"</td></tr>\n";
994 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td colspan="4">';
995 print
'<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
997 print
"</textarea></td></tr>";
1005 print
$form->buttonsSaveCancel(
"Modify");
1008 if ($id && $action ==
'edit' && $user->hasRight(
'user',
'user',
'creer')) {
1012 if ($id && $action ==
'create' && $user->hasRight(
'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') && $user->hasRight('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') && $user->hasRight('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)) $sql
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.
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.
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.
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.
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.
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.