From d6abe49da2cabfc47e54a507ec39b800b8df0def Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 May 2011 18:34:16 +0000 Subject: [PATCH] Fix: Show error message --- htdocs/admin/commande.php | 40 ++++++++++++++++------------- htdocs/admin/contract.php | 8 ++++-- htdocs/admin/expedition.php | 46 ++++++++++++++++++---------------- htdocs/admin/facture.php | 11 +++++--- htdocs/admin/fichinter.php | 42 +++++++++++++++++-------------- htdocs/admin/fournisseur.php | 8 ++++-- htdocs/admin/livraison.php | 40 ++++++++++++++++------------- htdocs/admin/project.php | 8 ++++-- htdocs/admin/propale.php | 12 ++++++--- htdocs/admin/security.php | 8 ++++-- htdocs/langs/en_US/errors.lang | 5 +++- 11 files changed, 136 insertions(+), 92 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1a1c511f048..1ae657fd1c9 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -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 ''.$module->nom."\n"; print $module->info(); print ''; - - // Examples - print ''.$module->getExample()."\n"; - + + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; + print ''; if ($conf->global->COMMANDE_ADDON == "$file") { @@ -261,10 +265,10 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; } print ''; - + $commande=new Commande($db); $commande->initAsSpecimen(); - + // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; @@ -282,11 +286,11 @@ foreach ($conf->file->dol_document_root as $dirroot) $htmltooltip.=$langs->trans($module->error).'
'; } } - + print ''; print $html->textwithpicto('',$htmltooltip,1,0); print ''; - + print ''; } } @@ -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 "\n "; print "$name"; @@ -366,7 +370,7 @@ foreach ($conf->file->dol_document_root as $dirroot) $module = new $classname($db); print $module->description; print "\n"; - + // Activated print "\n"; if (in_array($name, $def)) @@ -389,7 +393,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; } print ""; - + // Defaut print ""; if ($conf->global->COMMANDE_ADDON_PDF == "$name") @@ -403,7 +407,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; } print ''; - + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); @@ -416,14 +420,14 @@ foreach ($conf->file->dol_document_root as $dirroot) //$htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); - + print ''; print $html->textwithpicto('',$htmltooltip,1,0); print ''; print ''; print ''.img_object($langs->trans("Preview"),'order').''; print ''; - + print "\n"; } } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 59a0bc060a6..e3732563e71 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -119,8 +119,12 @@ if (is_resource($handle)) print $module->info(); print ''; - // Examples - print ''.$module->getExample()."\n"; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; if ($conf->global->CONTRACT_ADDON == "$file") diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 2d6bf1c35f4..98312254a91 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -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 ''; print $module->info(); print ''; - - // Examples - print ''.$module->getExample()."\n"; - + + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; + print ''; if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") { @@ -344,10 +348,10 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; } print ''; - + $expedition=new Expedition($db); $expedition->initAsSpecimen(); - + // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; @@ -365,11 +369,11 @@ foreach ($conf->file->dol_document_root as $dirroot) $htmltooltip.=$langs->trans($module->error).'
'; } } - + print ''; print $html->textwithpicto('',$htmltooltip,1,0); print ''; - + print ''; } } @@ -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 ""; print $name; print "\n"; require_once($dir.$file); $module = new $classname(); - + print $module->description; print ''; - + // Active if (in_array($name, $def)) { @@ -474,7 +478,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''.img_picto($langs->trans("Disabled"),'off').''; print ""; } - + // Default print ""; if ($conf->global->EXPEDITION_ADDON_PDF == $name) @@ -486,7 +490,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; - + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); @@ -499,7 +503,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').''; print ''; - + print ''; } } @@ -507,7 +511,7 @@ foreach ($conf->file->dol_document_root as $dirroot) } } } - + print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 87d17e1ad6c..7e1dc7093eb 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -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 ''; - // Affiche example - print ''.$module->getExample().''; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; //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 ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 396cf3dab35..06d41c5a071 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -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 ''.$module->nom."\n"; print $module->info(); print ''; - - // Examples - print ''.$module->getExample()."\n"; - + + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; + print ''; if ($conf->global->FICHEINTER_ADDON == $classname) { @@ -249,10 +253,10 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''.img_picto($langs->trans("Disabled"),'off').''; } print ''; - + $ficheinter=new Fichinter($db); $ficheinter->initAsSpecimen(); - + // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; @@ -264,7 +268,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; print $html->textwithpicto('',$htmltooltip,1,0); print ''; - + print ''; } } @@ -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 ''; echo "$name"; print "\n"; @@ -342,7 +346,7 @@ foreach ($conf->file->dol_document_root as $dirroot) $module = new $classname(); print $module->description; print ''; - + // Active if (in_array($name, $def)) { @@ -365,7 +369,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').''; print ""; } - + // Defaut print ""; if ($conf->global->FICHEINTER_ADDON_PDF == "$name") @@ -377,7 +381,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; - + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); @@ -394,7 +398,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''; print ''.img_object($langs->trans("Preview"),'intervention').''; print ''; - + print ''; } } diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 205b8b37d6c..53cc48c3656 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -270,8 +270,12 @@ if (is_resource($handle)) print $module->info(); print ''; - // Examples - print ''.$module->getExample()."\n"; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file") diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index df55fc7b788..8e8e48c9304 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -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 ''.$module->nom."\n"; print $module->info(); print ''; - - // Affiche example - print ''.$module->getExample().''; - + + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; + print ''; if ($conf->global->LIVRAISON_ADDON == "$file") { @@ -256,10 +260,10 @@ foreach ($conf->file->dol_document_root as $dirroot) print ''.img_picto($langs->trans("Disabled"),'off').''; } print ''; - + $livraison=new Livraison($db); $livraison->initAsSpecimen(); - + // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; @@ -277,11 +281,11 @@ foreach ($conf->file->dol_document_root as $dirroot) $htmltooltip.=$langs->trans($module->error).'
'; } } - + print ''; print $html->textwithpicto('',$htmltooltip,1,0); print ''; - + print ''; } } @@ -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 ""; print $name; print "\n"; require_once($dir.$file); $module = new $classname($db); - + print $module->description; print ''; - + // Activ if (in_array($name, $def)) { @@ -385,7 +389,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').''; print ""; } - + // Defaut print ""; if ($conf->global->LIVRAISON_ADDON_PDF == "$name") @@ -397,7 +401,7 @@ foreach ($conf->file->dol_document_root as $dirroot) print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; - + // Info $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='
'.$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 ''; print ''.img_object($langs->trans("Preview"),'sending').''; print ''; - + print ''; } } diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php index 7e77ae704bf..74c1f84ec47 100644 --- a/htdocs/admin/project.php +++ b/htdocs/admin/project.php @@ -207,8 +207,12 @@ if (is_resource($handle)) print $module->info(); print ''; - // Examples - print ''.$module->getExample()."\n"; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; if ($conf->global->PROJECT_ADDON == "$file") diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index c2fae944830..8f2d3d251ca 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -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 ''; - // Examples - print ''.$module->getExample()."\n"; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; 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)) { diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index fca513f23d6..62dcf2643a3 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -259,8 +259,12 @@ foreach ($arrayhandler as $key => $module) print $langs->trans("MinLength").': '.$module->length; print ''; - // Affiche example - print ''.$module->getExample().''; + // Show example of numbering module + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + else print $tmp; + print ''."\n"; print ''; if ($conf->global->USER_PASSWORD_GENERATED == $key) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 78be8f2d88c..5fa04645bff 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -74,4 +74,7 @@ WarningNoDocumentModelActivated=No model, for document generation, has been acti ErrorDatabaseParameterWrong=Database setup parameter '%s' has a value not compatible to use Dolibarr (must have value '%s'). 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. \ No newline at end of file +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 \ No newline at end of file