From 8967e72bc16c6434689f376e85272c30fa3eb908 Mon Sep 17 00:00:00 2001 From: aFolletete Date: Sat, 7 Apr 2012 16:35:14 +0000 Subject: [PATCH] // clean code git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14543 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Currency.php | 48 +++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/classes/Currency.php b/classes/Currency.php index b69ba8328..88e56f704 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -241,8 +241,8 @@ class CurrencyCore extends ObjectModel public static function checkPaymentCurrencies($id_module, $id_shop = null) { - if (empty($id_module)) - return false; + if (empty($id_module)) + return false; if (is_null($id_shop)) $id_shop = Context::getContext()->shop->id; @@ -285,33 +285,31 @@ class CurrencyCore extends ObjectModel */ public static function getIdByIsoCodeNum($iso_code_num, $id_shop = 0) { - $query = Currency::getIdByQuery($id_shop); - $query->where('iso_code_num = \''.pSQL($iso_code_num).'\''); + $query = Currency::getIdByQuery($id_shop); + $query->where('iso_code_num = \''.pSQL($iso_code_num).'\''); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); - - return (int)$result['id_currency']; + return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); } - /** - * @static - * @param int $id_shop - * @return DbQuery - */ - public static function getIdByQuery($id_shop = 0) - { - $query = new DbQuery(); - $query->select('c.id_currency'); - $query->from('currency', 'c'); - $query->where('deleted = 0'); + /** + * @static + * @param int $id_shop + * @return DbQuery + */ + public static function getIdByQuery($id_shop = 0) + { + $query = new DbQuery(); + $query->select('c.id_currency'); + $query->from('currency', 'c'); + $query->where('deleted = 0'); - if (Shop::isFeatureActive() && $id_shop > 0) - { - $query->leftJoin('currency_shop', 'cs', 'cs.id_currency = c.id_currency'); - $query->where('id_shop = '.(int)$id_shop); - } - return $query; - } + if (Shop::isFeatureActive() && $id_shop > 0) + { + $query->leftJoin('currency_shop', 'cs', 'cs.id_currency = c.id_currency'); + $query->where('id_shop = '.(int)$id_shop); + } + return $query; + } /** * Refresh the currency conversion rate