Fix: Better error management

This commit is contained in:
Laurent Destailleur 2011-07-04 10:04:18 +00:00
parent 7521acb00a
commit ea208fda3b

View File

@ -23,7 +23,7 @@
* \file htdocs/product/stats/fiche.php * \file htdocs/product/stats/fiche.php
* \ingroup product * \ingroup product
* \brief Page des stats produits * \brief Page des stats produits
* \version $Id$ * \version $Id: fiche.php,v 1.109 2011/07/04 10:04:18 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -37,6 +37,8 @@ $langs->load("bills");
$langs->load("other"); $langs->load("other");
$mode=isset($_GET["mode"])?$_GET["mode"]:'byunit'; $mode=isset($_GET["mode"])?$_GET["mode"]:'byunit';
$error=0;
$mesg='';
// Security check // Security check
if (isset($_GET["id"]) || isset($_GET["ref"])) if (isset($_GET["id"]) || isset($_GET["ref"]))
@ -47,8 +49,6 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid); $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
$mesg = '';
/* /*
* View * View
@ -135,9 +135,10 @@ if ($_GET["id"] || $_GET["ref"])
$dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp); $dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp);
if (! file_exists($dir.'/'.$product->id)) if (! file_exists($dir.'/'.$product->id))
{ {
if (create_exdir($dir.'/'.$product->id) < 0) if (dol_mkdir($dir.'/'.$product->id) < 0)
{ {
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir); $mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
$error++;
} }
} }
@ -161,6 +162,9 @@ if ($_GET["id"] || $_GET["ref"])
); );
$px = new DolGraph(); $px = new DolGraph();
if (! $error)
{
$mesg = $px->isGraphKo(); $mesg = $px->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
@ -197,8 +201,9 @@ if ($_GET["id"] || $_GET["ref"])
} }
$mesg = $langs->trans("ChartGenerated"); $mesg = $langs->trans("ChartGenerated");
}
// Affichage graphs // Show graphs
$i=0; $i=0;
foreach($graphfiles as $key => $val) foreach($graphfiles as $key => $val)
{ {
@ -266,5 +271,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:04:18 $ - $Revision: 1.109 $');
?> ?>