basicservices_list.php 37 KB

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