// Fix PrestaShopException typo

This commit is contained in:
rMalie
2012-01-04 13:53:19 +00:00
parent 1ad456ad41
commit 4b17d64cf7
36 changed files with 96 additions and 86 deletions
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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]) ||
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -342,7 +342,7 @@ class DispatcherCore
{
Controller::getController($controller_class)->run();
}
catch (PrestashopException $e)
catch (PrestaShopException $e)
{
$e->displayMessage();
}
+2 -2
View File
@@ -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))
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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;
}
}
+27 -17
View File
@@ -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.');
}
}
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
+5 -5
View File
@@ -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().'<br /><br /><pre>'.$sql.'</pre>');
throw new PrestashopDatabaseException($this->getMsgError());
throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
throw new PrestaShopDatabaseException($this->getMsgError());
}
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopDatabaseExceptionCore extends PrestashopException
class PrestaShopDatabaseExceptionCore extends PrestaShopException
{
}
+1 -1
View File
@@ -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
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopModuleExceptionCore extends PrestashopException
class PrestaShopModuleExceptionCore extends PrestaShopException
{
}
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopPaymentExceptionCore extends PrestashopException
class PrestaShopPaymentExceptionCore extends PrestaShopException
{
}
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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';
+4 -4
View File
@@ -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)
{
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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}();
+9 -9
View File
@@ -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);
@@ -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 '<b>'.$customer->getOutstanding().'</b>';
}
/**
* 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;
@@ -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'];
}
@@ -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, "<?php\n\nglobal \$".$var.";\n\$".$var." = array();\n\n?>"))
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);
+1 -1
View File
@@ -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.');
+3 -3
View File
@@ -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()
+1 -1
View File
@@ -25,6 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class PrestashopInstallerException extends PrestashopException
class PrestashopInstallerException extends PrestaShopException
{
}
@@ -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 .= '<input type="hidden" name="id_theme" value="'.$id_theme.'" />';
if ($this->error === false AND class_exists('ZipArchive', false) AND ($zip = new ZipArchive()))