[-] BO : BugFix : #PSCFV-2965 : Localization : updating default currency does not change currency on BO

This commit is contained in:
vChabot
2012-07-09 14:18:12 +00:00
parent c6a1948341
commit baa76d7633
2 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -317,7 +317,7 @@ class AdminControllerCore extends Controller
$this->initShopContext(); $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']); $this->context->currency = new Currency($currency[0]['id_currency']);
} }
+8 -4
View File
@@ -1036,15 +1036,19 @@ class ShopCore extends ObjectModel
* @param int $id_shop * @param int $id_shop
* @return array|bool * @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)) if (!Shop::isTableAssociated($entity))
return false; return false;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT `id_'.pSQL($entity).'` SELECT entity.`id_'.pSQL($entity).'`
FROM `'._DB_PREFIX_.pSQL($entity).'_shop` FROM `'._DB_PREFIX_.pSQL($entity).'_shop`es
WHERE `id_shop` = '.(int)$id_shop 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' : '')
); );
} }
} }