diff --git a/classes/Address.php b/classes/Address.php
index 1c2f0eb56..c8051e0a5 100644
--- a/classes/Address.php
+++ b/classes/Address.php
@@ -325,7 +325,7 @@ class AddressCore extends ObjectModel
$address = new Address((int)$id_address);
if (!Validate::isLoadedObject($address))
- throw new PrestashopException('Invalid address');
+ throw new PrestaShopException('Invalid address');
}
return $address;
diff --git a/classes/AdminController.php b/classes/AdminController.php
index 63b9122ea..62950bed6 100644
--- a/classes/AdminController.php
+++ b/classes/AdminController.php
@@ -1941,7 +1941,7 @@ class AdminControllerCore extends Controller
}
if (!Validate::isTableOrIdentifier($this->table))
- throw new PrestashopException(sprintf('Table name %s is invalid:', $this->table));
+ throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table));
if (empty($order_by))
$order_by = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
@@ -1955,7 +1955,7 @@ class AdminControllerCore extends Controller
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)
|| !is_numeric($start) || !is_numeric($limit)
|| !Validate::isUnsignedId($id_lang))
- throw new PrestashopException('get list params is not valid');
+ throw new PrestaShopException('get list params is not valid');
/* Determine offset from current page */
if ((isset($_POST['submitFilter'.$this->table]) ||
diff --git a/classes/Category.php b/classes/Category.php
index ca5eb0797..a6262d294 100644
--- a/classes/Category.php
+++ b/classes/Category.php
@@ -162,7 +162,7 @@ class CategoryCore extends ObjectModel
public function update($nullValues = false)
{
if ($this->id_parent == $this->id)
- throw new PrestashopException('a category cannot be it\'s own parent');
+ throw new PrestaShopException('a category cannot be it\'s own parent');
// Update group selection
$this->updateGroup($this->groupBox);
$this->level_depth = $this->calcLevelDepth();
@@ -395,7 +395,7 @@ class CategoryCore extends ObjectModel
public function recalculateLevelDepth($id_category)
{
if (!is_numeric($id_category))
- throw new PrestashopException('id category is not numeric');
+ throw new PrestaShopException('id category is not numeric');
/* Gets all children */
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT id_category, id_parent, level_depth
diff --git a/classes/Configuration.php b/classes/Configuration.php
index d65dcb951..ab771dedc 100644
--- a/classes/Configuration.php
+++ b/classes/Configuration.php
@@ -188,7 +188,7 @@ class ConfigurationCore extends ObjectModel
static public function getMultiple($keys, $langID = NULL, $shopGroupID = NULL, $shopID = NULL)
{
if (!is_array($keys))
- throw new PrestashopException('keys var is not an array');
+ throw new PrestaShopException('keys var is not an array');
$langID = (int)$langID;
self::getShopFromContext($shopGroupID, $shopID);
diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php
index 815a4d071..98f8c8d96 100644
--- a/classes/Dispatcher.php
+++ b/classes/Dispatcher.php
@@ -342,7 +342,7 @@ class DispatcherCore
{
Controller::getController($controller_class)->run();
}
- catch (PrestashopException $e)
+ catch (PrestaShopException $e)
{
$e->displayMessage();
}
diff --git a/classes/Hook.php b/classes/Hook.php
index af252ae39..484613e50 100644
--- a/classes/Hook.php
+++ b/classes/Hook.php
@@ -105,7 +105,7 @@ class HookCore extends ObjectModel
public static function getIdByName($hook_name)
{
if (!Validate::isHookName($hook_name))
- throw new PrestashopException('Invalid hook name');
+ throw new PrestaShopException('Invalid hook name');
$cache_id = 'hook_idbyname_'.$hook_name;
if (!Cache::isStored($cache_id))
@@ -321,7 +321,7 @@ class HookCore extends ObjectModel
// Check arguments validity
$context = Context::getContext();
if (($id_module && !Validate::isUnsignedId($id_module)) || !Validate::isHookName($hook_name))
- throw new PrestashopException('Invalid id_module or hook_name');
+ throw new PrestaShopException('Invalid id_module or hook_name');
// Check if hook exists
if (!$id_hook = Hook::getIdByName($hook_name))
diff --git a/classes/Link.php b/classes/Link.php
index 43dd6761f..f20279343 100644
--- a/classes/Link.php
+++ b/classes/Link.php
@@ -91,7 +91,7 @@ class LinkCore
else if(is_numeric($product))
$product = new Product((int)$product, false, $id_lang);
else
- throw new PrestashopException('Invalid product vars');
+ throw new PrestaShopException('Invalid product vars');
}
// Set available keywords
diff --git a/classes/Module.php b/classes/Module.php
index 99d246160..79fa490f3 100644
--- a/classes/Module.php
+++ b/classes/Module.php
@@ -584,7 +584,7 @@ abstract class ModuleCore
{
// Check hook name validation and if module is installed
if (!Validate::isHookName($hook_name))
- throw new PrestashopException('Invalid hook name');
+ throw new PrestaShopException('Invalid hook name');
if (!isset($this->id) || !is_numeric($this->id))
return false;
@@ -1073,7 +1073,7 @@ abstract class ModuleCore
if (is_dir(_PS_MODULE_DIR_.$name) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php'))
{
if (!Validate::isModuleName($name))
- throw new PrestashopException(sprintf('Module %s is not a valid module name', $name));
+ throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name));
$moduleList[] = $name;
}
}
diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php
index dc94b518b..4acfac74d 100644
--- a/classes/ObjectModel.php
+++ b/classes/ObjectModel.php
@@ -165,7 +165,7 @@ abstract class ObjectModelCore
$this->id_shop = Context::getContext()->shop->getID(true);
if (!Validate::isTableOrIdentifier($this->def['primary']) || !Validate::isTableOrIdentifier($this->def['table']))
- throw new PrestashopException('Identifier or table format not valid for class '.get_class($this));
+ throw new PrestaShopException('Identifier or table format not valid for class '.get_class($this));
if ($id)
{
@@ -403,7 +403,7 @@ abstract class ObjectModelCore
{
foreach (array_keys($field) AS $key)
if (!Validate::isTableOrIdentifier($key))
- throw new PrestashopException('key '.$key.' is not table or identifier, ');
+ throw new PrestaShopException('key '.$key.' is not table or identifier, ');
$field[$this->def['primary']] = (int)$this->id;
if (isset($assos[$this->def['table'].'_lang']) && $assos[$this->def['table'].'_lang']['type'] == 'fk_shop')
@@ -470,7 +470,7 @@ abstract class ObjectModelCore
{
foreach (array_keys($field) as $key)
if (!Validate::isTableOrIdentifier($key))
- throw new PrestashopException('key '.$key.' is not a valid table or identifier');
+ throw new PrestaShopException('key '.$key.' is not a valid table or identifier');
// If this table is linked to multishop system, update / insert for all shops from context
if ($this->isLangMultishop())
@@ -570,7 +570,7 @@ abstract class ObjectModelCore
{
// Object must have a variable called 'active'
if (!array_key_exists('active', $this))
- throw new PrestashopException('property "active is missing in object '.get_class($this));
+ throw new PrestaShopException('property "active is missing in object '.get_class($this));
// Update active status on object
$this->active = !(int)$this->active;
@@ -620,7 +620,7 @@ abstract class ObjectModelCore
/* Check fields validity */
if (!Validate::isTableOrIdentifier($fieldName))
- throw new PrestashopException('identifier is not table or identifier : '.$fieldName);
+ throw new PrestaShopException('identifier is not table or identifier : '.$fieldName);
/* Copy the field, or the default language field if it's both required and empty */
if ((!$this->id_lang && isset($this->{$fieldName}[$id_language]) && !empty($this->{$fieldName}[$id_language]))
@@ -651,7 +651,7 @@ abstract class ObjectModelCore
if ($message !== true)
{
if ($die)
- throw new PrestashopException($message);
+ throw new PrestaShopException($message);
return $error_return ? $message : false;
}
}
@@ -683,7 +683,7 @@ abstract class ObjectModelCore
if ($message !== true)
{
if ($die)
- throw new PrestashopException($message);
+ throw new PrestaShopException($message);
return $error_return ? $message : false;
}
}
@@ -728,7 +728,7 @@ abstract class ObjectModelCore
if (!empty($data['validate']))
{
if (!method_exists('Validate', $data['validate']))
- throw new PrestashopException('Validation function not found. '.$data['validate']);
+ throw new PrestaShopException('Validation function not found. '.$data['validate']);
if (!empty($value) && !call_user_func(array('Validate', $data['validate']), $value))
return 'Property '.get_class($this).'->'.$field.' is not valid';
@@ -1164,7 +1164,7 @@ abstract class ObjectModelCore
public static function hydrateCollection($class, array $datas, $id_lang = null)
{
if (!class_exists($class))
- throw new PrestashopException("Class '$class' not found");
+ throw new PrestaShopException("Class '$class' not found");
$collection = array();
$rows = array();
@@ -1172,7 +1172,7 @@ abstract class ObjectModelCore
{
$definition = ObjectModel::getDefinition($class);
if (!array_key_exists($definition['primary'], $datas[0]))
- throw new PrestashopException("Identifier '{$definition['primary']}' not found for class '$class'");
+ throw new PrestaShopException("Identifier '{$definition['primary']}' not found for class '$class'");
foreach ($datas as $row)
{
@@ -1203,10 +1203,25 @@ abstract class ObjectModelCore
return $collection;
}
+ /**
+ * Get object definition
+ *
+ * @param string $class Name of object
+ * @param string $field Name of field if we want the definition of one field only
+ * @return array
+ */
public static function getDefinition($class, $field = null)
{
$reflection = new ReflectionClass($class);
$definition = $reflection->getStaticPropertyValue('definition');
+ $definition['classname'] = $class;
+ if (!empty($definition['multilang']))
+ $definition['associations'][Collection::LANG_ALIAS] = array(
+ 'type' => self::HAS_MANY,
+ 'field' => $definition['primary'],
+ 'foreign_field' => $definition['primary'],
+ );
+
if ($field)
return isset($definition['fields'][$field]) ? $definition['fields'][$field] : null;
return $definition;
@@ -1263,18 +1278,13 @@ abstract class ObjectModelCore
}
}
- public function getEntity($entity)
- {
-
- }
-
/**
* Return the field value for the specified language if the field is multilang, else the field value.
*
* @param $field_name
* @param null $id_lang
* @return mixed
- * @throws PrestashopException
+ * @throws PrestaShopException
* @since 1.5
*/
public function getFieldByLang($field_name, $id_lang = null)
@@ -1293,6 +1303,6 @@ abstract class ObjectModelCore
return $this->{$field_name};
}
else
- throw new PrestashopException('Could not load field from definition.');
+ throw new PrestaShopException('Could not load field from definition.');
}
}
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 5e9f2e6ff..419e35e4e 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -132,7 +132,7 @@ abstract class PaymentModuleCore extends Module
$order_status = new OrderState((int)$id_order_state, (int)$cart->id_lang);
if (!Validate::isLoadedObject($order_status))
- throw new PrestashopException('Can\'t load Order state status');
+ throw new PrestaShopException('Can\'t load Order state status');
foreach ($cart_delivery_option as $id_address => $key_carriers)
foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data)
@@ -202,7 +202,7 @@ abstract class PaymentModuleCore extends Module
if ($result && $order_status->logable)
{
if (!$order->addOrderPayment($amountPaid))
- throw new PrestashopException('Can\'t save Order Payment');
+ throw new PrestaShopException('Can\'t save Order Payment');
}
$order_list[] = $order;
diff --git a/classes/Tools.php b/classes/Tools.php
index ecac79b73..8c6b60e2d 100644
--- a/classes/Tools.php
+++ b/classes/Tools.php
@@ -576,7 +576,7 @@ class ToolsCore
return '';
if (!Validate::isDate($date) || !Validate::isBool($full))
- throw new PrestashopException('Invalid date');
+ throw new PrestaShopException('Invalid date');
$context = Context::getContext();
$date_format = ($full ? $context->language->date_format_full : $context->language->date_format_lite);
diff --git a/classes/db/Db.php b/classes/db/Db.php
index 2d3bfe795..e7ab279d4 100644
--- a/classes/db/Db.php
+++ b/classes/db/Db.php
@@ -281,7 +281,7 @@ abstract class DbCore
{
// Check if row array mapping are the same
if (!in_array("`$key`", $keys))
- throw new PrestashopDatabaseException('Keys form $data subarray don\'t match');
+ throw new PrestaShopDatabaseException('Keys form $data subarray don\'t match');
}
else
$keys[] = "`$key`";
@@ -323,7 +323,7 @@ abstract class DbCore
return (bool)$this->q($sql, $use_cache);
}
else
- throw new PrestashopDatabaseException('Wrong argument (miss type) in Db::autoExecute()');
+ throw new PrestaShopDatabaseException('Wrong argument (miss type) in Db::autoExecute()');
return false;
}
@@ -414,7 +414,7 @@ abstract class DbCore
if (!preg_match('#^\s*(select|show|explain|describe)\s#i', $sql))
{
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_)
- throw new PrestashopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
+ throw new PrestaShopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
return $this->execute($sql, $use_cache);
}
@@ -546,8 +546,8 @@ abstract class DbCore
else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
{
if ($sql)
- throw new PrestashopDatabaseException($this->getMsgError().'
'.$sql.''); - throw new PrestashopDatabaseException($this->getMsgError()); + throw new PrestaShopDatabaseException($this->getMsgError().'
'.$sql.''); + throw new PrestaShopDatabaseException($this->getMsgError()); } } diff --git a/classes/db/DbMySQLi.php b/classes/db/DbMySQLi.php index d0765939c..b4a7c145d 100644 --- a/classes/db/DbMySQLi.php +++ b/classes/db/DbMySQLi.php @@ -39,11 +39,11 @@ class DbMySQLiCore extends Db // Do not use object way for error because this work bad before PHP 5.2.9 if (mysqli_connect_error()) - throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error())); + throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error())); // UTF-8 support if (!$this->link->query('SET NAMES \'utf8\'')) - throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); + throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); return $this->link; } diff --git a/classes/db/DbPDO.php b/classes/db/DbPDO.php index 96f8fc0dc..4444fc060 100644 --- a/classes/db/DbPDO.php +++ b/classes/db/DbPDO.php @@ -43,12 +43,12 @@ class DbPDOCore extends Db } catch (PDOException $e) { - throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')')); + throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')')); } // UTF-8 support if ($this->link->exec('SET NAMES \'utf8\'') === false) - throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); + throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); return $this->link; } diff --git a/classes/db/MySQL.php b/classes/db/MySQL.php index 809048413..2dfc74998 100644 --- a/classes/db/MySQL.php +++ b/classes/db/MySQL.php @@ -36,14 +36,14 @@ class MySQLCore extends Db define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string')); if (!$this->link = mysql_connect($this->server, $this->user, $this->password)) - throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established.')); + throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established.')); if (!$this->set_db($this->database)) - throw new PrestashopDatabaseException(Tools::displayError('The database selection cannot be made.')); + throw new PrestaShopDatabaseException(Tools::displayError('The database selection cannot be made.')); // UTF-8 support if (!mysql_query('SET NAMES \'utf8\'', $this->link)) - throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); + throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.')); return $this->link; } diff --git a/classes/exception/PrestaShopDatabaseException.php b/classes/exception/PrestaShopDatabaseException.php index bb849dae3..6ac568793 100644 --- a/classes/exception/PrestaShopDatabaseException.php +++ b/classes/exception/PrestaShopDatabaseException.php @@ -28,7 +28,7 @@ /** * @since 1.5.0 */ -class PrestashopDatabaseExceptionCore extends PrestashopException +class PrestaShopDatabaseExceptionCore extends PrestaShopException { } diff --git a/classes/exception/PrestaShopException.php b/classes/exception/PrestaShopException.php index bc7bcb30f..0822101cb 100644 --- a/classes/exception/PrestaShopException.php +++ b/classes/exception/PrestaShopException.php @@ -28,7 +28,7 @@ /** * @since 1.5.0 */ -class PrestashopExceptionCore extends Exception +class PrestaShopExceptionCore extends Exception { /** * This method acts like an error handler, if dev mode is on, display the error else use a better silent way diff --git a/classes/exception/PrestaShopModuleException.php b/classes/exception/PrestaShopModuleException.php index bc326c89b..b31371144 100644 --- a/classes/exception/PrestaShopModuleException.php +++ b/classes/exception/PrestaShopModuleException.php @@ -28,7 +28,7 @@ /** * @since 1.5.0 */ -class PrestashopModuleExceptionCore extends PrestashopException +class PrestaShopModuleExceptionCore extends PrestaShopException { } diff --git a/classes/exception/PrestaShopPaymentException.php b/classes/exception/PrestaShopPaymentException.php index 176c776c1..d9e3e44f8 100644 --- a/classes/exception/PrestaShopPaymentException.php +++ b/classes/exception/PrestaShopPaymentException.php @@ -28,7 +28,7 @@ /** * @since 1.5.0 */ -class PrestashopPaymentExceptionCore extends PrestashopException +class PrestaShopPaymentExceptionCore extends PrestaShopException { } diff --git a/classes/order/Order.php b/classes/order/Order.php index d81287be6..247901a9c 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1131,7 +1131,7 @@ class OrderCore extends ObjectModel { $number = (int)Configuration::get('PS_DELIVERY_NUMBER'); if (!$number) - throw new PrestashopException('Invalid delivery number'); + throw new PrestaShopException('Invalid delivery number'); // Set delivery number on invoice $order_invoice->delivery_number = $number; diff --git a/classes/order/OrderInvoice.php b/classes/order/OrderInvoice.php index 96231df74..e60ef5e87 100644 --- a/classes/order/OrderInvoice.php +++ b/classes/order/OrderInvoice.php @@ -514,7 +514,7 @@ class OrderInvoiceCore extends ObjectModel { $order_invoice = new OrderInvoice($id); if (!Validate::isLoadedObject($order_invoice)) - throw new PrestashopException('Can\'t load Order Invoice object for id: '.$id); + throw new PrestaShopException('Can\'t load Order Invoice object for id: '.$id); return $order_invoice; } diff --git a/classes/pdf/PDF.php b/classes/pdf/PDF.php index eb5b4d6fb..a78fd9e4d 100755 --- a/classes/pdf/PDF.php +++ b/classes/pdf/PDF.php @@ -93,7 +93,7 @@ class PDFCore { $class = new $classname($object, $this->smarty); if (!($class instanceof HTMLTemplate)) - throw new PrestashopException('Invalid class. It should be an instance of HTMLTemplate'); + throw new PrestaShopException('Invalid class. It should be an instance of HTMLTemplate'); } return $class; diff --git a/classes/pdf/PDFGenerator.php b/classes/pdf/PDFGenerator.php index a77c50fe1..08cde5a29 100755 --- a/classes/pdf/PDFGenerator.php +++ b/classes/pdf/PDFGenerator.php @@ -122,12 +122,12 @@ class PDFGeneratorCore extends TCPDF * * @param string $filename * @param boolean $inline - * @throws PrestashopException + * @throws PrestaShopException */ public function render($filename, $display = true) { if (empty($filename)) - throw new PrestashopException('Missing filename.'); + throw new PrestaShopException('Missing filename.'); $this->lastPage(); diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 08900b8b1..f24f34c87 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -283,7 +283,7 @@ class ShopCore extends ObjectModel $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); // Hmm there is something really bad in your Prestashop ! if (!Validate::isLoadedObject($default_shop)) - throw new PrestashopException('Shop not found'); + throw new PrestaShopException('Shop not found'); $url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING']; header('location: '.$url); @@ -294,7 +294,7 @@ class ShopCore extends ObjectModel if (defined('INSTALL_VERSION')) $shop = new Shop(); else - throw new PrestashopException('Shop not found'); + throw new PrestaShopException('Shop not found'); return $shop; } diff --git a/config/smartyadmin.config.inc.php b/config/smartyadmin.config.inc.php index 7d0059789..4dda2bef1 100644 --- a/config/smartyadmin.config.inc.php +++ b/config/smartyadmin.config.inc.php @@ -39,7 +39,7 @@ function smartyTranslate($params, &$smarty) global $_LANGPDF; $iso = Context::getContext()->language->iso_code; if (!Validate::isLanguageIsoCode($iso)) - throw PrestashopException('Invalid iso lang!'); + throw PrestaShopException('Invalid iso lang!'); $translationsFile = _PS_THEME_DIR_.'pdf/lang/'.$iso.'.php'; diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 38921d60d..a1d3b828e 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -112,13 +112,13 @@ class AdminAccessControllerCore extends AdminController public function ajaxProcessUpdateAccess() { if ($this->tabAccess['edit'] != '1') - throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); + throw new PrestaShopException(Tools::displayError('You do not have permission to edit here.')); if (Tools::isSubmit('submitAddAccess')) { $perm = Tools::getValue('perm'); if (!in_array($perm, array('view', 'add', 'edit', 'delete', 'all'))) - throw new PrestashopException('permission not exists'); + throw new PrestaShopException('permission not exists'); $enabled = (int)Tools::getValue('enabled'); $id_tab = (int)Tools::getValue('id_tab'); @@ -165,7 +165,7 @@ class AdminAccessControllerCore extends AdminController public function ajaxProcessUpdateModuleAccess() { if ($this->tabAccess['edit'] != '1') - throw new PrestashopException(Tools::displayError('You do not have permission to edit here.')); + throw new PrestaShopException(Tools::displayError('You do not have permission to edit here.')); /* Update Access Modules */ if (Tools::isSubmit('changeModuleAccess')) @@ -177,7 +177,7 @@ class AdminAccessControllerCore extends AdminController $res = true; if (!in_array($perm, array('view', 'configure'))) - throw new PrestashopException('permission not exists'); + throw new PrestaShopException('permission not exists'); if ($id_module == -1) { diff --git a/controllers/admin/AdminCatalogController.php b/controllers/admin/AdminCatalogController.php index 1a4284486..b22e17f0f 100644 --- a/controllers/admin/AdminCatalogController.php +++ b/controllers/admin/AdminCatalogController.php @@ -67,7 +67,7 @@ class AdminCatalogControllerCore extends AdminController } self::$_category = new Category($id_category); if (!Validate::isLoadedObject(self::$_category)) - throw new PrestashopException('Category cannot be loaded'); + throw new PrestaShopException('Category cannot be loaded'); $this->table = array('category', 'product'); // $this->adminCategories = new AdminCategories(); diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 0f5bd2c4e..f75b0dd44 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -560,7 +560,7 @@ class AdminModulesControllerCore extends AdminController // We check if method of module exists if (!method_exists($module, $method)) - throw new PrestashopException('Method of module can\'t be found'); + throw new PrestaShopException('Method of module can\'t be found'); // Get the return value of current method $echo = $module->{$method}(); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b58dd447f..eaedb8813 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -195,9 +195,9 @@ class AdminOrdersControllerCore extends AdminController $customer = new Customer((int)$order->id_customer); $carrier = new Carrier((int)$order->id_carrier); if (!Validate::isLoadedObject($customer)) - throw new PrestashopException('Can\'t load Customer object'); + throw new PrestaShopException('Can\'t load Customer object'); if (!Validate::isLoadedObject($carrier)) - throw new PrestashopException('Can\'t load Carrier object'); + throw new PrestaShopException('Can\'t load Carrier object'); $templateVars = array( '{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, @@ -644,14 +644,14 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('Con\'t load Order object'); + throw new PrestaShopException('Con\'t load Order object'); if (Tools::getValue('new_currency') != $order->id_currency && !$order->valid) { $old_currency = new Currency($order->id_currency); $currency = new Currency(Tools::getValue('new_currency')); if (!Validate::isLoadedObject($currency)) - throw new PrestashopException('Can\'t load Currency object'); + throw new PrestaShopException('Can\'t load Currency object'); // Update order detail amount foreach($order->getOrderDetailList() as $row) @@ -718,7 +718,7 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('Order can\'t be loaded'); + throw new PrestaShopException('Order can\'t be loaded'); if ($order->hasInvoice()) $this->_errors[] = Tools::displayError('This order has already invoice'); @@ -740,7 +740,7 @@ class AdminOrdersControllerCore extends AdminController { $order_invoice = new OrderInvoice($order_cart_rule->id_order_invoice); if (!ValidateCore::isLoadedObject($order_invoice)) - throw new PrestashopException('Can\'t load Order Invoice object'); + throw new PrestaShopException('Can\'t load Order Invoice object'); // Update amounts of Order Invoice $order_invoice->total_discount_tax_excl -= $order_cart_rule->value_tax_excl; @@ -783,7 +783,7 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('Can\'t load Order object'); + throw new PrestaShopException('Can\'t load Order object'); if ($order->hasInvoice()) { @@ -792,7 +792,7 @@ class AdminOrdersControllerCore extends AdminController { $order_invoice = new OrderInvoice(Tools::getValue('discount_invoice')); if (!Validate::isLoadedObject($order_invoice)) - throw new PrestashopException('Can\'t load Order Invoice object'); + throw new PrestaShopException('Can\'t load Order Invoice object'); } } @@ -947,7 +947,7 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('object can\'t be loaded'); + throw new PrestaShopException('object can\'t be loaded'); $customer = new Customer($order->id_customer); $carrier = new Carrier($order->id_carrier); diff --git a/controllers/admin/AdminOutstandingController.php b/controllers/admin/AdminOutstandingController.php index bca131ca1..5838c9403 100644 --- a/controllers/admin/AdminOutstandingController.php +++ b/controllers/admin/AdminOutstandingController.php @@ -142,29 +142,29 @@ class AdminOutstandingControllerCore extends AdminController { $order_invoice = new OrderInvoice($id_invoice); if (!Validate::isLoadedObject($order_invoice)) - throw new PrestashopException('object OrderInvoice can\'t be loaded'); + throw new PrestaShopException('object OrderInvoice can\'t be loaded'); $order = new Order($order_invoice->id_order); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('object Order can\'t be loaded'); + throw new PrestaShopException('object Order can\'t be loaded'); $customer = new Customer((int)$order->id_customer); if (!Validate::isLoadedObject($order_invoice)) - throw new PrestashopException('object Customer can\'t be loaded'); + throw new PrestaShopException('object Customer can\'t be loaded'); return ''.$customer->getOutstanding().''; } /** * View render - * @throws PrestashopException Invalid objects + * @throws PrestaShopException Invalid objects */ public function renderView() { $order_invoice = new OrderInvoice((int) Tools::getValue('id_order_invoice')); if (!Validate::isLoadedObject($order_invoice)) - throw new PrestashopException('object OrderInvoice can\'t be loaded'); + throw new PrestaShopException('object OrderInvoice can\'t be loaded'); $order = new Order($order_invoice->id_order); if (!Validate::isLoadedObject($order)) - throw new PrestashopException('object Order can\'t be loaded'); + throw new PrestaShopException('object Order can\'t be loaded'); $link = $this->context->link->getAdminLink('AdminOrders'); $link .= '&vieworder&id_order='.$order->id; diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 28fefe8ef..c558cee79 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2153,7 +2153,7 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['product'] = $this->object; if ($this->ajax) if (!isset($this->tpl_form_vars['custom_form'])) - throw new PrestashopException('custom_form empty for action '.$this->tab_display); + throw new PrestaShopException('custom_form empty for action '.$this->tab_display); else return $this->tpl_form_vars['custom_form']; } diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index b2f90481b..ee6e9e5b5 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -758,10 +758,10 @@ class AdminTranslationsControllerCore extends AdminController ${$var} = array(); if (!file_exists($dir)) if (!mkdir($dir, 0700)) - throw new PrestashopException('Directory '.$dir.' cannot be created.'); + throw new PrestaShopException('Directory '.$dir.' cannot be created.'); if (!file_exists($dir.DIRECTORY_SEPARATOR.$file)) if (!file_put_contents($dir.'/'.$file, "")) - throw new PrestashopException('File "'.$file.'" doesn\'t exists and cannot be created in '.$dir); + throw new PrestaShopException('File "'.$file.'" doesn\'t exists and cannot be created in '.$dir); if (!is_writable($dir.DIRECTORY_SEPARATOR.$file)) $this->displayWarning(Tools::displayError('This file must be writable:').' '.$dir.'/'.$file); include($dir.DIRECTORY_SEPARATOR.$file); diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index fdb8318e8..115377160 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -131,7 +131,7 @@ class AddressControllerCore extends FrontController // Check country if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country)) - throw new PrestashopException('Country cannot be loaded with address->id_country'); + throw new PrestaShopException('Country cannot be loaded with address->id_country'); if ((int)$country->contains_states && !(int)$address->id_state) $this->errors[] = Tools::displayError('This country requires a state selection.'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index f6bad4398..da87275d7 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -227,15 +227,15 @@ class OrderOpcControllerCore extends ParentOrderController die(); break; default: - throw new PrestashopException('Unknown method "'.Tools::getValue('method').'"'); + throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"'); } } else - throw new PrestashopException('Method is not defined'); + throw new PrestaShopException('Method is not defined'); } } elseif (Tools::isSubmit('ajax')) - throw new PrestashopException('Method is not defined'); + throw new PrestaShopException('Method is not defined'); } public function setMedia() diff --git a/install-new/classes/exception.php b/install-new/classes/exception.php index 5776fc398..111b86853 100644 --- a/install-new/classes/exception.php +++ b/install-new/classes/exception.php @@ -25,6 +25,6 @@ * International Registered Trademark & Property of PrestaShop SA */ -class PrestashopInstallerException extends PrestashopException +class PrestashopInstallerException extends PrestaShopException { } diff --git a/modules/themeinstallator/themeinstallator.php b/modules/themeinstallator/themeinstallator.php index 8da924900..de60a2637 100644 --- a/modules/themeinstallator/themeinstallator.php +++ b/modules/themeinstallator/themeinstallator.php @@ -783,7 +783,7 @@ class ThemeInstallator extends Module $id_theme = (int)Tools::getValue('id_theme'); $theme = new Theme($id_theme); if (!$theme->id) - throw new PrestashopException('Unable to load theme'); + throw new PrestaShopException('Unable to load theme'); $this->_html .= ''; if ($this->error === false AND class_exists('ZipArchive', false) AND ($zip = new ZipArchive()))