diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5c7f3911700..21b56584f31 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3044,6 +3044,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file; + } elseif ($modulepart == 'massfilesarea_receipts') { + if ($fuser->hasRight('reception', $lire) || preg_match('/^specimen/i', $original_file)) { + $accessallowed = 1; + } + $original_file = $conf->reception->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_invoices') { if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 3a54c4a2652..a3e79296284 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -44,12 +44,12 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sh $socid = GETPOSTINT('socid'); +$action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $toselect = GETPOST('toselect', 'array'); $optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST('mode', 'alpha'); -$diroutputmassaction = $conf->reception->dir_output.'/temp/massgeneration/'.$user->id; $search_ref_rcp = GETPOST("search_ref_rcp"); $search_ref_liv = GETPOST('search_ref_liv'); @@ -98,7 +98,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; - +$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; $object = new Reception($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -856,6 +856,7 @@ if ($search_array_options) { $arrayofmassactions = array( + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), // 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); @@ -1435,7 +1436,25 @@ print $hookmanager->resPrint; print ""; print ""; print ''; + $db->free($resql); +$hidegeneratedfilelistifempty = 1; +if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; +} + +// Show list of available documents +$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; +$urlsource .= str_replace('&', '&', $param); + +$filedir = $diroutputmassaction; +$genallowed = $user->hasRight('reception', 'lire'); +$delallowed = $user->hasRight('reception', 'creer'); +$title = ''; + +print $formfile->showdocuments('massfilesarea_receipts', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + +// End of page llxFooter(); $db->close();