From 7c160a8073f66bdf98d8ddd385c42a1d81382abd Mon Sep 17 00:00:00 2001 From: vChabot Date: Mon, 9 Jul 2012 14:18:12 +0000 Subject: [PATCH] [-] BO : BugFix : #PSCFV-2965 : Localization : updating default currency does not change currency on BO git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16289 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/controller/AdminController.php | 2 +- classes/shop/Shop.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 8118f8e95..ace921157 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -317,7 +317,7 @@ class AdminControllerCore extends Controller $this->initShopContext(); - $currency = Shop::getEntityIds('currency', $this->context->shop->id); + $currency = Shop::getEntityIds('currency', $this->context->shop->id, true, true); $this->context->currency = new Currency($currency[0]['id_currency']); } diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 287575d4a..060ee9f77 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -1036,15 +1036,19 @@ class ShopCore extends ObjectModel * @param int $id_shop * @return array|bool */ - public static function getEntityIds($entity, $id_shop) + public static function getEntityIds($entity, $id_shop, $active = false, $delete = false) { if (!Shop::isTableAssociated($entity)) return false; return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT `id_'.pSQL($entity).'` - FROM `'._DB_PREFIX_.pSQL($entity).'_shop` - WHERE `id_shop` = '.(int)$id_shop + SELECT entity.`id_'.pSQL($entity).'` + FROM `'._DB_PREFIX_.pSQL($entity).'_shop`es + LEFT JOIN '._DB_PREFIX_.pSQL($entity).' entity + ON (entity.`id_'.pSQL($entity).'` = es.`id_'.pSQL($entity).'`) + WHERE es.`id_shop` = '.(int)$id_shop. + ($active ? ' AND entity.`active` = 1' : ''). + ($delete ? ' AND entity.deleted = 0' : '') ); } }