[-] BO : BugFix #PSTEST-561 customer creation in fancybox is improved : you cannot select the visitor and guest group as the default group and theses groups are unchecked for the group access

This commit is contained in:
vChabot
2012-01-26 17:31:55 +00:00
parent e6b82ffa62
commit 0ac8d632f0
+24 -12
View File
@@ -358,22 +358,34 @@ class AdminCustomersControllerCore extends AdminController
'values' => $groups,
'required' => true,
'desc' => $this->l('Check all the box(es) of groups of which the customer is to be a member')
),
array(
'type' => 'select',
'label' => $this->l('Default group:'),
'name' => 'id_default_group',
'options' => array(
'query' => $groups,
'id' => 'id_group',
'name' => 'name'
),
'hint' => $this->l('The group will be as applied by default.'),
'desc' => $this->l('Apply the discount\'s price of this group.')
)
)
);
// if we add a customer via fancybox (ajax), it's a customer and he doesn't need to be added to the visitor and guest groups
if (Tools::isSubmit('addcustomer') && Tools::isSubmit('submitFormAjax'))
{
$visitor_group = Configuration::get('PS_UNIDENTIFIED_GROUP');
$guest_group = Configuration::get('PS_GUEST_GROUP');
foreach ($groups as $key => $g)
if (in_array($g['id_group'], array($visitor_group, $guest_group)))
unset($groups[$key]);
}
$this->fields_form['input'][] =
array(
'type' => 'select',
'label' => $this->l('Default group:'),
'name' => 'id_default_group',
'options' => array(
'query' => $groups,
'id' => 'id_group',
'name' => 'name'
),
'hint' => $this->l('The group will be as applied by default.'),
'desc' => $this->l('Apply the discount\'s price of this group.')
);
// if customer is a guest customer, password hasn't to be there
if ($obj->id && ($obj->is_guest && $obj->id_default_group == Configuration::get('PS_GUEST_GROUP')))
{