// BugFix - Changing error message "name is to long (32 chars max)" + Adding context to Tools::displayError()

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11409 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2011-12-20 14:06:57 +00:00
parent 59fd81a2e2
commit daa8c7f8c9
4 changed files with 11 additions and 8 deletions
+4 -1
View File
@@ -633,7 +633,10 @@ class ToolsCore
public static function displayError($string = 'Fatal error', $htmlentities = true, Context $context = null) public static function displayError($string = 'Fatal error', $htmlentities = true, Context $context = null)
{ {
global $_ERRORS; global $_ERRORS;
if (is_null($context))
$context = Context::getContext();
@include_once(_PS_TRANSLATIONS_DIR_.$context->language->iso_code.'/errors.php'); @include_once(_PS_TRANSLATIONS_DIR_.$context->language->iso_code.'/errors.php');
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $string == 'Fatal error') if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $string == 'Fatal error')
@@ -201,7 +201,7 @@ class AdminProductsControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`) LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group` LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0) AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)'; LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
// if no category selected, display all products // if no category selected, display all products
if (Validate::isLoadedObject($this->_category) && empty($this->_filter)) if (Validate::isLoadedObject($this->_category) && empty($this->_filter))
@@ -328,7 +328,7 @@ class AdminProductsControllerCore extends AdminController
if (!Validate::isGenericName(Tools::getValue('attachment_name_'.(int)($language['id_lang'])))) if (!Validate::isGenericName(Tools::getValue('attachment_name_'.(int)($language['id_lang']))))
$this->_errors[] = Tools::displayError('Invalid Name'); $this->_errors[] = Tools::displayError('Invalid Name');
else if (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32) else if (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32)
$this->_errors[] = Tools::displayError('Name is too long'); $this->_errors[] = Tools::displayError('Name is too long.').' '.'(32 '.Tools::displayError('chars max').')';
if (!Validate::isCleanHtml(Tools::getValue('attachment_description_'.(int)($language['id_lang'])))) if (!Validate::isCleanHtml(Tools::getValue('attachment_description_'.(int)($language['id_lang']))))
$this->_errors[] = Tools::displayError('Invalid description'); $this->_errors[] = Tools::displayError('Invalid description');
} }
@@ -1100,7 +1100,7 @@ class AdminTranslationsControllerCore extends AdminController
'limit_warning' => $this->displayLimitPostWarning($count), 'limit_warning' => $this->displayLimitPostWarning($count),
'suoshin_exceeded' => $this->suhosin_limit_exceed, 'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token,
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => '',
'type' => 'errors', 'type' => 'errors',
'errorsArray' => $stringToTranslate 'errorsArray' => $stringToTranslate
); );
@@ -1163,7 +1163,7 @@ class AdminTranslationsControllerCore extends AdminController
'suoshin_exceeded' => $this->suhosin_limit_exceed, 'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => '',
'tabsArray' => $tabs_array, 'tabsArray' => $tabs_array,
'missing_translations' => $missing_translations, 'missing_translations' => $missing_translations,
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
@@ -1512,7 +1512,7 @@ class AdminTranslationsControllerCore extends AdminController
'suoshin_exceeded' => $this->suhosin_limit_exceed, 'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsMails=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsMails=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => '',
'type' => 'mails', 'type' => 'mails',
'tinyMCE' => $this->getTinyMCEForMails($obj_lang->iso_code), 'tinyMCE' => $this->getTinyMCEForMails($obj_lang->iso_code),
'mail_content' => $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails')), 'mail_content' => $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails')),
@@ -1799,7 +1799,7 @@ class AdminTranslationsControllerCore extends AdminController
'suoshin_exceeded' => $this->suhosin_limit_exceed, 'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsPdf=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsPdf=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => '',
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'pdf', 'type' => 'pdf',
'tabsArray' => $tabs_array, 'tabsArray' => $tabs_array,
@@ -69,7 +69,7 @@ class GuestTrackingControllerCore extends FrontController
else if (!Validate::isLoadedObject($order)) else if (!Validate::isLoadedObject($order))
$this->errors[] = Tools::displayError('Invalid Order ID'); $this->errors[] = Tools::displayError('Invalid Order ID');
else if (!$order->isAssociatedAtGuest($email)) else if (!$order->isAssociatedAtGuest($email))
$this->errors[] = Tools::displayError('123'); $this->errors[] = Tools::displayError('Invalid order ID');
else else
{ {
$this->assignOrderTracking($order); $this->assignOrderTracking($order);