userloginnaplo_list.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. <?php
  2. // Load Dolibarr environment
  3. $res = 0;
  4. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  5. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  6. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
  7. }
  8. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  9. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
  10. $tmp2 = realpath(__FILE__);
  11. $i = strlen($tmp) - 1;
  12. $j = strlen($tmp2) - 1;
  13. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  14. $i--;
  15. $j--;
  16. }
  17. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
  18. $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
  19. }
  20. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
  21. $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
  22. }
  23. // Try main.inc.php using relative path
  24. if (!$res && file_exists("../main.inc.php")) {
  25. $res = @include "../main.inc.php";
  26. }
  27. if (!$res && file_exists("../../main.inc.php")) {
  28. $res = @include "../../main.inc.php";
  29. }
  30. if (!$res && file_exists("../../../main.inc.php")) {
  31. $res = @include "../../../main.inc.php";
  32. }
  33. if (!$res) {
  34. die("Include of main fails");
  35. }
  36. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
  37. require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
  38. require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
  39. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/helper.class.php';
  40. // load bbus libraries
  41. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/userloginnaplo.class.php';
  42. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/logoutchangenaplo.class.php';
  43. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/usernaplo.class.php';
  44. // for other modules
  45. //dol_include_once('/othermodule/class/otherobject.class.php');
  46. // Load translation files required by the page
  47. $langs->loadLangs(array("bbus@bbus", "other"));
  48. $id = GETPOST('id', 'int');
  49. $ref = GETPOST('ref', 'alpha');
  50. $user_id = GETPOST('user_id', 'int');
  51. $idmenu = GETPOST('idmenu', 'int');
  52. $newlogoutrecord = GETPOST('newlogoutrecord', 'int');
  53. $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  54. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  55. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  56. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  57. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  58. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  59. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)) . basename(__FILE__, '.php')); // To manage different context of search
  60. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  61. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  62. $mode = GETPOST('mode', 'aZ');
  63. // Load variable for pagination
  64. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  65. $sortfield = GETPOST('sortfield', 'aZ09comma');
  66. $sortorder = GETPOST('sortorder', 'aZ09comma');
  67. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  68. if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  69. // If $page is not defined, or '' or -1 or if we click on clear filters
  70. $page = 0;
  71. }
  72. $offset = $limit * $page;
  73. $pageprev = $page - 1;
  74. $pagenext = $page + 1;
  75. // Initialize technical objects
  76. $form = new Form($db);
  77. $object = new UserLoginNaplo($db);
  78. $extrafields = new ExtraFields($db);
  79. $diroutputmassaction = $conf->bbus->dir_output . '/temp/massgeneration/' . $user->id;
  80. $hookmanager->initHooks(array('userloginnaplolist')); // Note that conf->hooks_modules contains array
  81. // Fetch optionals attributes and labels
  82. $extrafields->fetch_name_optionals_label($object->table_element);
  83. //$extrafields->fetch_name_optionals_label($object->table_element_line);
  84. $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  85. // Default sort order (if not yet defined by previous GETPOST)
  86. if (!$sortfield) {
  87. reset($object->fields); // Reset is required to avoid key() to return null.
  88. $sortfield = "t." . key($object->fields); // Set here default search field. By default 1st field in definition.
  89. }
  90. if (!$sortorder) {
  91. $sortorder = "DESC";
  92. }
  93. // Initialize array of search criterias
  94. $search_all = GETPOST('search_all', 'alphanohtml');
  95. $search = array();
  96. foreach ($object->fields as $key => $val) {
  97. if (GETPOST('search_' . $key, 'alpha') !== '') {
  98. $search[$key] = GETPOST('search_' . $key, 'alpha');
  99. }
  100. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  101. $search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
  102. $search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
  103. }
  104. }
  105. // List of fields to search into when doing a "search in all"
  106. $fieldstosearchall = array();
  107. foreach ($object->fields as $key => $val) {
  108. if (!empty($val['searchall'])) {
  109. $fieldstosearchall['t.' . $key] = $val['label'];
  110. }
  111. }
  112. // Definition of array of fields for columns
  113. $arrayfields = array();
  114. foreach ($object->fields as $key => $val) {
  115. // If $val['visible']==0, then we never show the field
  116. if (!empty($val['visible'])) {
  117. $visible = (int) dol_eval($val['visible'], 1);
  118. $arrayfields['t.' . $key] = array(
  119. 'label' => $val['label'],
  120. 'checked' => (($visible < 0) ? 0 : 1),
  121. 'enabled' => (abs($visible) != 3 && dol_eval($val['enabled'], 1)),
  122. 'position' => $val['position'],
  123. 'help' => isset($val['help']) ? $val['help'] : ''
  124. );
  125. }
  126. }
  127. // Extra fields
  128. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
  129. $object->fields = dol_sort_array($object->fields, 'position');
  130. //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
  131. $arrayfields = dol_sort_array($arrayfields, 'position');
  132. // There is several ways to check permission.
  133. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks
  134. $enablepermissioncheck = 0;
  135. if ($enablepermissioncheck) {
  136. $permissiontoread = $user->rights->bbus->userloginnaplo->read;
  137. $permissiontoadd = $user->rights->bbus->userloginnaplo->write;
  138. $permissiontodelete = $user->rights->bbus->userloginnaplo->delete;
  139. } else {
  140. $permissiontoread = 1;
  141. $permissiontoadd = 1;
  142. $permissiontodelete = 1;
  143. }
  144. // Security check (enable the most restrictive one)
  145. if ($user->socid > 0)
  146. accessforbidden();
  147. //if ($user->socid > 0) accessforbidden();
  148. //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
  149. //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
  150. //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
  151. if (empty($conf->bbus->enabled))
  152. accessforbidden('Module not enabled');
  153. if (!$permissiontoread)
  154. accessforbidden();
  155. /*
  156. * Actions
  157. */
  158. if (GETPOST('cancel', 'alpha')) {
  159. $action = 'list';
  160. $massaction = '';
  161. }
  162. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  163. $massaction = '';
  164. }
  165. $parameters = array();
  166. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  167. if ($reshook < 0) {
  168. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  169. }
  170. if (empty($reshook)) {
  171. // Selection of new fields
  172. include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
  173. // Purge search criteria
  174. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  175. foreach ($object->fields as $key => $val) {
  176. $search[$key] = '';
  177. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  178. $search[$key . '_dtstart'] = '';
  179. $search[$key . '_dtend'] = '';
  180. }
  181. }
  182. $toselect = array();
  183. $search_array_options = array();
  184. }
  185. if (
  186. GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
  187. || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')
  188. ) {
  189. $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  190. }
  191. // Mass actions
  192. $objectclass = 'UserLoginNaplo';
  193. $objectlabel = 'UserLoginNaplo';
  194. $uploaddir = $conf->bbus->dir_output;
  195. include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php';
  196. }
  197. /*
  198. * View
  199. */
  200. $userObj = new User($db);
  201. $form = new Form($db);
  202. $helper = new Helper($db);
  203. include DOL_DOCUMENT_ROOT.'/custom/settlements/core/actions_addupdatedelete.inc.php';
  204. $result = $userObj->fetch($user_id);
  205. $now = dol_now();
  206. //$help_url = "EN:Module_UserLoginNaplo|FR:Module_UserLoginNaplo_FR|ES:Módulo_UserLoginNaplo";
  207. $help_url = '';
  208. $title = $langs->trans("UserLoginNaplos");
  209. $morejs = array();
  210. $morecss = array();
  211. // Build and execute select
  212. // --------------------------------------------------------------------
  213. $sql = 'SELECT ';
  214. $sql .= $object->getFieldList('t');
  215. // Add fields from extrafields
  216. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  217. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  218. $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key : '');
  219. }
  220. }
  221. // Add fields from hooks
  222. $parameters = array();
  223. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
  224. $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
  225. $sql = preg_replace('/,\s*$/', '', $sql);
  226. //$sql .= ", COUNT(rc.rowid) as anotherfield";
  227. $sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
  228. //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
  229. if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
  230. $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
  231. }
  232. // Add table from hooks
  233. $parameters = array();
  234. $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
  235. $sql .= $hookmanager->resPrint;
  236. if ($object->ismultientitymanaged == 1) {
  237. $sql .= " WHERE t.entity IN (" . getEntity($object->element) . ") AND user_id = {$user_id} AND login_logout_status = 1";
  238. } else {
  239. $sql .= " WHERE user_id = {$user_id} AND login_logout_status = 1";
  240. }
  241. foreach ($search as $key => $val) {
  242. if (array_key_exists($key, $object->fields)) {
  243. if ($key == 'status' && $search[$key] == -1) {
  244. continue;
  245. }
  246. $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
  247. if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
  248. if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
  249. $search[$key] = '';
  250. }
  251. $mode_search = 2;
  252. }
  253. if ($search[$key] != '') {
  254. $sql .= natural_search("t." . $db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
  255. }
  256. } else {
  257. if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
  258. $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
  259. if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
  260. if (preg_match('/_dtstart$/', $key)) {
  261. $sql .= " AND t." . $db->escape($columnName) . " >= '" . $db->idate($search[$key]) . "'";
  262. }
  263. if (preg_match('/_dtend$/', $key)) {
  264. $sql .= " AND t." . $db->escape($columnName) . " <= '" . $db->idate($search[$key]) . "'";
  265. }
  266. }
  267. }
  268. }
  269. }
  270. if ($search_all) {
  271. $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
  272. }
  273. //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
  274. // Add where from extra fields
  275. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
  276. // Add where from hooks
  277. $parameters = array();
  278. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
  279. $sql .= $hookmanager->resPrint;
  280. /* If a group by is required
  281. $sql .= " GROUP BY ";
  282. foreach($object->fields as $key => $val) {
  283. $sql .= "t.".$db->escape($key).", ";
  284. }
  285. // Add fields from extrafields
  286. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  287. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  288. $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
  289. }
  290. }
  291. // Add where from hooks
  292. $parameters = array();
  293. $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
  294. $sql .= $hookmanager->resPrint;
  295. $sql = preg_replace('/,\s*$/', '', $sql);
  296. */
  297. // Add HAVING from hooks
  298. /*
  299. $parameters = array();
  300. $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
  301. $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
  302. */
  303. // Count total nb of records
  304. $nbtotalofrecords = '';
  305. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
  306. /* This old and fast method to get and count full list returns all record so use a high amount of memory.
  307. $resql = $db->query($sql);
  308. $nbtotalofrecords = $db->num_rows($resql);
  309. */
  310. /* The slow method does not consume memory on mysql (not tested on pgsql) */
  311. /*$resql = $db->query($sql, 0, 'auto', 1);
  312. while ($db->fetch_object($resql)) {
  313. if (empty($nbtotalofrecords)) {
  314. $nbtotalofrecords = 1; // We can't make +1 because init value is ''
  315. } else {
  316. $nbtotalofrecords++;
  317. }
  318. }*/
  319. /* The fast and low memory method to get and count full list converts the sql into a sql count */
  320. $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
  321. $resql = $db->query($sqlforcount);
  322. if ($resql) {
  323. $objforcount = $db->fetch_object($resql);
  324. $nbtotalofrecords = $objforcount->nbtotalofrecords;
  325. } else {
  326. dol_print_error($db);
  327. }
  328. if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
  329. $page = 0;
  330. $offset = 0;
  331. }
  332. $db->free($resql);
  333. }
  334. // Complete request and execute it with limit
  335. $sql .= $db->order($sortfield, $sortorder);
  336. if ($limit) {
  337. $sql .= $db->plimit($limit + 1, $offset);
  338. }
  339. //print $sql;
  340. $resql = $db->query($sql);
  341. if (!$resql) {
  342. dol_print_error($db);
  343. exit;
  344. }
  345. $num = $db->num_rows($resql);
  346. // Direct jump if only one record found
  347. if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
  348. $obj = $db->fetch_object($resql);
  349. $id = $obj->rowid;
  350. header("Location: " . dol_buildpath('/bbus/userloginnaplo_card.php', 1) . '?id=' . $id);
  351. exit;
  352. }
  353. // Output page
  354. // --------------------------------------------------------------------
  355. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
  356. // Example : Adding jquery code
  357. // print '<script type="text/javascript">
  358. // jQuery(document).ready(function() {
  359. // function init_myfunc()
  360. // {
  361. // jQuery("#myid").removeAttr(\'disabled\');
  362. // jQuery("#myid").attr(\'disabled\',\'disabled\');
  363. // }
  364. // init_myfunc();
  365. // jQuery("#mybutton").click(function() {
  366. // init_myfunc();
  367. // });
  368. // });
  369. // </script>';
  370. $arrayofselected = is_array($toselect) ? $toselect : array();
  371. $param = '';
  372. if (!empty($mode)) {
  373. $param .= '&mode=' . urlencode($mode);
  374. }
  375. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  376. $param .= '&contextpage=' . urlencode($contextpage);
  377. }
  378. if ($limit > 0 && $limit != $conf->liste_limit) {
  379. $param .= '&limit=' . urlencode($limit);
  380. }
  381. $param .= '&user_id=' . $user_id . '&idmenu=' . $idmenu;
  382. foreach ($search as $key => $val) {
  383. if (is_array($search[$key])) {
  384. foreach ($search[$key] as $skey) {
  385. if ($skey != '') {
  386. $param .= '&search_' . $key . '[]=' . urlencode($skey);
  387. }
  388. }
  389. } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
  390. $param .= '&search_' . $key . 'month=' . ((int) GETPOST('search_' . $key . 'month', 'int'));
  391. $param .= '&search_' . $key . 'day=' . ((int) GETPOST('search_' . $key . 'day', 'int'));
  392. $param .= '&search_' . $key . 'year=' . ((int) GETPOST('search_' . $key . 'year', 'int'));
  393. } elseif ($search[$key] != '') {
  394. $param .= '&search_' . $key . '=' . urlencode($search[$key]);
  395. }
  396. }
  397. if ($optioncss != '') {
  398. $param .= '&optioncss=' . urlencode($optioncss);
  399. }
  400. // Add $param from extra fields
  401. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
  402. // Add $param from hooks
  403. $parameters = array();
  404. $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
  405. $param .= $hookmanager->resPrint;
  406. // List of mass actions available
  407. $arrayofmassactions = array(
  408. //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
  409. //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
  410. //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
  411. //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
  412. );
  413. if (!empty($permissiontodelete)) {
  414. $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
  415. }
  416. if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
  417. $arrayofmassactions = array();
  418. }
  419. $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
  420. print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?user_id=' . $user_id . '">' . "\n";
  421. if ($optioncss != '') {
  422. print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
  423. }
  424. print '<input type="hidden" name="token" value="' . newToken() . '">';
  425. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  426. print '<input type="hidden" name="action" value="list">';
  427. print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
  428. print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
  429. print '<input type="hidden" name="page" value="' . $page . '">';
  430. print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
  431. print '<input type="hidden" name="mode" value="' . $mode . '">';
  432. $newcardbutton = '';
  433. //$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
  434. //$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
  435. //$newcardbutton .= dolGetButtonTitleSeparator();
  436. //$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/bbus/userloginnaplo_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']) . '&user_id=' . $user_id . '&idmenu=' . $idmenu, '', $permissiontoadd);
  437. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
  438. // Add code for pre mass action (confirmation or email presend form)
  439. $topicmail = "SendUserLoginNaploRef";
  440. $modelmail = "userloginnaplo";
  441. $objecttmp = new UserLoginNaplo($db);
  442. $trackid = 'xxxx' . $object->id;
  443. include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
  444. if ($search_all) {
  445. $setupstring = '';
  446. foreach ($fieldstosearchall as $key => $val) {
  447. $fieldstosearchall[$key] = $langs->trans($val);
  448. $setupstring .= $key . "=" . $val . ";";
  449. }
  450. print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = ' . $setupstring . ' -->' . "\n";
  451. print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>' . "\n";
  452. }
  453. $moreforfilter = '';
  454. /*$moreforfilter.='<div class="divsearchfield">';
  455. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  456. $moreforfilter.= '</div>';*/
  457. $parameters = array();
  458. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  459. if (empty($reshook)) {
  460. $moreforfilter .= $hookmanager->resPrint;
  461. } else {
  462. $moreforfilter = $hookmanager->resPrint;
  463. }
  464. if (!empty($moreforfilter)) {
  465. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  466. print $moreforfilter;
  467. print '</div>';
  468. }
  469. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  470. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
  471. //$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  472. if($newlogoutrecord){
  473. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $user_id, $langs->trans('NewLogoutRecordConfirm'), $langs->trans('NewLogoutRecordConfirmObject', $userString), 'confirm_logout_record', '', 0, 1);
  474. print $formconfirm;
  475. }
  476. if($user->rights->settlements->logoutmanagement->write){
  477. print '<div style="margin-bottom: 20px;"><a href="/custom/settlements/userloginnaplo_list.php?user_id=' . $user_id . '&idmenu=' . $idmenu . '&newlogoutrecord=1" class="abutton">' . $langs->trans('NewLogoutRecord') . '</a></div>';
  478. }
  479. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  480. print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
  481. // Fields title search
  482. // --------------------------------------------------------------------
  483. print '<tr class="liste_titre">';
  484. // Action column
  485. if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  486. print '<td class="liste_titre maxwidthsearch">';
  487. $searchpicto = $form->showFilterButtons('left');
  488. print $searchpicto;
  489. print '</td>';
  490. }
  491. foreach ($object->fields as $key => $val) {
  492. $searchkey = empty($search[$key]) ? '' : $search[$key];
  493. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  494. if ($key == 'status') {
  495. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  496. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  497. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  498. } elseif (in_array($val['type'], array('timestamp'))) {
  499. $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
  500. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  501. $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
  502. }
  503. if (!empty($arrayfields['t.' . $key]['checked'])) {
  504. print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
  505. if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
  506. //print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
  507. } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
  508. //print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
  509. } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  510. print '<div class="nowrap">';
  511. print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
  512. print '</div>';
  513. print '<div class="nowrap">';
  514. print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
  515. print '</div>';
  516. } elseif ($key == 'lang') {
  517. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php';
  518. $formadmin = new FormAdmin($db);
  519. print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
  520. } else {
  521. print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
  522. }
  523. print '</td>';
  524. }
  525. }
  526. // Extra fields
  527. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
  528. // Fields from hook
  529. $parameters = array('arrayfields' => $arrayfields);
  530. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
  531. print $hookmanager->resPrint;
  532. /*if (!empty($arrayfields['anotherfield']['checked'])) {
  533. print '<td class="liste_titre"></td>';
  534. }*/
  535. // Action column
  536. if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  537. print '<td class="liste_titre maxwidthsearch">';
  538. $searchpicto = $form->showFilterButtons();
  539. print $searchpicto;
  540. print '</td>';
  541. }
  542. print '</tr>' . "\n";
  543. $totalarray = array();
  544. $totalarray['nbfield'] = 0;
  545. // Fields title label
  546. // --------------------------------------------------------------------
  547. print '<tr class="liste_titre">';
  548. if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  549. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
  550. }
  551. foreach ($object->fields as $key => $val) {
  552. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  553. if ($key == 'status') {
  554. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  555. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  556. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  557. } elseif (in_array($val['type'], array('timestamp'))) {
  558. $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
  559. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  560. $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
  561. }
  562. $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
  563. if (!empty($arrayfields['t.' . $key]['checked'])) {
  564. if ($key == 'date_creation') {
  565. $param .= '&user_id=' . $user_id . '&idmenu=' . $idmenu;
  566. print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
  567. } else {
  568. print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : ''), 1) . "\n";
  569. }
  570. $totalarray['nbfield']++;
  571. }
  572. }
  573. // Extra fields
  574. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
  575. // Hook fields
  576. $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
  577. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  578. print $hookmanager->resPrint;
  579. /*if (!empty($arrayfields['anotherfield']['checked'])) {
  580. print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
  581. $totalarray['nbfield']++;
  582. }*/
  583. // Action column
  584. if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  585. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
  586. }
  587. $totalarray['nbfield']++;
  588. print '</tr>' . "\n";
  589. // Detect if we need a fetch on each output line
  590. $needToFetchEachLine = 0;
  591. if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
  592. foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
  593. if (preg_match('/\$object/', $val)) {
  594. $needToFetchEachLine++; // There is at least one compute field that use $object
  595. }
  596. }
  597. }
  598. // Loop on record
  599. // --------------------------------------------------------------------
  600. $i = 0;
  601. $savnbfield = $totalarray['nbfield'];
  602. $totalarray = array();
  603. $totalarray['nbfield'] = 0;
  604. $imaxinloop = ($limit ? min($num, $limit) : $num);
  605. while ($i < $imaxinloop) {
  606. $obj = $db->fetch_object($resql);
  607. if (empty($obj)) {
  608. break; // Should not happen
  609. }
  610. // Store properties in $object
  611. $object->setVarsFromFetchObj($obj);
  612. if ($mode == 'kanban') {
  613. if ($i == 0) {
  614. print '<tr><td colspan="' . $savnbfield . '">';
  615. print '<div class="box-flex-container">';
  616. }
  617. // Output Kanban
  618. print $object->getKanbanView('');
  619. if ($i == ($imaxinloop - 1)) {
  620. print '</div>';
  621. print '</td></tr>';
  622. }
  623. } else {
  624. // Show here line of result
  625. $j = 0;
  626. print '<tr data-rowid="' . $object->id . '" class="oddeven">';
  627. // Action column
  628. if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  629. print '<td class="nowrap center">';
  630. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  631. $selected = 0;
  632. if (in_array($object->id, $arrayofselected)) {
  633. $selected = 1;
  634. }
  635. print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
  636. }
  637. print '</td>';
  638. }
  639. foreach ($object->fields as $key => $val) {
  640. $dateChanged = $helper->getChangedDateRecord($object->id);
  641. if($dateChanged){
  642. $selectedUsername = '<a href="' . dol_buildpath('/bbus/logoutchangenaplo_card.php', 1).'?action=view&id=' . $dateChanged['id'] . '&object_id=' . $object->id . '&user_id=' . $user_id . '&idmenu=' . $idmenu . '&backtopage='.urlencode($_SERVER['PHP_SELF']) . '">' . $userObj->lastname . ' ' . $userObj->firstname . '</a> <span class="fa fa-pencil"></span>';
  643. }else{
  644. $selectedUsername = '<a href="' . dol_buildpath('/bbus/logoutchangenaplo_card.php', 1).'?action=create&object_id=' . $object->id . '&user_id=' . $user_id . '&idmenu=' . $idmenu . '&backtopage='.urlencode($_SERVER['PHP_SELF']) . '">' . $userObj->lastname . ' ' . $userObj->firstname . '</a>';
  645. }
  646. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  647. if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  648. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  649. } elseif ($key == 'status') {
  650. $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
  651. }
  652. if (in_array($val['type'], array('timestamp'))) {
  653. $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
  654. } elseif ($key == 'ref') {
  655. $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
  656. }
  657. if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
  658. $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
  659. }
  660. //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
  661. if (!empty($arrayfields['t.' . $key]['checked'])) {
  662. print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '');
  663. if (preg_match('/tdoverflow/', $cssforfield)) {
  664. print ' title="' . dol_escape_htmltag($object->$key) . '"';
  665. }
  666. print '>';
  667. if ($key == 'status') {
  668. print $object->getLibStatut(5);
  669. } elseif ($key == 'rowid') {
  670. print $object->showOutputField($val, $key, $object->id, '');
  671. } else {
  672. if ($key == 'user_id') {
  673. print $selectedUsername;
  674. //print $newcardbutton;
  675. } else {
  676. print $object->showOutputField($val, $key, $object->$key, '');
  677. }
  678. }
  679. print '</td>';
  680. if (!$i) {
  681. $totalarray['nbfield']++;
  682. }
  683. if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
  684. if (!$i) {
  685. $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
  686. }
  687. if (!isset($totalarray['val'])) {
  688. $totalarray['val'] = array();
  689. }
  690. if (!isset($totalarray['val']['t.' . $key])) {
  691. $totalarray['val']['t.' . $key] = 0;
  692. }
  693. $totalarray['val']['t.' . $key] += $object->$key;
  694. }
  695. }
  696. }
  697. // Extra fields
  698. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
  699. // Fields from hook
  700. $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
  701. $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
  702. print $hookmanager->resPrint;
  703. /*if (!empty($arrayfields['anotherfield']['checked'])) {
  704. print '<td class="right">'.$obj->anotherfield.'</td>';
  705. }*/
  706. // Action column
  707. if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
  708. print '<td class="nowrap center">';
  709. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  710. $selected = 0;
  711. if (in_array($object->id, $arrayofselected)) {
  712. $selected = 1;
  713. }
  714. //print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  715. }
  716. print '</td>';
  717. }
  718. if (!$i) {
  719. $totalarray['nbfield']++;
  720. }
  721. print '</tr>' . "\n";
  722. }
  723. $i++;
  724. }
  725. // Show total line
  726. include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
  727. // If no record found
  728. if ($num == 0) {
  729. $colspan = 1;
  730. foreach ($arrayfields as $key => $val) {
  731. if (!empty($val['checked'])) {
  732. $colspan++;
  733. }
  734. }
  735. print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
  736. }
  737. $db->free($resql);
  738. $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
  739. $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  740. print $hookmanager->resPrint;
  741. print '</table>' . "\n";
  742. print '</div>' . "\n";
  743. print '</form>' . "\n";
  744. if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
  745. $hidegeneratedfilelistifempty = 1;
  746. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
  747. $hidegeneratedfilelistifempty = 0;
  748. }
  749. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
  750. $formfile = new FormFile($db);
  751. // Show list of available documents
  752. $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
  753. $urlsource .= str_replace('&amp;', '&', $param);
  754. $filedir = $diroutputmassaction;
  755. $genallowed = $permissiontoread;
  756. $delallowed = $permissiontoadd;
  757. print $formfile->showdocuments('massfilesarea_bbus', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
  758. }
  759. // End of page
  760. llxFooter();
  761. $db->close();
  762. ?>
  763. <style>
  764. .abutton{
  765. text-decoration: none;
  766. background-color: rgb(163,0,21);
  767. color:white!important;
  768. width: 200px;
  769. height: 40px;
  770. text-align: center;
  771. margin: auto;
  772. display: inline-block;
  773. border: 1px rgb(163,0,21) solid;
  774. border-radius: 5px;
  775. line-height: 40px;
  776. }
  777. .abutton:hover{
  778. text-decoration: none;
  779. }
  780. </style>