diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index ba5bdd8aab5..b2c01b6f02a 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -105,7 +105,7 @@ if ($_GET["facid"] > 0)
if ($conf->projet->enabled)
{
$langs->load("projects");
- print '
'.$langs->trans("Projet").' | ';
+ print ' | '.$langs->trans("Project").' | ';
if ($fac->projetid > 0)
{
$projet = New Project($db);
@@ -128,67 +128,72 @@ if ($_GET["facid"] > 0)
/*
* Documents
*
- *
*/
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
$facref = str_replace($forbidden_chars,"_",$fac->ref);
$file = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf";
$filedetail = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . "-detail.pdf";
+ $fileimage = $file.".png";
+ // Si fichier PDF existe
if (file_exists($file))
{
- $encfile = urlencode($file);
- print_titre("Documents");
- print '';
-
- print "| Facture PDF | ";
-
- print ''.$fac->ref.'.pdf | ';
-
- print ''.filesize($file). ' bytes | ';
- print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).' | ';
- print ' ';
-
- if (file_exists($filedetail)) // facture détaillée supplémentaire
- {
- $encfile = urlencode($filedetail);
- print "| Facture détaillée | ";
-
- print ''.$fac->ref.'-detail.pdf | ';
- print ''.filesize($filedetail). ' bytes | ';
- print ''.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).' | ';
- print ' ';
- }
-
- $fileimage = $file.".png";
-
- print " \n";
- }
-
- /* Conversion en image */
-
- if (!file_exists($fileimage))
- {
- $handle = imagick_readimage( $file ) ;
- if ( imagick_iserror( $handle ) )
- {
- $reason = imagick_failedreason( $handle ) ;
- $description = imagick_faileddescription( $handle ) ;
-
- print "handle failed! \nReason: $reason \nDescription: $description \n";
- }
-
- imagick_convert( $handle, "PNG" ) ;
-
- if ( imagick_iserror( $handle ) )
- {
- $reason = imagick_failedreason( $handle ) ;
- $description = imagick_faileddescription( $handle ) ;
-
- print "handle failed! \nReason: $reason \nDescription: $description \n";
- }
-
- imagick_writeimage( $handle, $file .".png");
+ $encfile = urlencode($file);
+ print_titre("Documents");
+ print '';
+
+ print "| ".$langs->trans("Bill")." PDF | ";
+
+ print ''.$fac->ref.'.pdf | ';
+
+ print ''.filesize($file). ' bytes | ';
+ print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).' | ';
+ print ' ';
+
+ // Si fichier detail PDF existe
+ if (file_exists($filedetail)) // facture détaillée supplémentaire
+ {
+ $encfile = urlencode($filedetail);
+ print "| Facture détaillée | ";
+
+ print ''.$fac->ref.'-detail.pdf | ';
+ print ''.filesize($filedetail). ' bytes | ';
+ print ''.strftime("%d %b %Y %H:%M:%S",filemtime($filedetail)).' | ';
+ print ' ';
+ }
+
+ print " \n";
+
+ // Conversion du PDF en image png si fichier png non existant
+ if (!file_exists($fileimage))
+ {
+ if (function_exists(imagick_readimage)) {
+ $handle = imagick_readimage( $file ) ;
+ if ( imagick_iserror( $handle ) )
+ {
+ $reason = imagick_failedreason( $handle ) ;
+ $description = imagick_faileddescription( $handle ) ;
+
+ print "handle failed! \nReason: $reason \nDescription: $description \n";
+ }
+
+ imagick_convert( $handle, "PNG" ) ;
+
+ if ( imagick_iserror( $handle ) )
+ {
+ $reason = imagick_failedreason( $handle ) ;
+ $description = imagick_faileddescription( $handle ) ;
+
+ print "handle failed! \nReason: $reason \nDescription: $description \n";
+ }
+
+ imagick_writeimage( $handle, $file .".png");
+ }
+ else {
+ print "Les fonctions imagick ne sont pas disponibles sur ce PHP";
+ }
+ }
+
}
/*
@@ -217,7 +222,7 @@ if ($_GET["facid"] > 0)
else
{
/* Facture non trouvée */
- print "Facture inexistante";
+ print $langs->trans("ErrorBillNotFound");
}
}
|