From 18afa20e63077aa02b08a39a38ba7487ae98fc41 Mon Sep 17 00:00:00 2001 From: rMalie Date: Mon, 23 Apr 2012 14:27:08 +0000 Subject: [PATCH] // Add a multishop restriction on address in BO #PSTEST-1035 --- classes/shop/Shop.php | 7 +------ controllers/admin/AdminAddressesController.php | 7 +++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index c3cdb8a32..8940b382f 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -689,12 +689,7 @@ class ShopCore extends ObjectModel if ($alias) $alias .= '.'; - $restriction = ''; - if (Shop::getContext() != Shop::CONTEXT_ALL) - $restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', Shop::getContextListShopID($share)).') '; - //else if ($share == Shop::SHARE_STOCK) - // $restriction = ' AND '.$alias.'id_shop = '.$this->getID(true); - + $restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', Shop::getContextListShopID($share)).') '; return $restriction; } diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index c8ff9a033..7756ed9bd 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -68,8 +68,11 @@ class AdminAddressesControllerCore extends AdminController { $this->_select = 'cl.`name` as country'; $this->_join = ' - LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')'; - $this->_where = 'AND a.id_customer != 0'; + LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.') + LEFT JOIN `'._DB_PREFIX_.'customer` c ON a.id_customer = c.id_customer + '; + + $this->_where = 'AND a.id_customer != 0 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c'); return parent::renderList(); }