Fix: Show error message

This commit is contained in:
Laurent Destailleur 2011-05-04 18:34:16 +00:00
parent ab8d73226b
commit d6abe49da2
11 changed files with 136 additions and 92 deletions

View File

@ -230,25 +230,29 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->COMMANDE_ADDON == "$file")
{
@ -261,10 +265,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '</a>';
}
print '</td>';
$commande=new Commande($db);
$commande->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
@ -282,11 +286,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
@ -357,7 +361,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";
print "$name";
@ -366,7 +370,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Activated
print "<td align=\"center\">\n";
if (in_array($name, $def))
@ -389,7 +393,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '</a>';
}
print "</td>";
// Defaut
print "<td align=\"center\">";
if ($conf->global->COMMANDE_ADDON_PDF == "$name")
@ -403,7 +407,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
@ -416,14 +420,14 @@ foreach ($conf->file->dol_document_root as $dirroot)
//$htmltooltip.='<br>'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
}

View File

@ -119,8 +119,12 @@ if (is_resource($handle))
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->CONTRACT_ADDON == "$file")

View File

@ -306,21 +306,21 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var;
@ -328,10 +328,14 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td>';
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file")
{
@ -344,10 +348,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '</a>';
}
print '</td>';
$expedition=new Expedition($db);
$expedition->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
@ -365,11 +369,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
@ -432,7 +436,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
$handle=opendir($dir);
$var=true;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
@ -441,17 +445,17 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname();
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
@ -474,7 +478,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
@ -486,7 +490,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
@ -499,7 +503,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}
@ -507,7 +511,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
}
}
}
print '</table>';

View File

@ -35,6 +35,7 @@ $langs->load("admin");
$langs->load("companies");
$langs->load("bills");
$langs->load("other");
$langs->load("errors");
if (!$user->admin)
accessforbidden();
@ -303,8 +304,12 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '</td>';
// Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
//print "> ".$conf->global->FACTURE_ADDON." - ".$file;
@ -359,7 +364,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
if (! empty($module->error)) dol_htmloutput_errors($module->error,'');
if (! empty($module->error)) dol_htmloutput_errors($module->error,'',1);
}
print '</td>';

View File

@ -206,39 +206,43 @@ clearstatcache();
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot . "/includes/modules/fichinter/";
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
{
$file = $reg[1];
$classname = substr($file,4);
require_once($dir.$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->FICHEINTER_ADDON == $classname)
{
@ -249,10 +253,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$ficheinter=new Fichinter($db);
$ficheinter->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
@ -264,7 +268,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
@ -332,9 +336,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print '<tr '.$bc[$var].'><td>';
echo "$name";
print "</td><td>\n";
@ -342,7 +346,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$module = new $classname();
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
@ -365,7 +369,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
@ -377,7 +381,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
@ -394,7 +398,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>';
print '</tr>';
}
}

View File

@ -270,8 +270,12 @@ if (is_resource($handle))
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file")

View File

@ -227,25 +227,29 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php");
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->LIVRAISON_ADDON == "$file")
{
@ -256,10 +260,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
$livraison=new Livraison($db);
$livraison->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
@ -277,11 +281,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
@ -352,17 +356,17 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";
print $name;
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '</td>';
// Activ
if (in_array($name, $def))
{
@ -385,7 +389,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
@ -397,7 +401,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
@ -409,7 +413,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>';
print '</tr>';
}
}

View File

@ -207,8 +207,12 @@ if (is_resource($handle))
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->PROJECT_ADDON == "$file")

View File

@ -225,7 +225,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@ -247,8 +247,12 @@ foreach ($conf->file->dol_document_root as $dirroot)
print $module->info();
print '</td>';
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->PROPALE_ADDON == "$file")
@ -348,7 +352,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
if (is_resource($handle))
{

View File

@ -259,8 +259,12 @@ foreach ($arrayhandler as $key => $module)
print $langs->trans("MinLength").': '.$module->length;
print '</td>';
// Affiche example
print '<td width="60">'.$module->getExample().'</td>';
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td width="100" align="center">';
if ($conf->global->USER_PASSWORD_GENERATED == $key)

View File

@ -74,4 +74,7 @@ WarningNoDocumentModelActivated=No model, for document generation, has been acti
ErrorDatabaseParameterWrong=Database setup parameter '<b>%s</b>' has a value not compatible to use Dolibarr (must have value '<b>%s</b>').
ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module.
ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price defined on this product for this supplier
ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Setup - Modules to complete.
ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Setup - Modules to complete.
ErrorBadMask=Error on mask
ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number
ErrorBadMaskBadRazMonth=Erreur, bad reset value