From 02d6ce79bad1c173de4bb18317373c2415b60eb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2005 14:39:28 +0000 Subject: [PATCH] Fix: Meilleur gestion erreur si module GD non dispo --- htdocs/commande/stats/index.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index eba350d4358..e433ef02156 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (c) 2004 Laurent Destailleur + * Copyright (c) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -55,12 +54,17 @@ $stats = new CommandeStats($db, $socidp); $year = strftime("%Y", time()); $data = $stats->getNbByMonthWithPrevYear($year); -if (! is_dir($conf->commande->dir_images)) -{ - mkdir($conf->commande->dir_output); - mkdir($conf->commande->dir_images); +// Création répertoire pour images générées +$dir=$conf->commande->dir_images; +if (! file_exists($dir)) +{ + if (create_exdir($dir) < 0) + { + $mesg = $langs->trans("ErrorCanNotCreateDir",$dir); + } } + $filename = $conf->commande->dir_images."/nbcommande2year-".$year.".png"; $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=nbcommande2year-'.$year.'.png'; @@ -81,7 +85,7 @@ $num = sizeof($rows); print ''; print ''; print ''; $i = 0; @@ -100,5 +104,5 @@ print '
'.$langs->trans("Year").''.$langs->trans("NbOfOrders").''.$langs->trans("AmountTotal").''; -if ($mesg) { print $mesg; } +if ($px->isGraphKo()) { print ''.$px->isGraphKo().''; } else { print 'Nombre de commande par mois'; } print '
'; $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?>