diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8160f798db3..7fb01c3a1ff 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1176,11 +1176,11 @@ else * Documents générés * */ - $forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); - $facref = str_replace($forbidden_chars,"_",$fac->ref); - $file = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf"; - $filedetail = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . "-detail.pdf"; - + + $forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); + $facref = str_replace($forbidden_chars,"_",$fac->ref); + $file = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf"; + print "'; print ''; print ''; - - if (file_exists($filedetail)) // facture détaillée supplémentaire - { - $encfile = urlencode($filedetail); - print ""; - - print ''; - print ''; - print ''; - print ''; - } + + $dir = FAC_OUTPUTDIR . "/" . $facref . "/"; + $handle=opendir($dir); + + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && substr($file, -10) == 'detail.pdf') + { + $encfile = urlencode($dir.$file); + print ""; + + print ''; + print ''; + print ''; + print ''; + } + } print "
"; if (file_exists($file)) @@ -1196,18 +1196,24 @@ else print ''.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
Facture détaillée'.$fac->ref.'-detail.pdf'.filesize($filedetail). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).'
Facture détaillée'.$fac->ref.'-detail.pdf'.filesize($dir.$file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($dir.$file)).'
\n"; }