From daa8c7f8c9e2fbb7a64bb4431ff0f7e358ab3180 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Tue, 20 Dec 2011 14:06:57 +0000 Subject: [PATCH] // 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 --- classes/Tools.php | 5 ++++- controllers/admin/AdminProductsController.php | 4 ++-- controllers/admin/AdminTranslationsController.php | 8 ++++---- controllers/front/GuestTrackingController.php | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 0923a0b89..c0f0cfd44 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -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') diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index e75af17db..494c88196 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -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'); } diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 8374915f0..93266de29 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -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, diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index e001d6188..6072413eb 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -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);