diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index 4986e4ea3..c92d6eed4 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -180,6 +180,12 @@ class SpecificPriceCore extends ObjectModel $select = '('; $priority = SpecificPrice::getPriority($id_product); + if (!Group::isFeatureActive()) { + if (($key = array_search('id_group', $priority)) !== false) { + unset($priority[$key]); + } + } + foreach (array_reverse($priority) as $k => $field) { if (!empty($field)) { $select .= ' IF (`'.bqSQL($field).'` = '.(int)$$field.', '.pow(2, $k + 1).', 0) + '; @@ -358,8 +364,8 @@ class SpecificPriceCore extends ObjectModel WHERE `id_shop` '.self::formatIntInQuery(0, $id_shop).' AND `id_currency` '.self::formatIntInQuery(0, $id_currency).' AND - `id_country` '.self::formatIntInQuery(0, $id_country).' AND - `id_group` '.self::formatIntInQuery(0, $id_group).' '.$query_extra.' + `id_country` '.self::formatIntInQuery(0, $id_country). + (Group::isFeatureActive() ? ' AND `id_group` '.self::formatIntInQuery(0, $id_group) : '').' '.$query_extra.' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= '; $query .= (Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION') || !$id_cart || !$real_quantity) ? (int)$quantity : max(1, (int)$real_quantity); diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index 48243b7d3..1a3269997 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -126,7 +126,7 @@ class AdminGroupsControllerCore extends AdminController public function initPageHeaderToolbar() { - if (empty($this->display)) { + if (empty($this->display) && Group::isFeatureActive()) { $this->page_header_toolbar_btn['new_group'] = array( 'href' => self::$currentIndex.'&addgroup&token='.$this->token, 'desc' => $this->l('Add new group', null, null, false), @@ -148,8 +148,32 @@ class AdminGroupsControllerCore extends AdminController parent::initProcess(); } + public function initContent() + { + if (!Group::isFeatureActive()) { + parent::initContent(); + + $content = $this->displayWarning(sprintf( + $this->l('The feature Customer Groups has been disabled. You can enable it from %s page.'), + ''.$this->l('Advanced Parameters > Performance').'' + )); + + $this->context->smarty->assign(array( + 'content' => $content, + )); + + return; + } + + parent::initContent(); + } + public function postProcess() { + if (!Group::isFeatureActive()) { + return; + } + if (isset($_POST['submitResetcustomer_group'])) { $this->processResetFilters('customer_group'); } diff --git a/controllers/admin/AdminPerformanceController.php b/controllers/admin/AdminPerformanceController.php index 4a0b4b123..ac7f60298 100644 --- a/controllers/admin/AdminPerformanceController.php +++ b/controllers/admin/AdminPerformanceController.php @@ -212,27 +212,27 @@ class AdminPerformanceControllerCore extends AdminController 'type' => 'hidden', 'name' => 'features_detachables_up' ), - array( - 'type' => 'switch', - 'label' => $this->l('Combinations'), - 'name' => 'combination', - 'is_bool' => true, - 'disabled' => Combination::isCurrentlyUsed(), - 'values' => array( - array( - 'id' => 'combination_1', - 'value' => 1, - 'label' => $this->l('Yes'), - ), - array( - 'id' => 'combination_0', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - 'hint' => $this->l('Choose "No" to disable Product Combinations.'), - 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null - ), + // array( + // 'type' => 'switch', + // 'label' => $this->l('Combinations'), + // 'name' => 'combination', + // 'is_bool' => true, + // 'disabled' => Combination::isCurrentlyUsed(), + // 'values' => array( + // array( + // 'id' => 'combination_1', + // 'value' => 1, + // 'label' => $this->l('Yes'), + // ), + // array( + // 'id' => 'combination_0', + // 'value' => 0, + // 'label' => $this->l('No') + // ) + // ), + // 'hint' => $this->l('Choose "No" to disable Product Combinations.'), + // 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null + // ), array( 'type' => 'switch', 'label' => $this->l('Features'), diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 41660e0b1..7fb1ae9af 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1282,9 +1282,9 @@ class HotelCartBookingData extends ObjectModel foreach ($featurePricePriority as $priority) { if ($priority == 'specific_date') { if ($featurePrice = Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp - INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg - ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.') + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp'. + (Group::isFeatureActive() ? ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg + ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.')' : '').' WHERE fp.`id_cart` = 0 AND fp.`id_product`='.(int) $id_product.' AND fp.`active`=1 AND fp.`date_selection_type` = '.(int) HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC.' AND fp.`date_from` = \''.pSQL($date).'\'' )) { @@ -1292,9 +1292,9 @@ class HotelCartBookingData extends ObjectModel } } elseif ($priority == 'special_day') { if ($featurePrice = Db::getInstance()->executeS( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp - INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg - ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.') + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp'. + (Group::isFeatureActive() ? ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg + ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.')' : '').' WHERE fp.`id_cart` = 0 AND fp.`id_product`='.(int) $id_product.' AND fp.`is_special_days_exists`=1 AND fp.`active`=1 AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` >= \''.pSQL($date).'\'' @@ -1308,9 +1308,9 @@ class HotelCartBookingData extends ObjectModel } } elseif ($priority == 'date_range') { if ($featurePrice = Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp - INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg - ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.') + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` fp'. + (Group::isFeatureActive() ? ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` fpg + ON (fp.`id_feature_price` = fpg.`id_feature_price` AND fpg.`id_group` = '.(int) $id_group.')' : '').' WHERE fp.`id_cart` = 0 AND fp.`id_product`='.(int) $id_product.' AND fp.`date_selection_type` = '.(int) HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE.' AND `is_special_days_exists`=0 AND `active`=1 AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` >= \''.pSQL($date).'\''