Browse Source

Fix download of mass generated files.

Laurent Destailleur 9 years ago
parent
commit
4a408e76e7

+ 1 - 1
htdocs/compta/facture/list.php

@@ -1479,7 +1479,7 @@ if ($resql)
         $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
         $title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
         
-        print $formfile->showdocuments('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
+        print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
     }
     else
     {

+ 2 - 2
htdocs/core/class/html.formfile.class.php

@@ -569,15 +569,15 @@ class FormFile
             	$reshook = $hookmanager->executeHooks('formBuilddocOptions',$parameters,$GLOBALS['object']);
             	$out.= $hookmanager->resPrint;
             }
-        }
 
+        }
         // Get list of files
         if (! empty($filedir))
         {
             $file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC);
 
             // Show title of array if not already shown
-            if ((! empty($file_list) || $modulepart == 'massfilesarea') && ! $headershown)
+            if ((! empty($file_list) || preg_match('/^massfilesarea', $modulepart)) && ! $headershown)
             {
                 $headershown=1;
                 $out.= '<div class="titre">'.$titletoshow.'</div>';

+ 2 - 2
htdocs/core/lib/files.lib.php

@@ -1983,13 +1983,13 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
 		$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
 	}
 
-	else if ($modulepart == 'unpaid')
+	else if ($modulepart == 'massfilesarea')
 	{
 		if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
 		{
 			$accessallowed=1;
 		}
-		$original_file=$conf->facture->dir_output.'/unpaid/temp/'.$original_file;
+		$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
 	}
 
 	// Wrapping pour les fiches intervention