[*] Core : clean all deprecated methods

This commit is contained in:
aFolletete
2011-04-12 18:50:26 +00:00
parent 05a58f53e6
commit fbc1882f85
20 changed files with 0 additions and 1159 deletions
-14
View File
@@ -262,20 +262,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]))
-32
View File
@@ -138,38 +138,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('
-48
View File
@@ -398,16 +398,6 @@ class CMSCategoryCore extends ObjectModel
{
return self::getChildren(1, $id_lang, $active);
}
/**
* @deprecated
**/
static public function getRootCMSCategory($id_lang = NULL)
{
Tools::displayAsDeprecated();
//get idLang
$id_lang = is_null($id_lang) ? _USER_ID_LANG_ : (int)($id_lang);
return new CMSCategory (1, $id_lang);
}
static public function getChildren($id_parent, $id_lang, $active = true)
{
@@ -516,27 +506,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
@@ -567,23 +536,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)
{
-26
View File
@@ -435,19 +435,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('
@@ -621,19 +608,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()
{
$method = (int)($this->shipping_method);
-55
View File
@@ -1242,24 +1242,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
*
@@ -1312,35 +1294,6 @@ class CartCore extends ObjectModel
'free_ship' => (int)$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'))
@@ -1502,14 +1455,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))
-12
View File
@@ -529,18 +529,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
*
-17
View File
@@ -192,23 +192,6 @@ class ConfigurationCore extends ObjectModel
return $resTab;
}
/**
* 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;
}
/**
* Insert configuration key and value into database
*
-11
View File
@@ -233,17 +233,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))
-18
View File
@@ -295,24 +295,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');
-130
View File
@@ -269,25 +269,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
*
@@ -332,25 +313,6 @@ class CustomerCore extends ObjectModel
WHERE `id_lang` = '.(int)($id_lang).' AND `id_customer` = '.(int)($this->id).' AND a.`deleted` = 0');
}
/**
* Returns customer last connections
*
* @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
*
@@ -384,41 +346,6 @@ class CustomerCore extends ObjectModel
AND `passwd` = \''.pSQL($passwd).'\'');
}
/**
* 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
*
@@ -478,35 +405,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
*
* @param $id_customer Customer id
* @return boolean
*/
// DEPRECATED
public function customerIdExists($id_customer)
{
return self::customerIdExistsStatic((int)($id_customer));
}
static public function customerIdExistsStatic($id_customer)
{
$row = Db::getInstance()->getRow('
@@ -553,23 +451,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('
@@ -578,17 +459,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)]))
-17
View File
@@ -337,23 +337,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)
{
-16
View File
@@ -105,22 +105,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'));
-47
View File
@@ -136,21 +136,6 @@ class LinkCore
return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer);
}
/**
* @deprecated
*/
public function getCustomLink($id_custom, $page, $prefix = '~', $alias = NULL, $id_lang = NULL)
{
Tools::displayAsDeprecated();
if (is_object($id_custom))
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_custom->id).$prefix.$id_custom->link_rewrite) :
(_PS_BASE_URL_.__PS_BASE_URI__.$page.'?id_custom='.(int)($id_custom->id));
if ($alias)
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_custom).$prefix.$alias) :
(_PS_BASE_URL_.__PS_BASE_URI__.$page.'?id_custom='.(int)($id_custom));
return _PS_BASE_URL_.__PS_BASE_URI__.$page.'?id_custom='.(int)($id_custom);
}
public function getImageLink($name, $ids, $type = NULL)
{
global $protocol_content;
@@ -263,38 +248,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++) ? '?' : '&amp;').urlencode($k).($value ? '='.urlencode($value) : '');
return $url.($n ? '&amp;' : '?').urlencode($key).'='.urlencode($val);
}
public function goPage($url, $p)
{
return $url.($p == 1 ? '' : (!strstr($url, '?') ? '?' : '&amp;').'p='.(int)($p));
-12
View File
@@ -222,18 +222,6 @@ class ManufacturerCore extends ObjectModel
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
*
-68
View File
@@ -383,19 +383,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';
@@ -580,15 +567,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_));
@@ -666,19 +644,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)
{
global $cookie;
@@ -824,40 +789,7 @@ 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()
{
-17
View File
@@ -158,23 +158,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
*
-166
View File
@@ -578,26 +578,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.
*
@@ -809,33 +789,6 @@ class ProductCore extends ObjectModel
ORDER BY pl.`name`');
}
/**
* Return the products in the same category than the default category of the instancied product
*
* @param integer $id_lang Language ID
* @return array Products
* @deprecated
*/
public function getDefaultCategoryProducts($idLang = NULL, $limit = NULL)
{
Tools::displayAsDeprecated();
//get idLang
$idLang = is_null($idLang) ? _USER_ID_LANG_ : (int)($idLang);
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT p.`id_product`, pl.`description_short`set, pl.`link_rewrite`, pl.`name`, i.`id_image`
FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = cp.id_product)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)
WHERE cp.id_category = ' . (int)($this->id_category_default) . '
AND id_lang = ' . (int)($idLang) . '
AND p.`active` = 1
AND i.`cover` = 1
'. (is_null($limit) ? '' : ' LIMIT 0 , ' . (int)($limit)));
return $result;
}
public function isNew()
{
$result = Db::getInstance()->ExecuteS('
@@ -1118,18 +1071,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
*
@@ -1565,22 +1506,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
* @deprecated
*/
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
*
@@ -1611,51 +1536,6 @@ class ProductCore extends ObjectModel
AND `cover` = 1');
}
/**
* 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
*
@@ -1909,15 +1789,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('
@@ -2749,34 +2620,6 @@ class ProductCore extends ObjectModel
return $customizedDatas;
}
/**
* @param int $id_customization
* @return bool
* @deprecated
*/
public function deleteCustomizedDatas($id_customization)
{
Tools::displayAsDeprecated();
if (Pack::isPack((int)($product['id_product'])))
{
$products_pack = Pack::getItems((int)($product['id_product']), (int)(Configuration::get('PS_LANG_DEFAULT')));
foreach($products_pack AS $product_pack)
{
$tab_product_pack['id_product'] = (int)($product_pack->id);
$tab_product_pack['id_product_attribute'] = self::getDefaultAttribute($tab_product_pack['id_product'], 1);
$tab_product_pack['cart_quantity'] = (int)($product_pack->pack_quantity * $product['cart_quantity']);
self::updateQuantity($tab_product_pack);
}
}
if (($result = Db::getInstance()->ExecuteS('SELECT `value` FROM `'._DB_PREFIX_.'customized_data` WHERE `id_customization` = '.(int)($id_customization).' AND `type` = '._CUSTOMIZE_FILE_)) === false)
return false;
foreach ($result AS $row)
if (!@unlink(_PS_UPLOAD_DIR_.$row['value']) OR !@unlink(_PS_UPLOAD_DIR_.$row['value'].'_small'))
return false;
return (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.(int)($id_customization)) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customized_data` WHERE `id_customization` = '.(int)($id_customization)));
}
public static function addCustomizationPrice(&$products, &$customizedDatas)
{
foreach ($products AS &$productUpdate)
@@ -3064,15 +2907,6 @@ class ProductCore extends ObjectModel
return $result;
}
/**
* @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('
-164
View File
@@ -76,96 +76,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
*
@@ -186,70 +96,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();
global $cart, $cookie, $defaultCountry;
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('
@@ -262,16 +108,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
*
-89
View File
@@ -819,46 +819,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']);
}
/*
** Historyc translation function kept for compatibility
** Removing soon
@@ -968,15 +928,6 @@ class ToolsCore
return $date;
}
/**
* @deprecated
*/
public static function getExactTime()
{
Tools::displayAsDeprecated();
return time()+microtime();
}
static function strtolower($str)
{
if (is_array($str))
@@ -1050,46 +1001,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'));
-200
View File
@@ -145,16 +145,6 @@ class ValidateCore
return preg_match('/^[0-9]{1,4}$/ui', $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-z0-9_-]+$/ui', $tplName);
}
/**
* @deprecated
* @param string $tplFileName
* @return bool
*/
static public function isTplFileName($tplFileName)
{
Tools::displayAsDeprecated();
return preg_match('/^[a-zA-Z0-9\/_.-]+/ui', $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]$/ui', $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$/ui', $icon);
}
/**
* Check for image type name validity
*
@@ -306,32 +259,6 @@ class ValidateCore
return preg_match('/^[0-9]{2,3}$/ui', $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]$/ui', $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-z.]+$/ui', $genderName);
}
/**
* Check for discount coupon name validity
*
@@ -387,19 +314,6 @@ class ValidateCore
return (boolean)preg_match('/^[_a-z0-9-]+$/ui', $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-z -()]+$/ui', $name);
}
/**
* Check for a postal address validity
*
@@ -771,17 +685,6 @@ class ValidateCore
return preg_match('/^[[:alpha:]]{1,2}$/ui', $unit);
}
/**
* @deprecated
* @param string $protocol
*/
static public function isProtocol($protocol)
{
Tools::displayAsDeprecated();
return preg_match('/^http(s?):\/\/$/ui', $protocol);
}
static public function isSubDomainName($subDomainName)
{
return preg_match('/^[[:alnum:]]*$/ui', $subDomainName);
@@ -792,19 +695,6 @@ class ValidateCore
return preg_match('/^([^<>{}]|<br \/>)*$/ui', $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)
*
@@ -846,96 +736,6 @@ class ValidateCore
{
return empty($dni) OR (bool)preg_match('/^[0-9a-z-.]{1,16}$/Ui', $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