bank.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995
  1. <?php
  2. /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  6. * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
  7. * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
  8. * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
  9. * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/user/bank.php
  26. * \ingroup HRM
  27. * \brief Tab for HR and bank
  28. */
  29. // Load Dolibarr environment
  30. require '../main.inc.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  36. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  37. if (isModEnabled('holiday')) {
  38. require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
  39. }
  40. if (isModEnabled('expensereport')) {
  41. require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
  42. }
  43. if (isModEnabled('salaries')) {
  44. require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
  45. require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
  46. }
  47. // Load translation files required by page
  48. $langs->loadLangs(array('companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries'));
  49. $id = GETPOST('id', 'int');
  50. $ref = GETPOST('ref', 'alphanohtml');
  51. $bankid = GETPOST('bankid', 'int');
  52. $action = GETPOST("action", 'alpha');
  53. $cancel = GETPOST('cancel', 'alpha');
  54. // Security check
  55. $socid = 0;
  56. if ($user->socid > 0) {
  57. $socid = $user->socid;
  58. }
  59. $feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user');
  60. $object = new User($db);
  61. if ($id > 0 || !empty($ref)) {
  62. $result = $object->fetch($id, $ref, '', 1);
  63. $object->getrights();
  64. }
  65. $account = new UserBankAccount($db);
  66. if (!$bankid) {
  67. $account->fetch(0, '', $id);
  68. } else {
  69. $account->fetch($bankid);
  70. }
  71. if (empty($account->userid)) {
  72. $account->userid = $object->id;
  73. }
  74. // Define value to know what current user can do on users
  75. $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write);
  76. $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
  77. $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || $user->hasRight('user', 'creer'));
  78. $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write');
  79. $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write');
  80. // Ok if user->rights->salaries->read or user->rights->hrm->read
  81. //$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2);
  82. $ok = false;
  83. if ($user->id == $id) {
  84. $ok = true; // A user can always read its own card
  85. }
  86. if (!empty($user->rights->salaries->read)) {
  87. $ok = true;
  88. }
  89. if (!empty($user->rights->hrm->read)) {
  90. $ok = true;
  91. }
  92. if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
  93. $ok = true;
  94. }
  95. if (!$ok) {
  96. accessforbidden();
  97. }
  98. /*
  99. * Actions
  100. */
  101. if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) {
  102. $account->userid = $object->id;
  103. $account->bank = GETPOST('bank', 'alpha');
  104. $account->label = GETPOST('label', 'alpha');
  105. $account->courant = GETPOST('courant', 'alpha');
  106. $account->code_banque = GETPOST('code_banque', 'alpha');
  107. $account->code_guichet = GETPOST('code_guichet', 'alpha');
  108. $account->number = GETPOST('number', 'alpha');
  109. $account->cle_rib = GETPOST('cle_rib', 'alpha');
  110. $account->bic = GETPOST('bic', 'alpha');
  111. $account->iban = GETPOST('iban', 'alpha');
  112. $account->domiciliation = GETPOST('domiciliation', 'alpha');
  113. $account->proprio = GETPOST('proprio', 'alpha');
  114. $account->owner_address = GETPOST('owner_address', 'alpha');
  115. $account->currency_code = trim(GETPOST("account_currency_code"));
  116. $account->state_id = GETPOST("account_state_id", 'int');
  117. $account->country_id = GETPOST("account_country_id", 'int');
  118. $result = $account->create($user);
  119. if (!$result) {
  120. setEventMessages($account->error, $account->errors, 'errors');
  121. $action = 'edit'; // Force chargement page edition
  122. } else {
  123. setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
  124. $action = '';
  125. }
  126. }
  127. if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
  128. $account->userid = $object->id;
  129. $account->bank = GETPOST('bank', 'alpha');
  130. $account->label = GETPOST('label', 'alpha');
  131. $account->courant = GETPOST('courant', 'alpha');
  132. $account->code_banque = GETPOST('code_banque', 'alpha');
  133. $account->code_guichet = GETPOST('code_guichet', 'alpha');
  134. $account->number = GETPOST('number', 'alpha');
  135. $account->cle_rib = GETPOST('cle_rib', 'alpha');
  136. $account->bic = GETPOST('bic', 'alpha');
  137. $account->iban = GETPOST('iban', 'alpha');
  138. $account->domiciliation = GETPOST('domiciliation', 'alpha');
  139. $account->proprio = GETPOST('proprio', 'alpha');
  140. $account->owner_address = GETPOST('owner_address', 'alpha');
  141. $account->currency_code = trim(GETPOST("account_currency_code"));
  142. $account->state_id = GETPOST("account_state_id", 'int');
  143. $account->country_id = GETPOST("account_country_id", 'int');
  144. $result = $account->update($user);
  145. if (!$result) {
  146. setEventMessages($account->error, $account->errors, 'errors');
  147. $action = 'edit'; // Force chargement page edition
  148. } else {
  149. setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
  150. $action = '';
  151. }
  152. }
  153. if ($action == 'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) {
  154. $result = $account->delete($user);
  155. if ($result < 0) {
  156. setEventMessages($account->error, $account->errors, 'errors');
  157. } else {
  158. setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
  159. header("Location: ".DOL_URL_ROOT.'/user/bank.php?id='.$object->id);
  160. exit;
  161. }
  162. $action = '';
  163. }
  164. // update birth
  165. if ($action == 'setbirth' && $canadduser && !$cancel) {
  166. $object->birth = dol_mktime(0, 0, 0, GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int'));
  167. $result = $object->update($user);
  168. if ($result < 0) {
  169. setEventMessages($object->error, $object->errors, 'errors');
  170. }
  171. }
  172. // update personal email
  173. if ($action == 'setpersonal_email' && $canadduser && !$cancel) {
  174. $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml');
  175. $result = $object->update($user);
  176. if ($result < 0) {
  177. setEventMessages($object->error, $object->errors, 'errors');
  178. }
  179. }
  180. // update personal mobile
  181. if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) {
  182. $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml');
  183. $result = $object->update($user);
  184. if ($result < 0) {
  185. setEventMessages($object->error, $object->errors, 'errors');
  186. }
  187. }
  188. // update ref_employee
  189. if ($action == 'setref_employee' && $canadduser && !$cancel) {
  190. $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml');
  191. $result = $object->update($user);
  192. if ($result < 0) {
  193. setEventMessages($object->error, $object->errors, 'errors');
  194. }
  195. }
  196. // update national_registration_number
  197. if ($action == 'setnational_registration_number' && $canadduser && !$cancel) {
  198. $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
  199. $result = $object->update($user);
  200. if ($result < 0) {
  201. setEventMessages($object->error, $object->errors, 'errors');
  202. }
  203. }
  204. if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
  205. // update default_c_exp_tax_cat
  206. if ($action == 'setdefault_c_exp_tax_cat' && $canadduser) {
  207. $object->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat', 'int');
  208. $result = $object->update($user);
  209. if ($result < 0) {
  210. setEventMessages($object->error, $object->errors, 'errors');
  211. }
  212. }
  213. // update default range
  214. if ($action == 'setdefault_range' && $canadduser) {
  215. $object->default_range = GETPOST('default_range', 'int');
  216. $result = $object->update($user);
  217. if ($result < 0) {
  218. setEventMessages($object->error, $object->errors, 'errors');
  219. }
  220. }
  221. }
  222. /*
  223. * View
  224. */
  225. $form = new Form($db);
  226. $formcompany = new FormCompany($db);
  227. $childids = $user->getAllChildIds(1);
  228. $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
  229. $title = $person_name." - ".$langs->trans('BankAccounts');
  230. $help_url = '';
  231. llxHeader('', $title, $help_url);
  232. $head = user_prepare_head($object);
  233. if ($id && $bankid && $action == 'edit' && ($user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write)) {
  234. if ($conf->use_javascript_ajax) {
  235. print "\n<script>";
  236. print 'jQuery(document).ready(function () {
  237. jQuery("#type").change(function() {
  238. document.formbank.action.value="edit";
  239. document.formbank.submit();
  240. });
  241. jQuery("#selectaccount_country_id").change(function() {
  242. document.formbank.action.value="edit";
  243. document.formbank.submit();
  244. });
  245. })';
  246. print "</script>\n";
  247. }
  248. print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
  249. print '<input type="hidden" name="token" value="'.newToken().'">';
  250. print '<input type="hidden" name="action" value="update">';
  251. print '<input type="hidden" name="id" value="'.GETPOST("id", 'int').'">';
  252. print '<input type="hidden" name="bankid" value="'.$bankid.'">';
  253. }
  254. if ($id && $action == 'create' && $user->hasRight('user', 'user', 'creer')) {
  255. if ($conf->use_javascript_ajax) {
  256. print "\n<script>";
  257. print 'jQuery(document).ready(function () {
  258. jQuery("#type").change(function() {
  259. document.formbank.action.value="create";
  260. document.formbank.submit();
  261. });
  262. jQuery("#selectaccount_country_id").change(function() {
  263. document.formbank.action.value="create";
  264. document.formbank.submit();
  265. });
  266. })';
  267. print "</script>\n";
  268. }
  269. print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" name="formbank" method="post">';
  270. print '<input type="hidden" name="token" value="'.newToken().'">';
  271. print '<input type="hidden" name="action" value="add">';
  272. print '<input type="hidden" name="bankid" value="'.$bankid.'">';
  273. }
  274. // View
  275. if ($action != 'edit' && $action != 'create') { // If not bank account yet, $account may be empty
  276. $title = $langs->trans("User");
  277. print dol_get_fiche_head($head, 'bank', $title, -1, 'user');
  278. $linkback = '';
  279. if ($user->rights->user->user->lire || $user->admin) {
  280. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  281. }
  282. $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">';
  283. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  284. $morehtmlref .= '</a>';
  285. $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
  286. $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
  287. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
  288. print '<div class="fichecenter"><div class="fichehalfleft">';
  289. print '<div class="underbanner clearboth"></div>';
  290. print '<table class="border centpercent tableforfield">';
  291. print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
  292. if (!empty($object->ldap_sid) && $object->statut == 0) {
  293. print '<td class="error">';
  294. print $langs->trans("LoginAccountDisableInDolibarr");
  295. print '</td>';
  296. } else {
  297. print '<td>';
  298. $addadmin = '';
  299. if (property_exists($object, 'admin')) {
  300. if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
  301. $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
  302. } elseif (!empty($object->admin)) {
  303. $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
  304. }
  305. }
  306. print showValueWithClipboardCPButton($object->login).$addadmin;
  307. print '</td>';
  308. }
  309. print '</tr>';
  310. // Hierarchy
  311. print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
  312. print '<td>';
  313. if (empty($object->fk_user)) {
  314. print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
  315. } else {
  316. $huser = new User($db);
  317. if ($object->fk_user > 0) {
  318. $huser->fetch($object->fk_user);
  319. print $huser->getNomUrl(1);
  320. } else {
  321. print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
  322. }
  323. }
  324. print '</td>';
  325. print "</tr>\n";
  326. // Expense report validator
  327. if (isModEnabled('expensereport')) {
  328. print '<tr><td>';
  329. $text = $langs->trans("ForceUserExpenseValidator");
  330. print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
  331. print '</td>';
  332. print '<td>';
  333. if (!empty($object->fk_user_expense_validator)) {
  334. $evuser = new User($db);
  335. $evuser->fetch($object->fk_user_expense_validator);
  336. print $evuser->getNomUrl(1);
  337. }
  338. print '</td>';
  339. print "</tr>\n";
  340. }
  341. // Holiday request validator
  342. if (isModEnabled('holiday')) {
  343. print '<tr><td>';
  344. $text = $langs->trans("ForceUserHolidayValidator");
  345. print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
  346. print '</td>';
  347. print '<td>';
  348. if (!empty($object->fk_user_holiday_validator)) {
  349. $hvuser = new User($db);
  350. $hvuser->fetch($object->fk_user_holiday_validator);
  351. print $hvuser->getNomUrl(1);
  352. }
  353. print '</td>';
  354. print "</tr>\n";
  355. }
  356. // Position/Job
  357. print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
  358. print '<td>'.dol_escape_htmltag($object->job).'</td>';
  359. print '</tr>'."\n";
  360. // Weeklyhours
  361. print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
  362. print '<td>';
  363. print price2num($object->weeklyhours);
  364. print '</td>';
  365. print "</tr>\n";
  366. // Sensitive salary/value information
  367. if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
  368. || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
  369. || (isModEnabled('hrm') && !empty($user->rights->hrm->employee->read))) {
  370. $langs->load("salaries");
  371. // Salary
  372. print '<tr><td>'.$langs->trans("Salary").'</td>';
  373. print '<td>';
  374. print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').'</span>';
  375. print '</td>';
  376. print "</tr>\n";
  377. // THM
  378. print '<tr><td>';
  379. $text = $langs->trans("THM");
  380. print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
  381. print '</td>';
  382. print '<td>';
  383. print ($object->thm != '' ?price($object->thm, '', $langs, 1, -1, -1, $conf->currency) : '');
  384. print '</td>';
  385. print "</tr>\n";
  386. // TJM
  387. print '<tr><td>';
  388. $text = $langs->trans("TJM");
  389. print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm');
  390. print '</td>';
  391. print '<td>';
  392. print ($object->tjm != '' ?price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : '');
  393. print '</td>';
  394. print "</tr>\n";
  395. }
  396. // Date employment
  397. print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
  398. print '<td>';
  399. if ($object->dateemployment) {
  400. print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
  401. print dol_print_date($object->dateemployment, 'day');
  402. }
  403. if ($object->dateemploymentend) {
  404. print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
  405. print dol_print_date($object->dateemploymentend, 'day');
  406. }
  407. print '</td>';
  408. print "</tr>\n";
  409. // Date of birth
  410. if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
  411. print '<tr>';
  412. print '<td>';
  413. print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'));
  414. print '</td><td>';
  415. print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer'), 'day', $object->birth);
  416. print '</td>';
  417. print "</tr>\n";
  418. }
  419. // Personal email
  420. if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
  421. print '<tr class="nowrap">';
  422. print '<td>';
  423. print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write);
  424. print '</td><td>';
  425. 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, 'dol_print_email');
  426. print '</td>';
  427. print '</tr>';
  428. }
  429. // Personal phone
  430. if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
  431. print '<tr class="nowrap">';
  432. print '<td>';
  433. print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write);
  434. print '</td><td>';
  435. print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'string', '', null, null, '', 0, 'dol_print_phone');
  436. print '</td>';
  437. print '</tr>';
  438. }
  439. if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
  440. print '<tr class="nowrap">';
  441. print '<td>';
  442. print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer'));
  443. print '</td><td>';
  444. if ($action == 'editdefault_c_exp_tax_cat') {
  445. $ret = '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
  446. $ret .= '<input type="hidden" name="action" value="setdefault_c_exp_tax_cat">';
  447. $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
  448. $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
  449. $ret .= $form->selectExpenseCategories($object->default_c_exp_tax_cat, 'default_c_exp_tax_cat', 1);
  450. $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
  451. $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
  452. $ret .= '</form>';
  453. print $ret;
  454. } else {
  455. $label_exp_tax_cat = dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
  456. print $langs->trans($label_exp_tax_cat);
  457. //print $form->editfieldval("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer'), 'string', ($object->default_c_exp_tax_cat != '' ? $object->default_c_exp_tax_cat : ''));
  458. }
  459. print '</td>';
  460. print '</tr>';
  461. print '<tr class="nowrap">';
  462. print '<td>';
  463. print $form->editfieldkey("DefaultRangeNumber", 'default_range', $object->default_range, $object, $user->hasRight('user', 'user', 'creer'));
  464. print '</td><td>';
  465. if ($action == 'editdefault_range') {
  466. $ret = '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
  467. $ret .= '<input type="hidden" name="action" value="setdefault_range">';
  468. $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
  469. $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
  470. $expensereportik = new ExpenseReportIk($db);
  471. $maxRangeNum = $expensereportik->getMaxRangeNumber($object->default_c_exp_tax_cat);
  472. $ret .= $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range);
  473. $ret .= '<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'"> ';
  474. $ret .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
  475. $ret .= '</form>';
  476. print $ret;
  477. } else {
  478. print $object->default_range;
  479. }
  480. print '</td>';
  481. print '</tr>';
  482. }
  483. // Accountancy code
  484. if (isModEnabled('accounting')) {
  485. print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
  486. print '<td>'.$object->accountancy_code.'</td></tr>';
  487. }
  488. // Employee Number
  489. if ($permissiontoreadhr) {
  490. print '<tr class="nowrap">';
  491. print '<td>';
  492. print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr);
  493. print '</td><td>';
  494. print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr, 'string', $object->ref_employee);
  495. print '</td>';
  496. print '</tr>';
  497. }
  498. // National registration number
  499. if ($permissiontoreadhr) {
  500. print '<tr class="nowrap">';
  501. print '<td>';
  502. print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr);
  503. print '</td><td>';
  504. print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $permissiontowritehr, 'string', $object->national_registration_number);
  505. print '</td>';
  506. print '</tr>';
  507. }
  508. print '</table>';
  509. print '</div><div class="fichehalfright">';
  510. // Max number of elements in small lists
  511. $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
  512. // Latest payments of salaries
  513. if (!empty($conf->salaries->enabled) &&
  514. (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
  515. ) {
  516. $payment_salary = new PaymentSalary($db);
  517. $salary = new Salary($db);
  518. $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";
  519. $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
  520. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)";
  521. $sql .= " WHERE s.fk_user = ".((int) $object->id);
  522. $sql .= " AND s.entity IN (".getEntity('salary').")";
  523. $sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye, s.amount";
  524. $sql .= " ORDER BY s.dateep DESC";
  525. $resql = $db->query($sql);
  526. if ($resql) {
  527. $num = $db->num_rows($resql);
  528. print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  529. print '<table class="noborder centpercent">';
  530. print '<tr class="liste_titre">';
  531. 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>';
  532. print '</tr></table></td>';
  533. print '</tr>';
  534. $i = 0;
  535. while ($i < $num && $i < $MAXLIST) {
  536. $objp = $db->fetch_object($resql);
  537. $salary->id = $objp->sid;
  538. $salary->ref = $objp->sref ? $objp->sref : $objp->sid;
  539. $salary->label = $objp->label;
  540. $salary->datesp = $db->jdate($objp->datesp);
  541. $salary->dateep = $db->jdate($objp->dateep);
  542. $salary->paye = $objp->paye;
  543. $salary->amount = $objp->amount;
  544. $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0;
  545. $payment_salary->ref = !empty($objp->ref) ? $objp->ref : "";
  546. $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep : "");
  547. print '<tr class="oddeven">';
  548. print '<td class="nowraponall">';
  549. print $salary->getNomUrl(1);
  550. print '</td>';
  551. print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->datesp), 'day')."</td>\n";
  552. print '<td class="right nowraponall">'.dol_print_date($db->jdate($objp->dateep), 'day')."</td>\n";
  553. print '<td class="right nowraponall"><span class="amount">'.price($objp->amount).'</span></td>';
  554. print '<td class="right nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).'</td>';
  555. print '</tr>';
  556. $i++;
  557. }
  558. $db->free($resql);
  559. if ($num <= 0) {
  560. print '<td colspan="5"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
  561. }
  562. print "</table>";
  563. print "</div>";
  564. } else {
  565. dol_print_error($db);
  566. }
  567. }
  568. // Latest leave requests
  569. if (isModEnabled('holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
  570. $holiday = new Holiday($db);
  571. $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
  572. $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
  573. $sql .= " WHERE h.fk_user = ".((int) $object->id);
  574. $sql .= " AND h.entity IN (".getEntity('holiday').")";
  575. $sql .= " ORDER BY h.date_debut DESC";
  576. $resql = $db->query($sql);
  577. if ($resql) {
  578. $num = $db->num_rows($resql);
  579. print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  580. print '<table class="noborder centpercent">';
  581. print '<tr class="liste_titre">';
  582. 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>';
  583. print '</tr></table></td>';
  584. print '</tr>';
  585. $i = 0;
  586. while ($i < $num && $i < $MAXLIST) {
  587. $objp = $db->fetch_object($resql);
  588. $holiday->id = $objp->rowid;
  589. $holiday->ref = $objp->rowid;
  590. $holiday->fk_type = $objp->fk_type;
  591. $holiday->statut = $objp->status;
  592. $holiday->status = $objp->status;
  593. $nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday);
  594. print '<tr class="oddeven">';
  595. print '<td class="nowraponall">';
  596. print $holiday->getNomUrl(1);
  597. print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
  598. print '<td class="right nowraponall">'.$nbopenedday.' '.$langs->trans('DurationDays').'</td>';
  599. print '<td class="right nowraponall">'.$holiday->LibStatut($objp->status, 5).'</td>';
  600. print '</tr>';
  601. $i++;
  602. }
  603. $db->free($resql);
  604. if ($num <= 0) {
  605. print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
  606. }
  607. print "</table>";
  608. print "</div>";
  609. } else {
  610. dol_print_error($db);
  611. }
  612. }
  613. // Latest expense report
  614. if (isModEnabled('expensereport') &&
  615. ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
  616. ) {
  617. $exp = new ExpenseReport($db);
  618. $sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
  619. $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e";
  620. $sql .= " WHERE e.fk_user_author = ".((int) $object->id);
  621. $sql .= " AND e.entity = ".((int) $conf->entity);
  622. $sql .= " ORDER BY e.date_debut DESC";
  623. $resql = $db->query($sql);
  624. if ($resql) {
  625. $num = $db->num_rows($resql);
  626. print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  627. print '<table class="noborder centpercent">';
  628. print '<tr class="liste_titre">';
  629. 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>';
  630. print '</tr></table></td>';
  631. print '</tr>';
  632. $i = 0;
  633. while ($i < $num && $i < $MAXLIST) {
  634. $objp = $db->fetch_object($resql);
  635. $exp->id = $objp->rowid;
  636. $exp->ref = $objp->ref;
  637. $exp->status = $objp->status;
  638. print '<tr class="oddeven">';
  639. print '<td class="nowraponall">';
  640. print $exp->getNomUrl(1);
  641. print '</td><td class="right nowraponall">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
  642. print '<td class="right nowraponall"><span class="amount">'.price($objp->total_ttc).'</span></td>';
  643. print '<td class="right nowraponall">'.$exp->LibStatut($objp->status, 5).'</td>';
  644. print '</tr>';
  645. $i++;
  646. }
  647. $db->free($resql);
  648. if ($num <= 0) {
  649. print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
  650. }
  651. print "</table>";
  652. print "</div>";
  653. } else {
  654. dol_print_error($db);
  655. }
  656. }
  657. print '</div></div>';
  658. print '<div class="clearboth"></div>';
  659. print dol_get_fiche_end();
  660. // List of bank accounts (Currently only one bank account possible for each employee)
  661. $morehtmlright = '';
  662. if ($account->id == 0) {
  663. if ($permissiontoaddbankaccount) {
  664. $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create');
  665. } else {
  666. $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2);
  667. }
  668. } else {
  669. $morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('AlreadyOneBankAccount'), 'fa fa-plus-circle', '', '', -2);
  670. }
  671. print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');
  672. print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  673. print '<table class="liste centpercent">';
  674. print '<tr class="liste_titre">';
  675. print_liste_field_titre("LabelRIB");
  676. print_liste_field_titre("Bank");
  677. print_liste_field_titre("RIB");
  678. print_liste_field_titre("IBAN");
  679. print_liste_field_titre("BIC");
  680. print_liste_field_titre("Currency");
  681. print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
  682. print "</tr>\n";
  683. if ($account->id > 0) {
  684. print '<tr class="oddeven">';
  685. // Label
  686. print '<td>'.dol_escape_htmltag($account->label).'</td>';
  687. // Bank name
  688. print '<td>'.dol_escape_htmltag($account->bank).'</td>';
  689. // Account number
  690. print '<td>';
  691. $stringescaped = '';
  692. foreach ($account->getFieldsToShow() as $val) {
  693. if ($val == 'BankCode') {
  694. $stringescaped .= dol_escape_htmltag($account->code_banque).' ';
  695. } elseif ($val == 'BankAccountNumber') {
  696. $stringescaped .= dol_escape_htmltag($account->number).' ';
  697. } elseif ($val == 'DeskCode') {
  698. $stringescaped .= dol_escape_htmltag($account->code_guichet).' ';
  699. } elseif ($val == 'BankAccountNumberKey') {
  700. $stringescaped .= dol_escape_htmltag($account->cle_rib).' ';
  701. }
  702. }
  703. if (!empty($account->label) && $account->number) {
  704. if (!checkBanForAccount($account)) {
  705. $stringescaped .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning');
  706. } else {
  707. $stringescaped .= ' '.img_picto($langs->trans("ValueIsValid"), 'info');
  708. }
  709. }
  710. print $stringescaped;
  711. print '</td>';
  712. // IBAN
  713. print '<td>'.getIbanHumanReadable($account);
  714. if (!empty($account->iban)) {
  715. if (!checkIbanForAccount($account)) {
  716. print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
  717. }
  718. }
  719. print '</td>';
  720. // BIC
  721. print '<td>';
  722. print dol_escape_htmltag($account->bic);
  723. if (!empty($account->bic)) {
  724. if (!checkSwiftForAccount($account)) {
  725. print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
  726. }
  727. }
  728. print '</td>';
  729. // Currency
  730. print '<td>'.$account->currency_code.'</td>';
  731. // Edit/Delete
  732. print '<td class="right nowraponall">';
  733. if ($permissiontoaddbankaccount) {
  734. print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=edit&token='.newToken().'">';
  735. print img_picto($langs->trans("Modify"), 'edit');
  736. print '</a>';
  737. print '<a class="editfielda marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=delete_confirmed&token='.newToken().'">';
  738. print img_picto($langs->trans("Delete"), 'delete');
  739. print '</a>';
  740. }
  741. print '</td>';
  742. print '</tr>';
  743. }
  744. if ($account->id == 0) {
  745. $colspan = 7;
  746. print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoBANRecord").'</span></td></tr>';
  747. }
  748. print '</table>';
  749. print '</div>';
  750. }
  751. // Edit
  752. if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', 'user', 'creer')) {
  753. $title = $langs->trans("User");
  754. print dol_get_fiche_head($head, 'bank', $title, 0, 'user');
  755. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  756. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
  757. //print '<div class="fichecenter">';
  758. print '<div class="underbanner clearboth"></div>';
  759. print '<table class="border centpercent">';
  760. print '<tr><td class="titlefield fieldrequired">'.$langs->trans("LabelRIB").'</td>';
  761. print '<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.'"></td></tr>';
  762. print '<tr><td class="fieldrequired">'.$langs->trans("BankName").'</td>';
  763. print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
  764. // Currency
  765. print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
  766. print '<input type="hidden" value="'.$account->currency_code.'">';
  767. print '</td>';
  768. print '<td class="maxwidth200onsmartphone">';
  769. $selectedcode = $account->currency_code;
  770. if (!$selectedcode) {
  771. $selectedcode = $conf->currency;
  772. }
  773. print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
  774. print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
  775. print '</td></tr>';
  776. // Country
  777. $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
  778. $selectedcode = $account->country_code;
  779. if (GETPOSTISSET("account_country_id")) {
  780. $selectedcode = GETPOST("account_country_id");
  781. } elseif (empty($selectedcode)) {
  782. $selectedcode = $mysoc->country_code;
  783. }
  784. $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
  785. print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
  786. print '<td class="maxwidth200onsmartphone">';
  787. print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
  788. if ($user->admin) {
  789. print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  790. }
  791. print '</td></tr>';
  792. // State
  793. print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
  794. if ($selectedcode) {
  795. print img_picto('', 'state', 'class="pictofixedwidth"');
  796. print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id');
  797. } else {
  798. print $countrynotdefined;
  799. }
  800. print '</td></tr>';
  801. // Show fields of bank account
  802. foreach ($account->getFieldsToShow() as $val) {
  803. if ($val == 'BankCode') {
  804. $name = 'code_banque';
  805. $size = 8;
  806. $content = $account->code_banque;
  807. } elseif ($val == 'DeskCode') {
  808. $name = 'code_guichet';
  809. $size = 8;
  810. $content = $account->code_guichet;
  811. } elseif ($val == 'BankAccountNumber') {
  812. $name = 'number';
  813. $size = 18;
  814. $content = $account->number;
  815. } elseif ($val == 'BankAccountNumberKey') {
  816. $name = 'cle_rib';
  817. $size = 3;
  818. $content = $account->cle_rib;
  819. }
  820. print '<td>'.$langs->trans($val).'</td>';
  821. print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
  822. print '</tr>';
  823. }
  824. // IBAN
  825. print '<tr><td class="fieldrequired">'.$langs->trans("IBAN").'</td>';
  826. print '<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.'"></td></tr>';
  827. print '<tr><td class="fieldrequired">'.$langs->trans("BIC").'</td>';
  828. print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
  829. print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
  830. print '<textarea name="domiciliation" rows="4" class="quatrevingtpercent">';
  831. print dol_escape_htmltag($account->domiciliation);
  832. print "</textarea></td></tr>";
  833. print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
  834. print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
  835. print "</td></tr>\n";
  836. print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
  837. print '<textarea name="owner_address" rows="4" class="quatrevingtpercent">';
  838. print dol_escape_htmltag($account->owner_address);
  839. print "</textarea></td></tr>";
  840. print '</table>';
  841. //print '</div>';
  842. print dol_get_fiche_end();
  843. print $form->buttonsSaveCancel("Modify");
  844. }
  845. if ($id && $action == 'edit' && $user->hasRight('user', 'user', 'creer')) {
  846. print '</form>';
  847. }
  848. if ($id && $action == 'create' && $user->hasRight('user', 'user', 'creer')) {
  849. print '</form>';
  850. }
  851. // End of page
  852. llxFooter();
  853. $db->close();