diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index a146469b96d..ed50ad388dd 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -512,32 +512,22 @@ if ($_GET["id"] > 0) } - print "
"; + print '
'; - /* - * Documents générés - * - */ - $file = $conf->facture->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf"; - $relativepath = $commande->ref."/".$commande->ref.".pdf"; + /* + * Documents générés + * + */ + $comref = sanitize_string($commande->ref); + $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; + $relativepath = $comref.'/'.$comref.'.pdf'; + $filedir = $conf->commande->dir_output . '/' . $comref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; + $genallowed=$user->rights->commande->creer; + $delallowed=$user->rights->commande->supprimer; - $var=true; - - if (file_exists($file)) - { - print_titre($langs->trans("Documents")); - print ''; - - print ""; - print ''; - print ''; - print ''; - print ''; - - print "
".$langs->trans("Order")." PDF'.$commande->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
\n"; - - } + $html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); /* * Liste des factures