diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 3a062788059..0d1c2a1a1c7 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -50,6 +50,10 @@ $langs->load('bills');
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
+$show_files=GETPOST('show_files','int');
+$confirm=GETPOST('confirm','alpha');
+$toselect = GETPOST('toselect', 'array');
+
$orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
$orderday=GETPOST("orderday","int");
@@ -72,7 +76,6 @@ $search_sale=GETPOST('search_sale','int');
$search_total_ht=GETPOST('search_total_ht','alpha');
$optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int');
-$toselect = GETPOST('toselect', 'array');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
@@ -346,6 +349,20 @@ if (empty($reshook))
{
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
}
+ }
+
+ // Remove file
+ if ($action == 'remove_file')
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+ $langs->load("other");
+ $upload_dir = $diroutputmassaction;
+ $file = $upload_dir . '/' . GETPOST('file');
+ $ret=dol_delete_file($file);
+ if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
+ else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
+ $action='';
}
}
@@ -557,8 +574,8 @@ if ($resql)
}
$arrayofmassactions = array(
- //'presend'=>$langs->trans("SendByMail"),
- //'builddoc'=>$langs->trans("PDFMerge"),
+ 'presend'=>$langs->trans("SendByMail"),
+ 'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
@@ -1204,6 +1221,30 @@ if ($resql)
print ''."\n";
print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
';
+
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
+ {
+ /*
+ * Show list of available documents
+ */
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
+
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->facture->lire;
+ $delallowed=$user->rights->facture->lire;
+
+ print '
';
+ $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
+ $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')';
+
+ print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
+ }
+ else
+ {
+ print '
'.$langs->trans("ShowTempMassFilesArea").'';
+ }
+
}
else
{
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 99103ee419a..5bd8ecfe852 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -58,10 +58,13 @@ $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int');
+
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha');
+$toselect = GETPOST('toselect', 'array');
+
$lineid=GETPOST('lineid','int');
$userid=GETPOST('userid','int');
$search_product_category=GETPOST('search_product_category','int');
@@ -86,7 +89,6 @@ $year = GETPOST('year','int');
$day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
-$toselect = GETPOST('toselect', 'array');
$option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0';
@@ -1494,7 +1496,7 @@ if ($resql)
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
$title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')';
- print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
+ print $formfile->showdocuments('massfilesarea_invoice','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{