// Cannot create customers in all / group context #PSCFV-2207
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15282 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -31,6 +31,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
|
||||
protected $_defaultOrderBy = 'date_add';
|
||||
protected $_defaultOrderWay = 'DESC';
|
||||
protected $can_add_customer = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -139,6 +140,18 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->shopShareDatas = Shop::SHARE_CUSTOMER;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
// Check if we can add a customer
|
||||
if (Shop::isFeatureActive() && (Shop::getContext() == Shop::CONTEXT_ALL || Shop::getContext() == Shop::CONTEXT_GROUP))
|
||||
$this->can_add_customer = false;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (!$this->can_add_customer && $this->display)
|
||||
$this->redirect_after = $this->context->link->getAdminLink('AdminCustomers');
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
@@ -150,9 +163,19 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'boxes' => $this->boxes,
|
||||
));
|
||||
|
||||
if (!$this->can_add_customer && !$this->display)
|
||||
$this->informations[] = $this->l('You have to select a shop if you want to create a customer');
|
||||
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
if (!$this->can_add_customer)
|
||||
unset($this->toolbar_btn['new']);
|
||||
}
|
||||
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
Reference in New Issue
Block a user