mails_senderprofile_list.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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 <http://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. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("errors","admin","mails","languages"));
  31. $action = GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  32. $massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
  33. $show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
  34. $confirm = GETPOST('confirm','alpha'); // Result of a confirmation
  35. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  36. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  37. $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'emailsenderprofilelist'; // To manage different context of search
  38. $backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
  39. $optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
  40. $id = GETPOST('id','int');
  41. // Load variable for pagination
  42. $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
  43. $sortfield = GETPOST('sortfield','alpha');
  44. $sortorder = GETPOST('sortorder','alpha');
  45. $page = GETPOST('page','int');
  46. if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
  47. $offset = $limit * $page;
  48. $pageprev = $page - 1;
  49. $pagenext = $page + 1;
  50. // Initialize technical objects
  51. $object=new EmailSenderProfile($db);
  52. $extrafields = new ExtraFields($db);
  53. $diroutputmassaction=$conf->admin->dir_output . '/temp/massgeneration/'.$user->id;
  54. $hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
  55. // Fetch optionals attributes and labels
  56. $extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
  57. $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
  58. // Default sort order (if not yet defined by previous GETPOST)
  59. if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
  60. if (! $sortorder) $sortorder="ASC";
  61. // Protection if external user
  62. $socid=0;
  63. if ($user->societe_id > 0)
  64. {
  65. //$socid = $user->societe_id;
  66. accessforbidden();
  67. }
  68. // Initialize array of search criterias
  69. $search_all=trim(GETPOST("search_all",'alpha'));
  70. $search=array();
  71. foreach($object->fields as $key => $val)
  72. {
  73. if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
  74. }
  75. // List of fields to search into when doing a "search in all"
  76. $fieldstosearchall = array();
  77. foreach($object->fields as $key => $val)
  78. {
  79. if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
  80. }
  81. // Definition of fields for list
  82. $arrayfields=array();
  83. foreach($object->fields as $key => $val)
  84. {
  85. // If $val['visible']==0, then we never show the field
  86. if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
  87. }
  88. // Extra fields
  89. if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
  90. {
  91. foreach($extrafields->attribute_label as $key => $val)
  92. {
  93. if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
  94. }
  95. }
  96. /*
  97. * Actions
  98. */
  99. if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
  100. if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
  101. $parameters=array();
  102. $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  103. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  104. if (empty($reshook))
  105. {
  106. // Selection of new fields
  107. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  108. // Purge search criteria
  109. 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
  110. {
  111. foreach($object->fields as $key => $val)
  112. {
  113. $search[$key]='';
  114. }
  115. $toselect='';
  116. $search_array_options=array();
  117. }
  118. if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
  119. || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
  120. {
  121. $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  122. }
  123. // Mass actions
  124. $objectclass='EmailSenderProfile';
  125. $objectlabel='EmailSenderProfile';
  126. $permtoread = $user->admin;
  127. $permtodelete = $user->admin;
  128. $uploaddir = $conf->admin->dir_output.'/senderprofiles';
  129. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  130. }
  131. /*
  132. * View
  133. */
  134. $form=new Form($db);
  135. $now=dol_now();
  136. //$help_url="EN:Module_EmailSenderProfile|FR:Module_EmailSenderProfile_FR|ES:Módulo_EmailSenderProfile";
  137. $help_url='';
  138. $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailSenderProfiles"));
  139. llxHeader();
  140. $titre=$langs->trans("EMailsSetup");
  141. $linkback='';
  142. $titlepicto='title_setup';
  143. print load_fiche_titre($titre,$linkback,$titlepicto);
  144. $head = email_admin_prepare_head();
  145. dol_fiche_head($head, 'senderprofiles', '', -1);
  146. // Build and execute select
  147. // --------------------------------------------------------------------
  148. $sql = 'SELECT ';
  149. foreach($object->fields as $key => $val)
  150. {
  151. $sql.='t.'.$key.', ';
  152. }
  153. // Add fields from extrafields
  154. foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
  155. // Add fields from hooks
  156. $parameters=array();
  157. $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
  158. $sql.=$hookmanager->resPrint;
  159. $sql=preg_replace('/, $/','', $sql);
  160. $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
  161. if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)";
  162. if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
  163. else $sql.=" WHERE 1 = 1";
  164. foreach($search as $key => $val)
  165. {
  166. $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
  167. if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
  168. }
  169. if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
  170. // Add where from extra fields
  171. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  172. // Add where from hooks
  173. $parameters=array();
  174. $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
  175. $sql.=$hookmanager->resPrint;
  176. /* If a group by is required
  177. $sql.= " GROUP BY "
  178. foreach($object->fields as $key => $val)
  179. {
  180. $sql.='t.'.$key.', ';
  181. }
  182. // Add fields from extrafields
  183. foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
  184. // Add where from hooks
  185. $parameters=array();
  186. $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
  187. $sql.=$hookmanager->resPrint;
  188. */
  189. $sql.=$db->order($sortfield,$sortorder);
  190. // Count total nb of records
  191. $nbtotalofrecords = '';
  192. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
  193. {
  194. $result = $db->query($sql);
  195. $nbtotalofrecords = $db->num_rows($result);
  196. if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
  197. {
  198. $page = 0;
  199. $offset = 0;
  200. }
  201. }
  202. $sql.= $db->plimit($limit+1, $offset);
  203. $resql=$db->query($sql);
  204. if (! $resql)
  205. {
  206. dol_print_error($db);
  207. exit;
  208. }
  209. $num = $db->num_rows($resql);
  210. // Direct jump if only one record found
  211. if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
  212. {
  213. $obj = $db->fetch_object($resql);
  214. $id = $obj->rowid;
  215. header("Location: ".DOL_URL_ROOT.'/monmodule/emailsenderprofile_card.php?id='.$id);
  216. exit;
  217. }
  218. // Example : Adding jquery code
  219. print '<script type="text/javascript" language="javascript">
  220. jQuery(document).ready(function() {
  221. function init_myfunc()
  222. {
  223. jQuery("#myid").removeAttr(\'disabled\');
  224. jQuery("#myid").attr(\'disabled\',\'disabled\');
  225. }
  226. init_myfunc();
  227. jQuery("#mybutton").click(function() {
  228. init_myfunc();
  229. });
  230. });
  231. </script>';
  232. $arrayofselected=is_array($toselect)?$toselect:array();
  233. $param='';
  234. if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
  235. if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
  236. foreach($search as $key => $val)
  237. {
  238. $param.= '&search_'.$key.'='.urlencode($search[$key]);
  239. }
  240. if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
  241. // Add $param from extra fields
  242. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  243. // List of mass actions available
  244. $arrayofmassactions = array(
  245. //'presend'=>$langs->trans("SendByMail"),
  246. //'builddoc'=>$langs->trans("PDFMerge"),
  247. );
  248. if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
  249. if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
  250. $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
  251. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  252. if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  253. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  254. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  255. print '<input type="hidden" name="action" value="list">';
  256. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  257. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  258. print '<input type="hidden" name="page" value="'.$page.'">';
  259. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  260. //print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
  261. $topicmail="Information";
  262. //$modelmail="subscription";
  263. $objecttmp=new EmailSenderProfile($db);
  264. //$trackid='sub'.$object->id;
  265. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  266. $moreforfilter = '';
  267. /*$moreforfilter.='<div class="divsearchfield">';
  268. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  269. $moreforfilter.= '</div>';*/
  270. $parameters=array();
  271. $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  272. if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
  273. else $moreforfilter = $hookmanager->resPrint;
  274. if (! empty($moreforfilter))
  275. {
  276. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  277. print $moreforfilter;
  278. print '</div>';
  279. }
  280. $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
  281. $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  282. $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  283. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  284. print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
  285. // Fields title search
  286. // --------------------------------------------------------------------
  287. print '<tr class="liste_titre">';
  288. foreach($object->fields as $key => $val)
  289. {
  290. $align='';
  291. if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
  292. if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
  293. if ($key == 'status') $align.=($align?' ':'').'center';
  294. if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
  295. }
  296. // Extra fields
  297. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  298. // Fields from hook
  299. $parameters=array('arrayfields'=>$arrayfields);
  300. $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
  301. print $hookmanager->resPrint;
  302. // Action column
  303. print '<td class="liste_titre" align="right">';
  304. $searchpicto=$form->showFilterButtons();
  305. print $searchpicto;
  306. print '</td>';
  307. print '</tr>'."\n";
  308. // Fields title label
  309. // --------------------------------------------------------------------
  310. print '<tr class="liste_titre">';
  311. foreach($object->fields as $key => $val)
  312. {
  313. $align='';
  314. if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
  315. if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
  316. if ($key == 'status') $align.=($align?' ':'').'center';
  317. if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
  318. }
  319. // Extra fields
  320. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  321. // Hook fields
  322. $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
  323. $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  324. print $hookmanager->resPrint;
  325. print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
  326. print '</tr>'."\n";
  327. // Detect if we need a fetch on each output line
  328. $needToFetchEachLine=0;
  329. foreach ($extrafields->attribute_computed as $key => $val)
  330. {
  331. if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
  332. }
  333. // Loop on record
  334. // --------------------------------------------------------------------
  335. $i=0;
  336. $totalarray=array();
  337. while ($i < min($num, $limit))
  338. {
  339. $obj = $db->fetch_object($resql);
  340. if (empty($obj)) break; // Should not happen
  341. // Store properties in $object
  342. $object->id = $obj->rowid;
  343. foreach($object->fields as $key => $val)
  344. {
  345. if (isset($obj->$key)) $object->$key = $obj->$key;
  346. }
  347. // Show here line of result
  348. print '<tr class="oddeven">';
  349. foreach($object->fields as $key => $val)
  350. {
  351. $align='';
  352. if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
  353. if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
  354. if ($key == 'status') $align.=($align?' ':'').'center';
  355. if (! empty($arrayfields['t.'.$key]['checked']))
  356. {
  357. print '<td';
  358. if ($align) print ' class="'.$align.'"';
  359. print '>';
  360. print $object->showOutputField($val, $key, $obj->$key, '');
  361. print '</td>';
  362. if (! $i) $totalarray['nbfield']++;
  363. if (! empty($val['isameasure']))
  364. {
  365. if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
  366. $totalarray['val']['t.'.$key] += $obj->$key;
  367. }
  368. }
  369. }
  370. // Extra fields
  371. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  372. // Fields from hook
  373. $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
  374. $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
  375. print $hookmanager->resPrint;
  376. // Action column
  377. print '<td class="nowrap" align="center">';
  378. if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  379. {
  380. $selected=0;
  381. if (in_array($obj->rowid, $arrayofselected)) $selected=1;
  382. print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
  383. }
  384. print '</td>';
  385. if (! $i) $totalarray['nbfield']++;
  386. print '</tr>';
  387. $i++;
  388. }
  389. // Show total line
  390. if (isset($totalarray['pos']))
  391. {
  392. print '<tr class="liste_total">';
  393. $i=0;
  394. while ($i < $totalarray['nbfield'])
  395. {
  396. $i++;
  397. if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
  398. else
  399. {
  400. if ($i == 1)
  401. {
  402. if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
  403. else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
  404. }
  405. else print '<td></td>';
  406. }
  407. }
  408. print '</tr>';
  409. }
  410. // If no record found
  411. if ($num == 0)
  412. {
  413. $colspan=1;
  414. foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
  415. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  416. }
  417. $db->free($resql);
  418. $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
  419. $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
  420. print $hookmanager->resPrint;
  421. print '</table>'."\n";
  422. print '</div>'."\n";
  423. print '</form>'."\n";
  424. if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
  425. {
  426. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  427. $formfile = new FormFile($db);
  428. $hidegeneratedfilelistifempty=1;
  429. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
  430. // Show list of available documents
  431. $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
  432. $urlsource.=str_replace('&amp;','&',$param);
  433. $filedir=$diroutputmassaction;
  434. $genallowed=$user->rights->monmodule->read;
  435. $delallowed=$user->rights->monmodule->create;
  436. print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
  437. }
  438. dol_fiche_end();
  439. // End of page
  440. llxFooter();
  441. $db->close();