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

This commit is contained in:
mDeflotte
2011-12-20 14:06:57 +00:00
parent e33326c990
commit 5b661db25d
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)
{
global $_ERRORS;
if (is_null($context))
$context = Context::getContext();
@include_once(_PS_TRANSLATIONS_DIR_.$context->language->iso_code.'/errors.php');
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_.'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)
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 (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']))))
$this->_errors[] = Tools::displayError('Invalid Name');
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']))))
$this->_errors[] = Tools::displayError('Invalid description');
}
@@ -1100,7 +1100,7 @@ class AdminTranslationsControllerCore extends AdminController
'limit_warning' => $this->displayLimitPostWarning($count),
'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token,
'auto_translate' => $this->displayAutoTranslate(),
'auto_translate' => '',
'type' => 'errors',
'errorsArray' => $stringToTranslate
);
@@ -1163,7 +1163,7 @@ class AdminTranslationsControllerCore extends AdminController
'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(),
'auto_translate' => '',
'tabsArray' => $tabs_array,
'missing_translations' => $missing_translations,
'textarea_sized' => TEXTAREA_SIZED,
@@ -1512,7 +1512,7 @@ class AdminTranslationsControllerCore extends AdminController
'suoshin_exceeded' => $this->suhosin_limit_exceed,
'url_submit' => self::$currentIndex.'&submitTranslationsMails=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(),
'auto_translate' => '',
'type' => 'mails',
'tinyMCE' => $this->getTinyMCEForMails($obj_lang->iso_code),
'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,
'url_submit' => self::$currentIndex.'&submitTranslationsPdf=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(),
'auto_translate' => '',
'textarea_sized' => TEXTAREA_SIZED,
'type' => 'pdf',
'tabsArray' => $tabs_array,
@@ -69,7 +69,7 @@ class GuestTrackingControllerCore extends FrontController
else if (!Validate::isLoadedObject($order))
$this->errors[] = Tools::displayError('Invalid Order ID');
else if (!$order->isAssociatedAtGuest($email))
$this->errors[] = Tools::displayError('123');
$this->errors[] = Tools::displayError('Invalid order ID');
else
{
$this->assignOrderTracking($order);