[*] FO : Added the possibility to deactivate customer groups management (for performances) [part 2]
This commit is contained in:
+8
-8
@@ -151,19 +151,23 @@ class GroupCore extends ObjectModel
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', '1');
|
||||
if (parent::add($autodate, $null_values))
|
||||
{
|
||||
Category::setNewGroupForHome((int)$this->id);
|
||||
|
||||
Carrier::assignGroupToAllCarriers((int)$this->id);
|
||||
|
||||
// Set cache of feature detachable to true
|
||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', '1');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function update($autodate = true, $null_values = false)
|
||||
{
|
||||
if (!Configuration::getGlobalValue('PS_GROUP_FEATURE_ACTIVE') && $this->reduction > 0)
|
||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', 1);
|
||||
return parent::update($autodate, $null_values);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ($this->id == (int)Configuration::get('PS_CUSTOMER_GROUP'))
|
||||
@@ -177,10 +181,6 @@ class GroupCore extends ObjectModel
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id);
|
||||
$this->truncateModulesRestrictions($this->id);
|
||||
|
||||
// Refresh cache of feature detachable
|
||||
if (!Configuration::getGlobalValue('PS_GROUP_FEATURE_ACTIVE') && Group::isCurrentlyUsed())
|
||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', 1);
|
||||
|
||||
// Add default group (id 3) to customers without groups
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
|
||||
SELECT c.id_customer, '.(int)Configuration::get('PS_CUSTOMER_GROUP').' FROM `'._DB_PREFIX_.'customer` c
|
||||
|
||||
Reference in New Issue
Block a user