diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8160f798db397dd21ab455c73e3a28243ed2bc42..7fb01c3a1ffa395df8eaf2cb09e634561950f4b8 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 "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">"; if (file_exists($file)) @@ -1196,18 +1196,24 @@ else print '<td align="right">'.filesize($file). ' bytes</td>'; print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>'; print '</tr>'; - - if (file_exists($filedetail)) // facture d�taill�e suppl�mentaire + + + $dir = FAC_OUTPUTDIR . "/" . $facref . "/"; + $handle=opendir($dir); + + while (($file = readdir($handle))!==false) { - $encfile = urlencode($filedetail); - print "<tr $bc[0]><td>Facture d�taill�e</td>"; - - print '<td><a href="'.DOL_URL_ROOT . '/document.php?file='.$encfile.'">'.$fac->ref.'-detail.pdf</a></td>'; - print '<td align="right">'.filesize($filedetail). ' bytes</td>'; - print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).'</td>'; - print '</tr>'; + if (is_readable($dir.$file) && substr($file, -10) == 'detail.pdf') + { + $encfile = urlencode($dir.$file); + print "<tr $bc[0]><td>Facture d�taill�e</td>"; + + print '<td><a href="'.DOL_URL_ROOT . '/document.php?file='.$encfile.'">'.$fac->ref.'-detail.pdf</a></td>'; + print '<td align="right">'.filesize($dir.$file). ' bytes</td>'; + print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($dir.$file)).'</td>'; + print '</tr>'; + } } - print "</table>\n"; }