pocket_list.php 37 KB

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