Fix #7921 : For invoice with "/" in ref

Fix #7921 : For invoice with "/" in ref
This commit is contained in:
Mistral Oz - LWEP 2017-12-11 14:47:07 +01:00 committed by GitHub
parent 8189be0ac4
commit 7cd785d59a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -728,13 +728,14 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
}
$arrayofinclusion=array();
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote($tmppdf.'.pdf','/').'$';
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf).'.pdf','/').'$';
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// build list of files with full path
$files = array();
foreach($listofobjectref as $basename)
{
$basename = dol_sanitizeFileName($basename);
foreach($listoffiles as $filefound)
{
if (strstr($filefound["name"],$basename))