[*] CORE : Remove duplicate SQL queries
This commit is contained in:
@@ -124,9 +124,13 @@ class TaxRuleCore extends ObjectModel
|
||||
*/
|
||||
public static function isTaxInUse($id_tax)
|
||||
{
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) FROM `'._DB_PREFIX_.'tax_rule` WHERE `id_tax` = '.(int)$id_tax
|
||||
);
|
||||
$cache_id = __CLASS__.__FUNCTION__.(int)$id_tax;
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$result = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'tax_rule` WHERE `id_tax` = '.(int)$id_tax);
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user