mails_senderprofile_list.php 38 KB

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