// remove 1.4 deprecated functions
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7755 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -276,20 +276,6 @@ class AddressCore extends ObjectModel
|
||||
return isset($result['used']) ? $result['used'] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_address
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getManufacturerIdByAddress($id_address)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `id_manufacturer` FROM `'._DB_PREFIX_.'address`
|
||||
WHERE `id_address` = '.(int)($id_address));
|
||||
return isset($result['id_manufacturer']) ? $result['id_manufacturer'] : false;
|
||||
}
|
||||
|
||||
static public function getCountryAndState($id_address)
|
||||
{
|
||||
if (isset(self::$_idCountries[$id_address]))
|
||||
|
||||
@@ -141,38 +141,6 @@ class CMSCore extends ObjectModel
|
||||
ORDER BY c.`position`');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function isInBlock($id_cms, $id_block)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
Db::getInstance()->getRow('
|
||||
SELECT id_cms FROM '._DB_PREFIX_.'block_cms
|
||||
WHERE id_block = '.(int)($id_block).' AND id_cms = '.(int)($id_cms));
|
||||
|
||||
return (Db::getInstance()->NumRows());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function updateCmsToBlock($cms, $id_block)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'block_cms` WHERE `id_block` = '.(int)($id_block));
|
||||
|
||||
$list = '';
|
||||
foreach ($cms AS $id_cms)
|
||||
$list .= '('.(int)($id_block).', '.(int)($id_cms).'),';
|
||||
$list = rtrim($list, ',');
|
||||
|
||||
if (!empty($list))
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'block_cms (id_block, id_cms) VALUES '.pSQL($list));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
|
||||
@@ -515,27 +515,6 @@ class CMSCategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
|
||||
WHERE `name` LIKE \'%'.pSQL($query).'%\' AND c.`id_cms_category` != 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve CMSCategory by name and parent CMSCategory id
|
||||
*
|
||||
* @param integer $id_lang Language ID
|
||||
* @param string $CMSCategory_name Searched CMSCategory name
|
||||
* @param integer $id_parent_CMSCategory parent CMSCategory ID
|
||||
* @return array Corresponding CMSCategory
|
||||
* @deprecated
|
||||
*/
|
||||
static public function searchByNameAndParentCMSCategoryId($id_lang, $CMSCategory_name, $id_parent_CMSCategory)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
|
||||
WHERE `name` LIKE \''.pSQL($CMSCategory_name).'\'
|
||||
AND c.`id_cms_category` != 1
|
||||
AND c.`id_parent` = '.(int)($id_parent_CMSCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Each parent CMSCategory of this CMSCategory until the root CMSCategory
|
||||
@@ -566,23 +545,6 @@ class CMSCategoryCore extends ObjectModel
|
||||
$idCurrent = $result[0]['id_parent'];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Specify if a CMSCategory already in base
|
||||
*
|
||||
* @param $id_cms_category CMSCategory id
|
||||
* @return boolean
|
||||
* @deprecated
|
||||
*/
|
||||
static public function CMSCategoryExists($id_cms_category)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT `id_cms_category`
|
||||
FROM '._DB_PREFIX_.'cms_category c
|
||||
WHERE c.`id_cms_category` = '.(int)($id_cms_category));
|
||||
|
||||
return isset($row['id_cms_category']);
|
||||
}
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
|
||||
@@ -461,19 +461,6 @@ class CarrierCore extends ObjectModel
|
||||
return $resultsArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_country
|
||||
* @param array $groups
|
||||
* @return Array carriers list
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getCarriersOpc($id_country, $groups = NULL)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
return self::getCarriersForOrder((int)Country::getIdZone((int)($id_country)), $groups);
|
||||
}
|
||||
|
||||
public static function checkCarrierZone($id_carrier, $id_zone)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
@@ -676,19 +663,6 @@ class CarrierCore extends ObjectModel
|
||||
return (int)($row['total']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the price without taxes defined in carrier
|
||||
* @deprecated
|
||||
**/
|
||||
public function getPriceWithoutTaxes($productPrice)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$tax = new Tax($this->id_tax);
|
||||
return round($productPrice - ($productPrice * $tax->rate / 100), 2);
|
||||
}
|
||||
|
||||
|
||||
public function getShippingMethod()
|
||||
{
|
||||
if ($this->is_free)
|
||||
|
||||
@@ -1363,24 +1363,6 @@ class CartCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Discount $discountObj
|
||||
* @return bool
|
||||
* @deprecated
|
||||
*/
|
||||
public function hasProductInCategory($discountObj)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$products = $this->getProducts();
|
||||
$categories = Discount::getCategories($discountObj->id);
|
||||
foreach ($products AS $product)
|
||||
{
|
||||
if (Product::idIsOnCategoryId($product['id_product'], $categories))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return useful informations for cart
|
||||
*
|
||||
@@ -1435,35 +1417,6 @@ class CartCore extends ObjectModel
|
||||
'free_ship' => $total_free_ship);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return carts thats have not been converted in orders
|
||||
*
|
||||
* @param string $dateFrom Select only cart updated after this date
|
||||
* @param string $dateTo Select only cart updated before this date
|
||||
* @return array Carts
|
||||
* @deprecated
|
||||
*/
|
||||
static function getNonOrderedCarts($dateFrom, $dateTo)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
if (!Validate::isDate($dateFrom) OR !Validate::isDate($dateTo))
|
||||
die (Tools::displayError());
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT cart.`id_cart`, cart.`date_upd`, c.`id_customer` AS id_customer, c.`lastname` AS customer_lastname, c.`firstname` AS customer_firstname,
|
||||
SUM(cp.`quantity`) AS nb_products,
|
||||
COUNT(cd.`id_cart`) AS nb_discounts
|
||||
FROM `'._DB_PREFIX_.'cart` cart
|
||||
LEFT JOIN `'._DB_PREFIX_.'cart_product` cp ON cart.`id_cart` = cp.`id_cart`
|
||||
LEFT JOIN `'._DB_PREFIX_.'cart_discount` cd ON cart.`id_cart` = cd.`id_cart`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON cart.`id_customer` = c.`id_customer`
|
||||
WHERE cart.`id_cart` NOT IN (SELECT `id_cart` FROM `'._DB_PREFIX_.'orders`)
|
||||
AND TO_DAYS(cart.`date_upd`) >= TO_DAYS(\''.pSQL(strftime('%Y-%m-%d %H:%M:%S', strtotime($dateFrom))).'\')
|
||||
AND TO_DAYS(cart.`date_upd`) <= TO_DAYS(\''.pSQL(strftime('%Y-%m-%d %H:%M:%S', strtotime($dateTo))).'\')
|
||||
GROUP BY cart.`id_cart`, cp.`id_cart`, cd.`id_cart`
|
||||
ORDER BY cart.`date_upd` DESC');
|
||||
}
|
||||
|
||||
public function checkQuantities()
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
@@ -1625,14 +1578,6 @@ class CartCore extends ObjectModel
|
||||
return ($echo == '0' ? Configuration::get('PS_SHOP_NAME') : $echo);
|
||||
}
|
||||
|
||||
/* DEPRECATED */
|
||||
public function getCustomeremail()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$customer = new Customer((int)($this->id_customer));
|
||||
return $customer->email;
|
||||
}
|
||||
|
||||
public function duplicate()
|
||||
{
|
||||
if (!Validate::isLoadedObject($this))
|
||||
|
||||
@@ -542,18 +542,6 @@ class CategoryCore extends ObjectModel
|
||||
return Product::getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide category prefix used for position
|
||||
*
|
||||
* @param string $name Category name
|
||||
* @return string Name without position
|
||||
*/
|
||||
static public function hideCategoryPosition($name)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_replace('/^[0-9]+\./', '', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return main categories
|
||||
*
|
||||
|
||||
@@ -474,21 +474,4 @@ class ConfigurationCore extends ObjectModel
|
||||
';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get several configuration values (in multiple languages)
|
||||
*
|
||||
* @param array $keys Keys wanted
|
||||
* @return array Values in multiple languages
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getMultipleInt($keys)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$languages = Language::getLanguages();
|
||||
$resultsArray = array();
|
||||
foreach($languages as $language)
|
||||
$resultsArray[$language['id_lang']] = self::getMultiple($keys, $language['id_lang']);
|
||||
return $resultsArray;
|
||||
}
|
||||
}
|
||||
+1
-12
@@ -241,17 +241,6 @@ class CountryCore extends ObjectModel
|
||||
return ((int)($result['id_country']));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id_country
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getNeedIdentifcationNumber($id_country)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return self::isNeedDniByCountryId($id_country);
|
||||
}
|
||||
|
||||
static public function getNeedZipCode($id_country)
|
||||
{
|
||||
if (!(int)($id_country))
|
||||
@@ -282,7 +271,7 @@ class CountryCore extends ObjectModel
|
||||
/**
|
||||
* Returns the default country Id
|
||||
*
|
||||
* @deprecated use $context->country->id instead
|
||||
* @deprecated as of 1.5 use $context->country->id instead
|
||||
* @return integer default country id
|
||||
*/
|
||||
public static function getDefaultCountryId()
|
||||
|
||||
+1
-19
@@ -310,24 +310,6 @@ class CurrencyCore extends ObjectModel
|
||||
$this->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
**/
|
||||
static public function refreshCurrenciesGetDefault($data, $isoCodeSource, $idCurrency)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$defaultCurrency = new Currency($idCurrency);
|
||||
|
||||
/* Change defaultCurrency rate if not as currency of feed source */
|
||||
if ($defaultCurrency->iso_code != $isoCodeSource)
|
||||
foreach ($data->currency AS $obj)
|
||||
if ($defaultCurrency->iso_code == strval($obj['iso_code']))
|
||||
$defaultCurrency->conversion_rate = round((float)($obj['rate']), 6);
|
||||
|
||||
return $defaultCurrency;
|
||||
}
|
||||
|
||||
public static function getDefaultCurrency()
|
||||
{
|
||||
$id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
@@ -358,7 +340,7 @@ class CurrencyCore extends ObjectModel
|
||||
/**
|
||||
* Get current currency
|
||||
*
|
||||
* @deprecated use $context->currency instead
|
||||
* @deprecated as of 1.5 use $context->currency instead
|
||||
* @return Currency
|
||||
*/
|
||||
static public function getCurrent()
|
||||
|
||||
@@ -299,25 +299,6 @@ class CustomerCore extends ObjectModel
|
||||
return isset($result['id_customer']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if, except current customer, someone else registered this e-email
|
||||
*
|
||||
* @return integer Number of customers who have also this e-mail
|
||||
* @deprecated
|
||||
*/
|
||||
public function cantChangeemail()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
if (!Validate::isEmail($this->email))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(`id_customer`) AS total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = \''.pSQL($this->email).'\' AND `id_customer` != '.(int)($this->id));
|
||||
|
||||
return $result['total'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an address is owned by a customer
|
||||
*
|
||||
@@ -362,26 +343,6 @@ class CustomerCore extends ObjectModel
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns customer last connections
|
||||
*
|
||||
* @deprecated
|
||||
* @param integer $nb Number of connections wanted
|
||||
* @return array Connections
|
||||
*/
|
||||
public function getConnections($nb = 10)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT `ip_address`, `date_add`
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE `id_guest` IN (SELECT `id_guest` FROM `'._DB_PREFIX_.'guest` WHERE `id_customer` = '.(int)($this->id).')
|
||||
ORDER BY `date_add` DESC
|
||||
LIMIT 0,'.(int)($nb));
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of addresses for a customer
|
||||
*
|
||||
@@ -415,41 +376,6 @@ class CustomerCore extends ObjectModel
|
||||
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return customers who have subscribed to the newsletter
|
||||
*
|
||||
* @return array Customers
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getNewsletteremails()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT `email`, `firstname`, `lastname`, `newsletter`, `ip_registration_newsletter`, `newsletter_date_add`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `newsletter` = 1
|
||||
AND `active` = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of customers who registered today
|
||||
*
|
||||
* @return integer number of customers who registered today
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getTodaysRegistration()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(`id_customer`) as nb
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE DAYOFYEAR(`date_add`) = DAYOFYEAR(NOW())
|
||||
AND YEAR(`date_add`) = YEAR(NOW())');
|
||||
if (!$result['nb'])
|
||||
return '0';
|
||||
return $result['nb'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Light back office search for customers
|
||||
*
|
||||
@@ -514,23 +440,6 @@ class CustomerCore extends ObjectModel
|
||||
LIMIT 10');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last cart ID for this customer
|
||||
*
|
||||
* @return integer Cart ID
|
||||
* @deprecated
|
||||
*/
|
||||
public function getLastCart()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT MAX(c.`id_cart`) AS id_cart
|
||||
FROM `'._DB_PREFIX_.'cart` c
|
||||
WHERE c.`id_customer` = '.(int)($this->id));
|
||||
if (isset($result['id_cart']))
|
||||
return $result['id_cart'];
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* Specify if a customer already in base
|
||||
*
|
||||
@@ -589,23 +498,6 @@ class CustomerCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_group
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
public function isMemberOfGroup($id_group)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT count(cg.`id_group`) as nb
|
||||
FROM '._DB_PREFIX_.'customer_group cg
|
||||
WHERE cg.`id_customer` = '.(int)($this->id).'
|
||||
AND cg.`id_group` = '.(int)($id_group));
|
||||
|
||||
return $result['nb'];
|
||||
}
|
||||
|
||||
public function getBoughtProducts()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
@@ -614,17 +506,6 @@ class CustomerCore extends ObjectModel
|
||||
WHERE o.valid = 1 AND o.`id_customer` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function getNeedDNI()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static public function getDefaultGroupId($id_customer)
|
||||
{
|
||||
if (!isset(self::$_defaultGroupId[(int)($id_customer)]))
|
||||
|
||||
@@ -340,23 +340,6 @@ class DiscountCore extends ObjectModel
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_category_product
|
||||
* @param int $id_category_discount
|
||||
* @return bool
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isParentCategoryProductDiscount($id_category_product, $id_category_discount)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$category = new Category((int)($id_category_product));
|
||||
$parentCategories = $category->getParentsCategories();
|
||||
foreach($parentCategories AS $parentCategory)
|
||||
if($id_category_discount == $parentCategory['id_category'])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static public function getCategories($id_discount)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
|
||||
@@ -117,22 +117,6 @@ class EmployeeCore extends ObjectModel
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all employee id and email
|
||||
*
|
||||
* @return array Employees
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getEmployees()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT `id_employee`, CONCAT(`firstname`, \' \', `lastname`) AS "name"
|
||||
FROM `'._DB_PREFIX_.'employee`
|
||||
WHERE `active` = 1
|
||||
ORDER BY `email`');
|
||||
}
|
||||
|
||||
public function add($autodate = true, $nullValues = true)
|
||||
{
|
||||
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_BACK').'minutes'));
|
||||
|
||||
@@ -334,38 +334,6 @@ class LinkCore
|
||||
return $switchLangLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getLanguageLinkAdmin($id_lang)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->getUrlWith('id_lang', (int)($id_lang));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function return the current url with a new parameter key=value
|
||||
* @param mixed $key
|
||||
* @param mixed $val
|
||||
* @return url with &key=val (or ?key=val)
|
||||
* @deprectated
|
||||
*/
|
||||
public function getUrlWith($key, $val)
|
||||
{
|
||||
// This function does not use rewrite
|
||||
Tools::displayAsDeprecated();
|
||||
$n = 0;
|
||||
$url = str_replace('index.php', '', htmlentities($this->url, ENT_QUOTES, 'UTF-8'));
|
||||
|
||||
foreach ($_GET as $k => $value)
|
||||
// adminlang is an hand-written param in BO
|
||||
if ($k != 'adminlang')
|
||||
if (!is_array($value) AND $k != $key AND Tools::isSubmit($k))
|
||||
$url .= ((!$n++) ? '?' : '&').urlencode($k).($value ? '='.urlencode($value) : '');
|
||||
|
||||
return $url.($n ? '&' : '?').urlencode($key).'='.urlencode($val);
|
||||
}
|
||||
|
||||
public function goPage($url, $p)
|
||||
{
|
||||
return $url.($p == 1 ? '' : (!strstr($url, '?') ? '?' : '&').'p='.(int)($p));
|
||||
|
||||
@@ -229,19 +229,7 @@ class ManufacturerCore extends ObjectModel
|
||||
$manufacturers[$i]['link_rewrite'] = 0;
|
||||
return $manufacturers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getManufacturersWithoutAddress()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$sql = 'SELECT m.* FROM `'._DB_PREFIX_.'manufacturer` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_manufacturer` = m.`id_manufacturer` AND a.`deleted` = 0)
|
||||
WHERE a.`id_manufacturer` IS NULL';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return name from id
|
||||
*
|
||||
|
||||
@@ -397,19 +397,6 @@ class OrderCore extends ObjectModel
|
||||
WHERE od.`id_order` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated
|
||||
*/
|
||||
public function getLastMessage()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$sql = 'SELECT `message` FROM `'._DB_PREFIX_.'message` WHERE `id_order` = '.(int)($this->id).' ORDER BY `id_message` desc';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
return $result['message'];
|
||||
}
|
||||
|
||||
public function getFirstMessage()
|
||||
{
|
||||
$sql = 'SELECT `message` FROM `'._DB_PREFIX_.'message` WHERE `id_order` = '.(int)($this->id).' ORDER BY `id_message` asc';
|
||||
@@ -590,15 +577,6 @@ class OrderCore extends ObjectModel
|
||||
ORDER BY `date_add` DESC, `id_order_history` DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function isLogable()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->valid;
|
||||
}
|
||||
|
||||
public function hasBeenDelivered()
|
||||
{
|
||||
return sizeof($this->getHistory((int)($this->id_lang), _PS_OS_DELIVERED_));
|
||||
@@ -672,19 +650,6 @@ class OrderCore extends ObjectModel
|
||||
return $orders;
|
||||
}
|
||||
|
||||
/*
|
||||
* @deprecated
|
||||
*/
|
||||
static public function getOrders($limit = NULL)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
ORDER BY `date_add`
|
||||
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : ''));
|
||||
}
|
||||
|
||||
static public function getOrdersWithInformations($limit = NULL, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
@@ -837,41 +802,6 @@ class OrderCore extends ObjectModel
|
||||
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_discount', array('id_order' => (int)($this->id), 'id_discount' => (int)($id_discount), 'name' => pSQL($name), 'value' => (float)($value)), 'INSERT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get orders number last week
|
||||
*
|
||||
* @return integer Orders number last week
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getWeeklyOrders()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(`id_order`) as nb
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE YEARWEEK(`date_add`) = YEARWEEK(NOW())');
|
||||
|
||||
return isset($result['nb']) ? $result['nb'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sales amount last month
|
||||
*
|
||||
* @return float Sales amount last month
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getMonthlySales()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT SUM(`total_paid`) as nb
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE MONTH(`date_add`) = MONTH(NOW())
|
||||
AND YEAR(`date_add`) = YEAR(NOW())');
|
||||
|
||||
return isset($result['nb']) ? $result['nb'] : 0;
|
||||
}
|
||||
|
||||
public function getNumberOfDays()
|
||||
{
|
||||
$nbReturnDays = (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'));
|
||||
|
||||
@@ -154,23 +154,6 @@ class PackCore extends Product
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function addItems($id_product, $ids)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
array_pop($ids);
|
||||
foreach ($ids as $id_product_item)
|
||||
{
|
||||
$idQty = explode('x', $id_product_item);
|
||||
if (!self::addItem($id_product, $idQty[1], $idQty[0]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the pack
|
||||
*
|
||||
|
||||
+2
-117
@@ -586,26 +586,6 @@ class ProductCore extends ObjectModel
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $reference
|
||||
*/
|
||||
public static function getByReference($reference)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
if (!Validate::isReference($reference))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE p.`reference` = \''.pSQL($reference).'\'');
|
||||
if (!isset($result['id_product']))
|
||||
return false;
|
||||
|
||||
return new self((int)$result['id_product']);
|
||||
}
|
||||
|
||||
/**
|
||||
* addToCategories add this product to the category/ies if not exists.
|
||||
*
|
||||
@@ -1135,18 +1115,6 @@ class ProductCore extends ObjectModel
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang` WHERE `id_customization_field` NOT IN (SELECT id_customization_field FROM `'._DB_PREFIX_.'customization_field`)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete product quantity discounts
|
||||
*
|
||||
* @return array Deletion result
|
||||
* @deprecated
|
||||
*/
|
||||
public function deleteQuantityDiscounts()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_quantity` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete product pack details
|
||||
*
|
||||
@@ -1594,21 +1562,6 @@ class ProductCore extends ObjectModel
|
||||
return Product::getProductCategories($this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get categories where product is indexed
|
||||
*
|
||||
* @param integer $id_product Product id
|
||||
* @return array Categories where product is indexed
|
||||
*/
|
||||
public static function getIndexedCategories($id_product)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_product` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product images and legends
|
||||
*
|
||||
@@ -1647,51 +1600,6 @@ class ProductCore extends ObjectModel
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reduction value for a given product
|
||||
* *****************************************
|
||||
* ** Kept for retro-compatibility issues **
|
||||
* *****************************************
|
||||
* You should use getPriceStatic() instead (with the parameter $only_reduc set to true)
|
||||
*
|
||||
* @param array $result SQL result with reduction informations
|
||||
* @param boolean $wt With taxes or not (optional)
|
||||
* @return float Reduction value in euros
|
||||
*/
|
||||
/* */
|
||||
public static function getReductionValue($reduction_price, $reduction_percent, $date_from, $date_to, $product_price, $usetax, $taxrate)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
// Avoid an error with 1970-01-01
|
||||
if (!Validate::isDate($date_from) OR !Validate::isDate($date_to))
|
||||
return 0;
|
||||
$currentDate = date('Y-m-d H:i:s');
|
||||
if ($date_from != $date_to AND ($currentDate > $date_to OR $currentDate < $date_from))
|
||||
return 0;
|
||||
|
||||
// reduction values
|
||||
if (!$usetax)
|
||||
$reduction_price /= (1 + ($taxrate / 100));
|
||||
|
||||
// make the reduction
|
||||
if ($reduction_price AND $reduction_price > 0)
|
||||
{
|
||||
if ($reduction_price >= $product_price)
|
||||
$ret = $product_price;
|
||||
else
|
||||
$ret = $reduction_price;
|
||||
}
|
||||
elseif ($reduction_percent AND $reduction_percent > 0)
|
||||
{
|
||||
if ($reduction_percent >= 100)
|
||||
$ret = $product_price;
|
||||
else
|
||||
$ret = $product_price * $reduction_percent / 100;
|
||||
}
|
||||
return isset($ret) ? $ret : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product price
|
||||
*
|
||||
@@ -1956,15 +1864,6 @@ class ProductCore extends ObjectModel
|
||||
return self::getPriceStatic((int)($this->id), $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getIdProductAttributeMostExpsensive()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->getIdProductAttributeMostExpensive();
|
||||
}
|
||||
|
||||
public function getIdProductAttributeMostExpensive()
|
||||
{
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
@@ -1985,6 +1884,7 @@ class ProductCore extends ObjectModel
|
||||
* Get product price for display
|
||||
* Also display currency sign and reduction
|
||||
*
|
||||
* @deprecated as of 1.4.2
|
||||
* @param array $params Product price, reduction...
|
||||
* @param object $smarty Smarty object
|
||||
* @return string Product price fully formated in customer currency
|
||||
@@ -1998,13 +1898,7 @@ class ProductCore extends ObjectModel
|
||||
$ret .= Tools::displayPrice($params['p']['price'], $smarty->ps_currency);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
static function productPriceWithoutDisplay($params, &$smarty)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Tools::convertPrice($params['p'], $params['c']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display price with right format and currency
|
||||
*
|
||||
@@ -3218,15 +3112,6 @@ class ProductCore extends ObjectModel
|
||||
GROUP BY sm.id_stock_mvt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getBasicPrice()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `price` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
public static function getUrlRewriteInformations($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
|
||||
@@ -193,16 +193,6 @@ class TabCore extends ObjectModel
|
||||
return (isset(self::$_getIdFromClassName[$class_name]) ? (int)self::$_getIdFromClassName[$class_name] : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param int $id_tab
|
||||
*/
|
||||
static public function getClassNameFromID($id_tab)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT class_name FROM `'._DB_PREFIX_.'tab` t WHERE t.`id_tab` = \''.(int)$id_tab.'\'');
|
||||
}
|
||||
|
||||
static public function getNbTabs($id_parent = NULL)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue('
|
||||
|
||||
-162
@@ -74,96 +74,6 @@ class TaxCore extends ObjectModel
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
public static function checkTaxZone($id_tax, $id_zone)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated states are not related to a tax. Check TaxRules.
|
||||
*/
|
||||
public function getStates()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated states are not related to a tax. Check TaxRules.
|
||||
*/
|
||||
public function getState($id_state)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated states are not related to a tax. Check TaxRules.
|
||||
*/
|
||||
public function addState($id_state)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated states are not related to a tax. Check TaxRules.
|
||||
*/
|
||||
public function deleteState($id_state)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all zones
|
||||
*
|
||||
* @return array Zones
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
public function getZones()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific zones
|
||||
*
|
||||
* @return array Zone
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
public function getZone($id_zone)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add zone
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
public function addZone($id_zone)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete zone
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
public function deleteZone($id_zone)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available taxes
|
||||
*
|
||||
@@ -184,68 +94,6 @@ class TaxCore extends ObjectModel
|
||||
return !Configuration::get('PS_TAX');
|
||||
}
|
||||
|
||||
/*
|
||||
* @deprecated zones are not related to a tax
|
||||
*/
|
||||
static public function zoneHasTax($id_tax, $id_zone)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated states are not related to a tax. Check TaxRules.
|
||||
*/
|
||||
static public function getRateByState($id_state, $active = 1)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the applicable tax rate depending of the country and state
|
||||
* @deprecated use getApplicableTaxRate
|
||||
* @param integer $id_tax
|
||||
* @param float $productTax
|
||||
* @param integer $id_address
|
||||
*
|
||||
* @return float taxe_rate
|
||||
*/
|
||||
static public function getApplicableTax($id_tax, $productTax, $id_address = NULL)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return Tax::getApplicableTaxRate($id_tax, $productTax, $id_address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the applicable tax rate depending of the country and state
|
||||
*
|
||||
* @param integer $id_tax
|
||||
* @param float $productTax
|
||||
* @param integer $id_address
|
||||
*
|
||||
* @return float taxe_rate
|
||||
*/
|
||||
public static function getApplicableTaxRate($id_tax, $productTax, $id_address = NULL)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $productTax;
|
||||
}
|
||||
|
||||
static public function getTaxIdByRate($rate, $active = 1)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$tax = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT t.`id_tax`
|
||||
FROM `'._DB_PREFIX_.'tax` t
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.id_tax = tl.id_tax)
|
||||
WHERE t.`rate` = '.(float)($rate).
|
||||
($active == 1 ? ' AND t.`active` = 1' : ''));
|
||||
return $tax ? (int)($tax['id_tax']) : false;
|
||||
}
|
||||
|
||||
public static function getTaxIdByName($tax_name, $active =1)
|
||||
{
|
||||
$tax = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
@@ -258,16 +106,6 @@ class TaxCore extends ObjectModel
|
||||
return $tax ? (int)($tax['id_tax']) : false;
|
||||
}
|
||||
|
||||
static public function getDataByProductId($id_product)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$tax_rate = Tax::getProductTaxRate((int)$id_product);
|
||||
$id_tax = Tax::getTaxIdByRate($tax_rate);
|
||||
|
||||
return array('id_tax' => $id_tax, 'rate' => $tax_rate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the product tax
|
||||
*
|
||||
|
||||
@@ -870,46 +870,6 @@ class ToolsCore
|
||||
return self::getPath($id_category, $category->name, true, $type_cat).'<span class="navigation-pipe">'.$pipe.'</span> <span class="navigation_product">'.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getCategoriesTotal()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_category`) AS total FROM `'._DB_PREFIX_.'category`');
|
||||
return (int)($row['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getProductsTotal()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_product`) AS total FROM `'._DB_PREFIX_.'product`');
|
||||
return (int)($row['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getCustomersTotal()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_customer`) AS total FROM `'._DB_PREFIX_.'customer`');
|
||||
return (int)($row['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getOrdersTotal()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_order`) AS total FROM `'._DB_PREFIX_.'orders`');
|
||||
return (int)($row['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the friendly url from the provided string
|
||||
*
|
||||
@@ -1035,15 +995,6 @@ class ToolsCore
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getExactTime()
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return time()+microtime();
|
||||
}
|
||||
|
||||
static function strtolower($str)
|
||||
{
|
||||
if (is_array($str))
|
||||
@@ -1117,46 +1068,6 @@ class ToolsCore
|
||||
return ($field === '' OR $field === NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
**/
|
||||
public static function getTimezones($select = false)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
static $_cache = 0;
|
||||
|
||||
// One select
|
||||
if ($select)
|
||||
{
|
||||
// No cache
|
||||
if (!$_cache)
|
||||
{
|
||||
$tmz = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT `name` FROM '._DB_PREFIX_.'timezone WHERE id_timezone = '.(int)($select));
|
||||
$_cache = $tmz['name'];
|
||||
}
|
||||
return $_cache;
|
||||
}
|
||||
|
||||
// Multiple select
|
||||
$tmz = Db::getInstance(_PS_USE_SQL_SLAVE_)->s('SELECT * FROM '._DB_PREFIX_.'timezone');
|
||||
$tab = array();
|
||||
foreach ($tmz as $timezone)
|
||||
$tab[$timezone['id_timezone']] = str_replace('_', ' ', $timezone['name']);
|
||||
return $tab;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
**/
|
||||
public static function ps_set_magic_quotes_runtime($var)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
if (function_exists('set_magic_quotes_runtime'))
|
||||
set_magic_quotes_runtime($var);
|
||||
}
|
||||
|
||||
public static function ps_round($value, $precision = 0)
|
||||
{
|
||||
$method = (int)(Configuration::get('PS_PRICE_ROUND_MODE'));
|
||||
|
||||
@@ -145,16 +145,6 @@ class ValidateCore
|
||||
return preg_match('/^[0-9]{1,4}$/', $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param int $id
|
||||
*/
|
||||
static public function isOptId($id)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return empty($id) OR self::isUnsignedId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for name validity
|
||||
*
|
||||
@@ -221,43 +211,6 @@ class ValidateCore
|
||||
return preg_match('/^[a-zA-Z0-9_-]+$/', $tplName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $tplFileName
|
||||
* @return bool
|
||||
*/
|
||||
static public function isTplFileName($tplFileName)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^[a-zA-Z0-9\/_.-]+/', $tplFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for icon file validity
|
||||
*
|
||||
* @param string $icon Icon filename to validate
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isIconFile($icon)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^[a-z0-9_-]+\.(gif|jpg|jpeg|png)$/i', $icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for ico file validity
|
||||
*
|
||||
* @param string $icon Icon filename to validate
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isIcoFile($icon)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^[a-z0-9_-]+\.ico$/i', $icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for image type name validity
|
||||
*
|
||||
@@ -306,32 +259,6 @@ class ValidateCore
|
||||
return preg_match('/^[0-9]{2,3}$/', $isoCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for gender code (ISO) validity
|
||||
*
|
||||
* @param string $isoCode Gender code (ISO) to validate
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isGenderIsoCode($isoCode)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^0|1|2|9$/', $isoCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for gender code (ISO) validity
|
||||
*
|
||||
* @param string $isoCode Gender code (ISO) to validate
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isGenderName($genderName)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^[a-zA-Z.]+$/', $genderName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for discount coupon name validity
|
||||
*
|
||||
@@ -387,19 +314,6 @@ class ValidateCore
|
||||
return (boolean)preg_match('/^[_a-zA-Z0-9-]+$/', $link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for zone name validity
|
||||
*
|
||||
* @param string $name Zone name to validate
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isZoneName($name)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^[a-zA-Z -()]+$/', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for a postal address validity
|
||||
*
|
||||
@@ -793,17 +707,6 @@ class ValidateCore
|
||||
return preg_match('/^[a-zA-Z]{1,2}$/', $unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $protocol
|
||||
*/
|
||||
static public function isProtocol($protocol)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return preg_match('/^http(s?):\/\/$/i', $protocol);
|
||||
}
|
||||
|
||||
|
||||
static public function isSubDomainName($subDomainName)
|
||||
{
|
||||
return preg_match('/^[a-zA-Z0-9-_]*$/', $subDomainName);
|
||||
@@ -814,19 +717,6 @@ class ValidateCore
|
||||
return preg_match('/^([^<>{}]|<br \/>)*$/i', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the char values is a granularity value
|
||||
*
|
||||
* @param char $value
|
||||
* @return boolean Validity is ok or not
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isGranularityValue($value)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return (!is_null($value) AND ($value === 'd' OR $value === 'm' OR $value === 'y'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the value is a sort direction value (DESC/ASC)
|
||||
*
|
||||
@@ -868,96 +758,6 @@ class ValidateCore
|
||||
{
|
||||
return empty($dni) OR (bool)preg_match('/^[0-9A-Za-z-.]{1,16}$/U', $dni);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Dni validity
|
||||
*
|
||||
* @param string $dni to validate
|
||||
* @return int
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isDni($dni)
|
||||
{
|
||||
/*
|
||||
Return code:
|
||||
1 : It's Ok
|
||||
0 : Bad format for DNI
|
||||
-1 : DNI duplicate
|
||||
-2 : NIF error
|
||||
-3 : CIF error
|
||||
-4 : NIE error
|
||||
*/
|
||||
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
if (!$dni)
|
||||
return 1;
|
||||
|
||||
$dni = strtoupper($dni);
|
||||
if (!preg_match('/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/', $dni))
|
||||
return 0;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_address`
|
||||
FROM `'._DB_PREFIX_.'address`
|
||||
WHERE `dni` = \''.pSQL($dni).'\'');
|
||||
if($result)
|
||||
return -1;
|
||||
|
||||
for ($i=0;$i<9;$i++)
|
||||
$char[$i] = substr($dni, $i, 1);
|
||||
// 12345678T
|
||||
if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $dni))
|
||||
if ($char[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($dni, 0, 8) % 23, 1))
|
||||
return 1;
|
||||
else
|
||||
return -2;
|
||||
|
||||
$sum = $char[2] + $char[4] + $char[6];
|
||||
for ($i = 1; $i < 8; $i += 2)
|
||||
$sum += substr((2 * $char[$i]),0,1) + substr((2 * $char[$i]),1,1);
|
||||
|
||||
$n = 10 - substr($sum, strlen($sum) - 1, 1);
|
||||
|
||||
if (preg_match('/^[KLM]{1}/', $dni))
|
||||
if ($char[8] == chr(64 + $n))
|
||||
return 1;
|
||||
else
|
||||
return -2;
|
||||
|
||||
if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $dni))
|
||||
if ($char[8] == chr(64 + $n) || $char[8] == substr($n, strlen($n) - 1, 1))
|
||||
return 1;
|
||||
else
|
||||
return -3;
|
||||
|
||||
if (preg_match('/^[T]{1}/', $dni))
|
||||
if ($char[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $dni))
|
||||
return 1;
|
||||
else
|
||||
return -4;
|
||||
|
||||
if (preg_match('/^[XYZ]{1}/', $dni))
|
||||
if ($char[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $dni), 0, 8) % 23, 1))
|
||||
return 1;
|
||||
else
|
||||
return -4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Dni validity
|
||||
*
|
||||
* @param string $dni to validate
|
||||
* @return bool
|
||||
* @deprecated
|
||||
*/
|
||||
static public function isDniBool($dni)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return (self::isDni($dni) > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if $data is a PrestaShop cookie object
|
||||
|
||||
@@ -74,7 +74,6 @@ smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate');
|
||||
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
|
||||
smartyRegisterFunction($smarty, 'function', 'productPrice', array('Product', 'productPrice')); // unused
|
||||
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
|
||||
smartyRegisterFunction($smarty, 'function', 'convertPriceWithoutDisplay', array('Product', 'productPriceWithoutDisplay')); // unused
|
||||
smartyRegisterFunction($smarty, 'function', 'convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
|
||||
smartyRegisterFunction($smarty, 'function', 'displayWtPrice', array('Product', 'displayWtPrice'));
|
||||
smartyRegisterFunction($smarty, 'function', 'displayWtPriceWithCurrency', array('Product', 'displayWtPriceWithCurrency'));
|
||||
|
||||
Reference in New Issue
Block a user