Merge branch 'develop' into gli-2032

This commit is contained in:
vishalsingh.qlo325
2024-06-28 15:17:44 +05:30
56 changed files with 7687 additions and 7175 deletions

View File

@@ -54,7 +54,16 @@ class AdminMaintenanceControllerCore extends AdminController
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'class' => "hello"
'form_group_class' => (Tools::getValue('PS_SHOP_ENABLE', Configuration::get('PS_SHOP_ENABLE'))) ? 'collapse' : '',
),
'PS_ALLOW_EMP_MAX_ATTEMPTS' => array(
'title' => $this->l('Maximum Login Attempts'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'class' => 'fixed-width-xl',
'desc' => sprintf($this->l('Set the number of maximum login attempts allowed in %d minutes. Set to 0 to disable this feature.'), MaintenanceAccess::LOGIN_ATTEMPTS_WINDOW),
'form_group_class' => ((Tools::getValue('PS_SHOP_ENABLE', Configuration::get('PS_SHOP_ENABLE'))) || !(Tools::getValue('PS_ALLOW_EMP', Configuration::get('PS_ALLOW_EMP')))) ? ' collapse' : '',
),
'PS_MAINTENANCE_IP' => array(
'title' => $this->l('Maintenance IP'),
@@ -69,9 +78,44 @@ class AdminMaintenanceControllerCore extends AdminController
);
}
public function postProcess()
{
if (Tools::isSubmit('submitOptionsconfiguration')) {
$shopEnable = Tools::getValue('PS_SHOP_ENABLE');
$allowEmp = Tools::getValue('PS_ALLOW_EMP');
$allowEmpMaxAttempts = trim(Tools::getValue('PS_ALLOW_EMP_MAX_ATTEMPTS'));
$maintenanceIp = trim(Tools::getValue('PS_MAINTENANCE_IP'));
// validations
if (!$shopEnable && $allowEmp) {
if ($allowEmpMaxAttempts == '') {
$this->errors[] = $this->l('Maximum Login Attempts is a required field.');
} elseif (!Validate::isUnsignedInt($allowEmpMaxAttempts)) {
$this->errors[] = $this->l('Maximum Login Attempts is invalid. Please enter a value greater than or equal to 0.');
}
}
// update values
if (!count($this->errors)) {
Configuration::updateValue('PS_SHOP_ENABLE', $shopEnable);
Configuration::updateValue('PS_MAINTENANCE_IP', $maintenanceIp);
if (!$shopEnable) {
Configuration::updateValue('PS_ALLOW_EMP', $allowEmp);
if ($allowEmp) {
Configuration::updateValue('PS_ALLOW_EMP_MAX_ATTEMPTS', $allowEmpMaxAttempts);
}
}
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=6');
}
}
}
public function setMedia()
{
parent::setMedia();
$this->addJS(_PS_JS_DIR_.'maintenance.js');
$this->addJS(_PS_JS_DIR_.'/admin/maintenance.js');
}
}

View File

@@ -186,19 +186,17 @@ class AdminNormalProductsControllerCore extends AdminController
$id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default';
$this->_join .= ' JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (a.`id_product` = hrt.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hb ON (hrt.`id_hotel` = hb.`id`)
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl ON (hb.`id` = hbl.`id` AND b.`id_lang` = hbl.`id_lang`)
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`)
LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)';
LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (rsp.`id_element` = hrt.`id_product` AND rsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.')
'.HotelBranchInformation::addHotelRestriction(false, 'hrt');
$this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, IF(a.`show_at_front`, "'.$this->l('Yes').'", "'.$this->l('No').'") as show_at_front_txt, IF(a.`price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', "'.$this->l('Per Day').'", "'.$this->l('Per Booking').'") as price_calculation_method_txt, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
$this->_select .= ' COUNT(rsp.`id_product`) as products_associated, hrt.`adults`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, ';
$this->_select .= ' COUNT(hrt.`id_product`) as products_associated, ';
$this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, ';
$this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`';

View File

@@ -3272,22 +3272,26 @@ class AdminProductsControllerCore extends AdminController
$this->errors[] = Tools::displayError('Invalid base children');
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
if ($baseChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
$this->errors[] = sprintf(Tools::displayError('Base children cannot be greater than max childern allowed on your website (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
$this->errors[] = sprintf(Tools::displayError('Base children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
}
}
if (!$maxAdults || !Validate::isUnsignedInt($maxAdults)) {
$this->errors[] = Tools::displayError('Invalid maximum number of adults');
} elseif ($maxAdults < $baseAdults) {
$this->errors[] = Tools::displayError('Maximum number of adults cannot be less than base adults');
} elseif ($maxAdults > $maxGuests) {
$this->errors[] = Tools::displayError('Maximum number of adults cannot be more than maximum number of guests');
}
if ($maxChildren == '' || !Validate::isUnsignedInt($maxChildren)) {
$this->errors[] = Tools::displayError('Invalid maximum number of children');
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
if ($maxChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
$this->errors[] = sprintf(Tools::displayError('Maximum number of children cannot be greater than max childern allowed on your website (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
}
} elseif ($maxChildren < $baseChildren) {
$this->errors[] = Tools::displayError('Maximum number of children cannot be less than base children');
} elseif ($maxChildren >= $maxGuests) {
$this->errors[] = Tools::displayError('Maximum number of children cannot be more or equal than maximum number of guests.(1 adult is mandatory in a room)');
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
if ($maxChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
$this->errors[] = sprintf(Tools::displayError('Maximum number of children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
}
}
if (!$maxGuests || !Validate::isUnsignedInt($maxGuests)) {
$this->errors[] = Tools::displayError('Invalid maximum number of guests');

View File

@@ -677,6 +677,8 @@ class AdminThemesControllerCore extends AdminController
if (!count($this->errors)) {
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminThemes').'&conf=6');
} else {
$this->redirect_after = '';
}
}
@@ -1981,7 +1983,7 @@ class AdminThemesControllerCore extends AdminController
}
}
if ($xml_version_too_old && !$this->_checkConfigForFeatures(array_keys(AdminThemes::$check_features))) {
$this->errors[] .= Tools::displayError('The config.xml file has not been created for this version of PrestaShop.');
$this->errors[] = Tools::displayError('The config.xml file has not been created for this version of QloApps.');
$return = false;
}