Fix: Better error management

This commit is contained in:
Laurent Destailleur 2010-08-05 22:51:36 +00:00
parent dc1e3472c9
commit 1d22d0f69d

View File

@ -166,18 +166,21 @@ if ($resql)
print '<td align="center">'; print '<td align="center">';
if ($obj->coder && $obj->coder != -1) if ($obj->coder && $obj->coder != -1)
{ {
$result=0;
// Chargement de la classe de codage // Chargement de la classe de codage
foreach ($conf->file->dol_document_root as $dirroot) foreach ($conf->file->dol_document_root as $dirroot)
{ {
$dir=$dirroot . "/includes/modules/barcode/"; $dir=$dirroot . "/includes/modules/barcode/";
$result=@include_once($dir.$obj->coder.".modules.php"); $result=@include_once($dir.$obj->coder.".modules.php");
//print $dir.$obj->coder.".modules.php - ".$result;
if ($result) break; if ($result) break;
} }
if ($result) if ($result)
{ {
$classname = "mod".ucfirst($obj->coder); $classname = "mod".ucfirst($obj->coder);
if (class_exists($classname))
{
$module = new $classname($db); $module = new $classname($db);
if ($module->encodingIsSupported($obj->encoding)) if ($module->encodingIsSupported($obj->encoding))
{ {
// Build barcode on disk (not used, this is done to make debug easier) // Build barcode on disk (not used, this is done to make debug easier)
@ -193,6 +196,11 @@ if ($resql)
print $langs->trans("FormatNotSupportedByGenerator"); print $langs->trans("FormatNotSupportedByGenerator");
} }
} }
else
{
print 'ErrorClassNotFoundInModule '.$classname.' '.$obj->coder;
}
}
} }
else else
{ {