Merge branch 'develop' into gli-2206

This commit is contained in:
vishalsingh.qlo325
2025-05-15 10:18:40 +05:30
14 changed files with 506 additions and 319 deletions

View File

@@ -446,12 +446,11 @@
</label>
<div class="col-lg-9">
{include
file="controllers/products/textarea_lang.tpl"
file="controllers/normal_products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
class="autoload_rte"
input_value=$product->description_short
max=$PS_PRODUCT_SHORT_DESC_LIMIT}
maxlength=$PS_SHORT_DESC_LIMIT}
</div>
</div>
{* <div class="form-group">

View File

@@ -357,7 +357,7 @@
languages=$languages
input_name='description_short'
input_value=$product->description_short
maxlength=$PS_PRODUCT_SHORT_DESC_LIMIT}
maxlength=$PS_SHORT_DESC_LIMIT}
</div>
</div>
<div class="form-group">

View File

@@ -43,6 +43,8 @@ class ConfigurationCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
const PS_SHORT_DESC_LIMIT = 400;
/**
* @see ObjectModel::$definition
*/

View File

@@ -945,14 +945,12 @@ class ProductCore extends ObjectModel
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
if ($field == 'description_short') {
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 800;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$size_without_html = Tools::strlen(strip_tags($value));
$size_with_html = Tools::strlen($value);
$this->def['fields']['description_short']['size'] = $limit + $size_with_html - $size_without_html;
$this->def['fields']['description_short']['size'] = $limit;
}
return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
}

View File

@@ -655,33 +655,52 @@ class AdminNormalProductsControllerCore extends AdminController
}
}
}
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$className = 'Product';
foreach (Language::getLanguages(true) as $language) {
if (Tools::strlen(strip_tags($product->name[$language['id_lang']])) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
Tools::strlen(strip_tags($product->name[$language['id_lang']]))
);
}
}
unset($product->id);
unset($product->id_product);
$product->indexed = 0;
$product->active = 0;
if ($product->add()
&& Category::duplicateProductCategories($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
// && Product::duplicateFeatures($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)) {
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
if (!$this->errors) {
if ($product->add()
&& Category::duplicateProductCategories($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
// && Product::duplicateFeatures($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
) {
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
}
}
@@ -1408,8 +1427,7 @@ class AdminNormalProductsControllerCore extends AdminController
'ajaxfileupload',
'date',
'tagify',
'select2',
'validate'
'select2'
));
$this->addJS(array(
@@ -2160,15 +2178,15 @@ class AdminNormalProductsControllerCore extends AdminController
}
// Check description short size without html
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 400;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
foreach ($languages as $language) {
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) {
if (Tools::strlen(strip_tags($value)) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'),
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
@@ -3527,7 +3545,7 @@ class AdminNormalProductsControllerCore extends AdminController
'token' => $this->token,
'currency' => $currency,
'link' => $this->context->link,
'PS_PRODUCT_SHORT_DESC_LIMIT' => Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400
'PS_SHORT_DESC_LIMIT' => Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT
));
$data->assign($this->tpl_form_vars);

View File

@@ -82,16 +82,6 @@ class AdminPPreferencesControllerCore extends AdminController
1 => $this->l('Cart summary')
)
),*/
'PS_PRODUCT_SHORT_DESC_LIMIT' => array(
'title' => $this->l('Max size of short description'),
'hint' => $this->l('Set the maximum size of room type short description (in characters).'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('characters'),
'class' => 'fixed-width-xl',
'desc' => $this->l('If set to 0, the maximum limit will be 400 characters.')
),
/*'PS_QTY_DISCOUNT_ON_COMBINATION' => array(
'title' => $this->l('Quantity discounts based on'),
'hint' => $this->l('How to calculate quantity discounts.'),

View File

@@ -185,6 +185,16 @@ class AdminPreferencesControllerCore extends AdminController
'type' => 'text',
'class' => 'fixed-width-xxl'
),
'PS_SHORT_DESC_LIMIT' => array(
'title' => $this->l('Short description Max Size'),
'hint' => $this->l('Set the maximum size of room type, services and hotel short description (in characters).'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('characters'),
'class' => 'fixed-width-xl',
'desc' => sprintf($this->l('If set to 0, the maximum limit will be %d characters.'), Configuration::PS_SHORT_DESC_LIMIT)
),
// 'PS_DISPLAY_SUPPLIERS' => array(
// 'title' => $this->l('Display suppliers and manufacturers'),
// 'desc' => $this->l('Enable suppliers and manufacturers pages on your front office even when their respective modules are disabled.'),

View File

@@ -813,10 +813,24 @@ class AdminProductsControllerCore extends AdminController
$id_hotel_new = Tools::getValue('id_hotel');
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$className = 'Product';
if ($room_type_info && $room_type_info['id_hotel'] == $id_hotel_new) {
foreach (Language::getLanguages(true) as $language) {
$product->name[$language['id_lang']] = $product->name[$language['id_lang']].
' - '.$this->l('Duplicate');
if (Tools::strlen(strip_tags($product->description_short[$language['id_lang']])) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
Tools::strlen(strip_tags($product->description_short[$language['id_lang']]))
);
}
}
}
@@ -828,66 +842,69 @@ class AdminProductsControllerCore extends AdminController
foreach (Language::getLanguages(true) as $language) {
$product->link_rewrite[$language['id_lang']] = Tools::str2url($product->name[$language['id_lang']]);
}
if ($product->add()
// && Category::duplicateProductCategories($id_product_old, $product->id)
&& Product::duplicateSuppliers($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
&& Product::duplicateAccessories($id_product_old, $product->id)
&& Product::duplicateFeatures($id_product_old, $product->id)
&& Pack::duplicate($id_product_old, $product->id)
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
&& Product::duplicateDownload($id_product_old, $product->id)
) {
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$id_room_type_old = $room_type_info['id'];
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
if (!$this->errors) {
if ($product->add()
// && Category::duplicateProductCategories($id_product_old, $product->id)
&& Product::duplicateSuppliers($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
&& Product::duplicateAccessories($id_product_old, $product->id)
&& Product::duplicateFeatures($id_product_old, $product->id)
&& Pack::duplicate($id_product_old, $product->id)
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
&& Product::duplicateDownload($id_product_old, $product->id)
) {
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$id_room_type_old = $room_type_info['id'];
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$product->id,
$id_hotel_new,
true
);
if ($id_room_type_new) {
if (!HotelRoomType::duplicateRooms(
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$id_room_type_new,
$product->id,
$id_hotel_new
)) {
$this->errors[] = Tools::displayError('An error occurred while duplicating rooms.');
$id_hotel_new,
true
);
if ($id_room_type_new) {
if (!HotelRoomType::duplicateRooms(
$id_product_old,
$id_room_type_new,
$product->id,
$id_hotel_new
)) {
$this->errors[] = Tools::displayError('An error occurred while duplicating rooms.');
}
if (!HotelRoomTypeDemand::duplicateRoomTypeDemands($id_product_old, $product->id)) {
$this->errors[] = Tools::displayError(
'An error occurred while duplicating additional facilities.'
);
}
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
if (!HotelRoomTypeDemand::duplicateRoomTypeDemands($id_product_old, $product->id)) {
$this->errors[] = Tools::displayError(
'An error occurred while duplicating additional facilities.'
);
}
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
}
}
@@ -1503,8 +1520,7 @@ class AdminProductsControllerCore extends AdminController
'ajaxfileupload',
'date',
'tagify',
'select2',
'validate'
'select2'
));
$this->addJS(array(
@@ -2172,15 +2188,15 @@ class AdminProductsControllerCore extends AdminController
}
// Check description short size without html
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 400;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
foreach ($languages as $language) {
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) {
if (Tools::strlen(strip_tags($value)) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'),
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
@@ -4371,7 +4387,7 @@ class AdminProductsControllerCore extends AdminController
'token' => $this->token,
'currency' => $currency,
'link' => $this->context->link,
'PS_PRODUCT_SHORT_DESC_LIMIT' => Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400,
'PS_SHORT_DESC_LIMIT' => Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT,
'category_position' => Tools::getValue('category_position', $product->getPositionInCategory()),
));
$data->assign($this->tpl_form_vars);

View File

@@ -1197,6 +1197,23 @@ class HotelBranchInformation extends ObjectModel
return parent::validateFields($die, $error_return);
}
/**
* @see ObjectModel::validateField()
*/
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
if ($field == 'short_description') {
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$this->def['fields']['short_description']['size'] = $limit;
}
return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
}
// Webservice :: function will run when hotel deleted from API
public function deleteWs()
{

View File

@@ -123,6 +123,10 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['currentLang'] = Language::getLanguage((int) $currentLangId);
$smartyVars['defaultCurrency'] = Configuration::get('PS_CURRENCY_DEFAULT');
$smartyVars['PS_SHORT_DESC_LIMIT'] = Configuration::get('PS_SHORT_DESC_LIMIT');
if (!$smartyVars['PS_SHORT_DESC_LIMIT']) {
$smartyVars['PS_SHORT_DESC_LIMIT'] = Configuration::PS_SHORT_DESC_LIMIT;
}
$countries = Country::getCountries($this->context->language->id, true);
$smartyVars['country_var'] = $countries;
@@ -260,6 +264,7 @@ class AdminAddHotelController extends ModuleAdminController
$map_formated_address = Tools::getValue('locformatedAddr');
$map_input_text = Tools::getValue('googleInputField');
$hotelFeatures = Tools::getValue('id_features', array());
$shortDescriptionMaxChar = Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT;
// check if field is atleast in default language. Not available in default prestashop
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
@@ -276,45 +281,53 @@ class AdminAddHotelController extends ModuleAdminController
$this->errors[] = $this->l('Invalid Hotel name in ').$lang['name'];
}
}
if ($shortDescription = html_entity_decode(Tools::getValue('short_description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($shortDescription)) {
$this->errors[] = sprintf($this->l('Short description is not valid in %s'), $lang['name']);
}
}
if ($description = html_entity_decode(Tools::getValue('description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($description)) {
$this->errors[] = sprintf($this->l('Description is not valid in %s'), $lang['name']);
}
}
if ($policies = html_entity_decode(Tools::getValue('policies_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($policies)) {
$this->errors[] = sprintf($this->l('policies are not valid in %s'), $lang['name']);
}
}
}
foreach ($languages as $lang) {
if ($shortDescription = html_entity_decode(Tools::getValue('short_description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($shortDescription)) {
$this->errors[] = sprintf($this->l('Short description is not valid in %s'), $lang['name']);
}
if ($metaTitle = trim(Tools::getValue('meta_title_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaTitle)) {
$this->errors[] = $this->l('Invalid Meta title in ').$lang['name'];
} else if (Tools::strlen($metaTitle) > 128) {
$this->errors[] = $this->l('Meta title cannot be longer than 128 in ').$lang['name'];
}
$shortDescriptionLength = Tools::strlen($shortDescription);
if ($shortDescriptionLength > $shortDescriptionMaxChar) {
$this->errors[] = sprintf($this->l('Short description cannot exceed %s characters in '), $shortDescriptionMaxChar).$lang['name'];
}
}
if ($metaDescription = trim(Tools::getValue('meta_description_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaDescription)) {
$this->errors[] = $this->l('Invalid Meta description in ').$lang['name'];
} else if (Tools::strlen($metaDescription) > 255) {
$this->errors[] = $this->l('Meta description cannot be longer than 128 in ').$lang['name'];
}
if ($description = html_entity_decode(Tools::getValue('description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($description)) {
$this->errors[] = sprintf($this->l('Description is not valid in %s'), $lang['name']);
}
}
if ($policies = html_entity_decode(Tools::getValue('policies_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($policies)) {
$this->errors[] = sprintf($this->l('policies are not valid in %s'), $lang['name']);
}
}
if ($metaKeyWords = trim(Tools::getValue('meta_keywords_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaKeyWords)) {
$this->errors[] = $this->l('Invalid Meta keywords in ').$lang['name'];
} else if (Tools::strlen($metaKeyWords) > 255) {
$this->errors[] = $this->l('Meta keywords cannot be longer than 128 in ').$lang['name'];
}
if ($metaTitle = trim(Tools::getValue('meta_title_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaTitle)) {
$this->errors[] = $this->l('Invalid Meta title in ').$lang['name'];
} else if (Tools::strlen($metaTitle) > 128) {
$this->errors[] = $this->l('Meta title cannot exceed 128 characters in ').$lang['name'];
}
}
if ($metaDescription = trim(Tools::getValue('meta_description_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaDescription)) {
$this->errors[] = $this->l('Invalid Meta description in ').$lang['name'];
} else if (Tools::strlen($metaDescription) > 255) {
$this->errors[] = $this->l('Meta description cannot exceed 128 characters in ').$lang['name'];
}
}
if ($metaKeyWords = trim(Tools::getValue('meta_keywords_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaKeyWords)) {
$this->errors[] = $this->l('Invalid Meta keywords in ').$lang['name'];
} else if (Tools::strlen($metaKeyWords) > 255) {
$this->errors[] = $this->l('Meta keywords cannot exceed 128 characters in ').$lang['name'];
}
}
}
@@ -509,18 +522,16 @@ class AdminAddHotelController extends ModuleAdminController
);
}
$cleanShortDescription = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$lang['id_lang'])
);
$cleanShortDescription = Tools::getDescriptionClean(Tools::getValue('short_description_'.$lang['id_lang']));
//Remove TinyMCE's Non-Breaking Spaces
$cleanShortDescription = str_replace(chr(0xC2).chr(0xA0), "", $cleanShortDescription);
if (!trim($cleanShortDescription)) {
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getValue(
'short_description_'.$defaultLangId
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$defaultLangId)
);
} else {
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getValue(
'short_description_'.$lang['id_lang']
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$lang['id_lang'])
);
}
$cleanDescription = Tools::getDescriptionClean(

View File

@@ -189,8 +189,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
)) {
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
plan. Please select a different date range.');
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.');
return ;
}
}
@@ -202,17 +201,21 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
public function initToolbar()
{
parent::initToolbar();
$this->page_header_toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new rule'),
'imgclass' => 'new'
);
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new rule'),
'imgclass' => 'new'
);
}
$this->toolbar_btn = array();
}
public function renderList()
{
$this->addRowAction('edit');
$this->addRowAction('delete');
return parent::renderList();
}
@@ -245,17 +248,42 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$smartyVars['edit'] = 1;
$smartyVars['feature_price_groups'] = $objFeaturePrice->getGroups($idFeaturePrice);
} else {
$tree = new HelperTree('hotels-tree');
if ($treeData = HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
'selectedElements' => array(
'room_type' => Tools::getValue('room_type_box', array())
)
])) {
foreach ($treeData as $idHotel => $data) {
if (!isset($data['children']) || empty($data['children'])) {
unset($treeData[$idHotel]);
}
}
}
$tree->setData($treeData)
->setUseCheckBox(true)
->setAutoSelectChildren(true)
->setUseBulkActions(true)
->setUseSearch(true);
$smartyVars['hotel_tree'] = $tree->render();
}
$smartyVars['defaultcurrency_sign'] = $currencySign;
$smartyVars['date_from'] = $dateFrom;
$smartyVars['date_to'] = $dateTo;
$smartyVars['groups'] = Group::getGroups($this->context->language->id);
$this->context->smarty->assign($smartyVars);
$this->fields_form = array(
'submit' => array(
'title' => $this->l('Save'),
),
);
return parent::renderForm();
}
@@ -343,151 +371,196 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$groups = Tools::getValue('groupBox');
$jsonSpecialDays = json_encode($specialDays);
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
$createMultiple = Tools::getValue('create_multiple');
$objFeaturePricing = new HotelRoomTypeFeaturePricing();
if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) {
$priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE;
}
$languages = Language::getLanguages(false);
$objDefaultLang = new language($defaultLangId);
$objDefaultLang = new Language($defaultLangId);
if (!($priceRuleNameDefault = Tools::getValue('feature_price_name_'.$defaultLangId))) {
$this->errors[] = sprintf($this->l('Advanced price rule name is required at least in %s'), $objDefaultLang->name);
} else {
if (preg_match('{room_type_name}', $priceRuleNameDefault)) {
$priceRuleNameDefault = str_replace('{room_type_name}', '%s', $priceRuleNameDefault);
}
}
$toUpdatePriceRuleName = false;
$validateRules = call_user_func(
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
'HotelRoomTypeFeaturePricing'
);
foreach ($languages as $lang) {
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
if (preg_match('{room_type_name}', $priceRuleName)) {
$priceRuleName = str_replace('{room_type_name}', '%s', $priceRuleName);
$toUpdatePriceRuleName = true;
}
if (!Validate::isCatalogName($priceRuleName)) {
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name'];
} elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
$this->errors[] = sprintf(
$this->l('Advanced price rule Name field is too long (%d chars max) in ').$lang['name'],
$validateRules['sizeLang']['feature_price_name'],
);
}
}
$featurePricingName = array();
$roomTypeIds = array();
if (!$createMultiple) {
if ($roomTypeId) {
$roomTypeIds = array($roomTypeId);
} else {
$this->errors[] = $this->l('Room type is not selected. Please try again.');
}
} else if (!$roomTypeIds = Tools::getValue('room_type_box')) {
$this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.');
}
if ($roomTypeIds && !$this->errors) {
foreach ($roomTypeIds as $idRoomType) {
$objProduct = new Product((int) $idRoomType);
foreach ($languages as $lang) {
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
if ($priceRuleName && $toUpdatePriceRuleName) {
if (preg_match('{room_type_name}', $priceRuleName)) {
$priceRuleName = str_replace('{room_type_name}', $objProduct->name[$lang['id_lang']], $priceRuleName);
}
if (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
$this->errors[] = sprintf(
$this->l('Advanced price rule Name field is too long (%d chars max) for "%s" room type in ').$lang['name'],
$validateRules['sizeLang']['feature_price_name'],
$objProduct->name[$lang['id_lang']]
);
}
}
if ($priceRuleName) {
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleName;
} else {
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleNameDefault;
}
}
}
}
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) {
$dateFrom = $specificDate;
$dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate)));
} else if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
if ($dateFrom == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
if ($dateTo == '') {
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
}
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
if (!Validate::isDate($dateFrom)) {
$this->errors[] = $this->l('Invalid Date From.');
}
if (!Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Invalid Date To.');
}
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To cannot be smaller than Date From.');
}
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
}
} else {
if ($specificDate == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
$specificDate = date('Y-m-d', strtotime($specificDate));
if (!Validate::isDate($specificDate)) {
$this->errors[] = $this->l('Invalid Date From.');
}
}
if (!$impactValue) {
$this->errors[] = $this->l('Please enter a valid impact value.');
} else if (!Validate::isPrice($impactValue)) {
$this->errors[] = $this->l('Invalid value of impact value.');
}
if (!(bool)$groups) {
$this->errors[] = $this->l('Please select at least one group for the group access');
}
$isPlanTypeExists = 0;
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
} else {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
$roomTypeId,
$dateFrom,
$dateTo,
$groups,
$idFeaturePrice,
$isSpecialDaysExists,
$jsonSpecialDays
);
}
if ($isPlanTypeExists) {
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
plan. Please select a different date range.');
} else {
if (!$roomTypeId) {
$this->errors[] = $this->l('Room is not selected. Please try again.');
}
if (!Tools::getValue('feature_price_name_'.$defaultLangId)) {
$this->errors[] = sprintf(
$this->l('Advanced price rule name is required at least in %s'),
$objDefaultLang->name
if (empty($this->errors)) {
foreach ($roomTypeIds as $idRoomType) {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
$idRoomType,
$dateFrom,
$dateTo,
$groups,
$idFeaturePrice,
$isSpecialDaysExists,
$jsonSpecialDays
);
if ($isPlanTypeExists) {
$objProduct = new Product((int) $idRoomType, false, $this->context->language->id);
$this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name);
}
}
$validateRules = call_user_func(
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
'HotelRoomTypeFeaturePricing'
);
foreach ($languages as $language) {
if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) {
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name'];
} elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) {
sprintf(
$this->l('Advanced price rule Name field is too long (%2$d chars max).'),
$validateRules['sizeLang']['feature_price_name']
}
if (!$isPlanTypeExists && !count($this->errors)) {
if ($idFeaturePrice) {
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
}
// lang fields
$objFeaturePricing->date_selection_type = $dateSelectionType;
$objFeaturePricing->date_from = $dateFrom;
$objFeaturePricing->date_to = $dateTo;
$objFeaturePricing->impact_way = $priceImpactWay;
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
$objFeaturePricing->special_days = $jsonSpecialDays;
$objFeaturePricing->impact_type = $priceImpactType;
$objFeaturePricing->impact_value = $impactValue;
$objFeaturePricing->active = $enableFeaturePrice;
// set the values of the groups for this feature price
$objFeaturePricing->groupBox = $groups;
$objFeaturePricing->id_product = $roomTypeId;
if ($createMultiple) {
foreach ($roomTypeIds as $idRoomType) {
$objFeaturePricing->id_product = $idRoomType;
$objFeaturePricing->feature_price_name = $featurePricingName[$idRoomType];
$objFeaturePricing->add();
}
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
} else {
$objFeaturePricing->feature_price_name = $featurePricingName[$roomTypeId];
}
if ($objFeaturePricing->save()) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
'&update'.$this->table.'&conf=4&token='.$this->token
);
}
}
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
if ($dateFrom == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
if ($dateTo == '') {
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
}
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
if (!Validate::isDate($dateFrom)) {
$this->errors[] = $this->l('Invalid Date From.');
}
if (!Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Invalid Date To.');
}
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To must be a date after Date From.');
}
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
}
} else {
if ($specificDate == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
$specificDate = date('Y-m-d', strtotime($specificDate));
if (!Validate::isDate($specificDate)) {
$this->errors[] = $this->l('Invalid Date From.');
}
}
if (!$impactValue) {
$this->errors[] = $this->l('Please enter a valid impact value.');
} else {
if (!Validate::isPrice($impactValue)) {
$this->errors[] = $this->l('Invalid value of impact value.');
}
}
if (!(bool)$groups) {
$this->errors[] = $this->l('Please select at least one group for the group access');
}
if (!count($this->errors)) {
if ($idFeaturePrice) {
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
}
$objFeaturePricing->id_product = $roomTypeId;
// lang fields
foreach ($languages as $language) {
if (Tools::getValue('feature_price_name_'.$language['id_lang'])) {
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
'feature_price_name_'.$language['id_lang']
);
} else {
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
'feature_price_name_'.$defaultLangId
);
}
}
$objFeaturePricing->date_selection_type = $dateSelectionType;
$objFeaturePricing->date_from = $dateFrom;
$objFeaturePricing->date_to = $dateTo;
$objFeaturePricing->impact_way = $priceImpactWay;
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
$objFeaturePricing->special_days = $jsonSpecialDays;
$objFeaturePricing->impact_type = $priceImpactType;
$objFeaturePricing->impact_value = $impactValue;
$objFeaturePricing->active = $enableFeaturePrice;
// set the values of the groups for this feature price
$objFeaturePricing->groupBox = $groups;
if ($objFeaturePricing->save()) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
'&update'.$this->table.'&conf=4&token='.$this->token
);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
} else {
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
} else {
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
}
}
if (isset($idFeaturePrice) && $idFeaturePrice) {
@@ -499,15 +572,14 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
public function ajaxProcessSearchProductByName()
{
$productName = Tools::getValue('room_type_name');
if ($productName) {
$productsByName = Product::searchByName($this->context->language->id, $productName);
// filter room types as per accessed hotels
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
$productsByName,
$this->context->employee->id_profile
);
if ($productsByName) {
$response = array('status' => 'failed');
if ($productName = Tools::getValue('room_type_name')) {
if ($productsByName = Product::searchByName($this->context->language->id, $productName)) {
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
$productsByName,
$this->context->employee->id_profile
);
// filter room types as per accessed hotels
foreach ($productsByName as &$product) {
$hotelRoomType = new HotelRoomType();
$roomInfoByIdProduct = $hotelRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
@@ -517,22 +589,16 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$product['name'].= ' / '.$onjBranchInfo->hotel_name;
}
}
echo json_encode($productsByName, true);
die;
$response = $productsByName;
} else {
die(
json_encode(
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
)
);
$response['msg'] = $this->l('No match found for entered room type name.');
}
} else {
die(
json_encode(
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
)
);
$response['msg'] = $this->l('No match found for entered room type name.');
}
$this->ajaxDie(json_encode($response));
}
public function setMedia()

View File

@@ -553,6 +553,28 @@ $(document).ready(function() {
/* ---- AdminHotelFeaturePricesSettingsController Admin ---- */
if ($('input[name="create_multiple"]:checked').val() == 1) {
$('.room-type-name').hide();
$('.room-type-name-tree').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
} else {
$('.room-type-name').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
$('.room-type-name-tree').hide();
}
$(document).on('change', 'input[name="create_multiple"]', function() {
if ($('input[name="create_multiple"]:checked').val() == 1) {
$('.room-type-name').hide();
$('.room-type-name-tree').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
} else {
$('.room-type-name').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
$('.room-type-name-tree').hide();
}
});
$('#date_selection_type').on('change', function() {
if ($('#date_selection_type').val() == date_selection_types.specific) {
$(".specific_date_type").show(200);

View File

@@ -150,8 +150,9 @@
<textarea
name="short_description_{$language.id_lang}"
id="short_description_{$language.id_lang}"
{if isset($PS_SHORT_DESC_LIMIT) && $PS_SHORT_DESC_LIMIT} maxlength="{$PS_SHORT_DESC_LIMIT|intval}"{/if}
cols="2" rows="3"
class="wk_tinymce form-control">{if isset($smarty.post.$short_desc_name)}{$smarty.post.$short_desc_name}{elseif isset($edit)}{$hotel_info.short_description[{$language.id_lang}]}{/if}</textarea>
class="form-control">{if isset($smarty.post.$short_desc_name)}{$smarty.post.$short_desc_name}{elseif isset($edit)}{$hotel_info.short_description[{$language.id_lang}]}{/if}</textarea>
</div>
{/foreach}
</div>

View File

@@ -32,7 +32,7 @@
<div class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
{l s='Advanced Price Rule Name ' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
{foreach from=$languages item=language}
@@ -55,43 +55,80 @@
</ul>
</div>
{/if}
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">
{l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'}
</div>
</div>
</div>
{if !isset($objFeaturePrice) || !$objFeaturePrice->id}
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to create advance price rules for multiple room types.' mod='hotelreservationsystem'}">
{l s='Create for multiple room types' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9 ">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" {if isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 1}checked="checked" {/if} value="1" id="create_multiple_on" name="create_multiple">
<label for="create_multiple_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input {if !isset($smarty.post.create_multiple) || isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 0} checked="checked" {/if} type="radio" value="0" id="create_multiple_off" name="create_multiple">
<label for="create_multiple_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
{if isset($hotel_tree)}
<div class="form-group room-type-name-tree" style="display:none;">
<label class="col-sm-3 control-label required" for="feature_price_name" >
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Select the room types for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}">
{l s='Room Types' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-sm-7">
{$hotel_tree}
</div>
</div>
{/if}
{/if}
<div class="form-group room-type-name">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Room Type :' mod='hotelreservationsystem'}
{l s='Room Type' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input autocomplete="off" type="text" id="room_type_name" name="room_type_name" class="form-control" placeholder= "{l s='Enter room type name' mod='hotelreservationsystem'}" value="{if isset($productName)}{$productName}{/if}"/>
<input type="hidden" id="room_type_id" name="room_type_id" class="form-control" value="{if isset($objFeaturePrice->id_product)}{$objFeaturePrice->id_product}{else}0{/if}"/>
<div class="dropdown">
<ul class="room_type_search_results_ul"></ul>
</div>
<ul class="room_type_search_results_ul"></ul>
</div>
<p class="error-block" style="display:none; color: #CD5D5D;">{l s='No match found for this search. Please try with an existing name.' mod='hotelreservationsystem'}</p>
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
</div>
</div>
</div>
<div class="form-group">
<label for="date_selection_type" class="control-label col-lg-3">
{l s='Date Selection type :' mod='hotelreservationsystem'}
{l s='Date Selection type' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="date_selection_type" id="date_selection_type">
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}selected = "selected"{/if}>
{l s='Date Range' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}selected = "selected"{/if}>
{l s='Specific Date' mod='hotelreservationsystem'}
</option>
</select>
</div>
</div>
<div class="form-group specific_date_type" {if isset($edit) && $edit}{if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}{else}style="display:none;"{/if}>
<div class="form-group specific_date_type" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}style="display:none;"{else if !isset($edit) && !isset($smarty.post.date_selection_type)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="specific_date" >
{l s='Specific Date' mod='hotelreservationsystem'}
</label>
@@ -100,24 +137,24 @@
</div>
</div>
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="date_form" >
{l s='Date From' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($smarty.post.date_from) && $smarty.post.date_from}{$smarty.post.date_from}{elseif isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
</div>
</div>
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="date_to" >
{l s='Date To' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($smarty.post.date_to) && $smarty.post.date_to}{$smarty.post.date_to}{elseif isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
</div>
</div>
<div class="form-group special_days_content" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group special_days_content" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to restrict this rule to specific week days (for example, weekends) of the selected date range. If disabled, rule will be applicable to all week days.' mod='hotelreservationsystem'}">
{l s='Restrict to Week Days' mod='hotelreservationsystem'}
@@ -127,7 +164,7 @@
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 1}checked="checked"{elseif isset($edit) && $objFeaturePrice->is_special_days_exists == 1}checked="checked"{/if} value="1" id="is_special_days_exists_on" name="is_special_days_exists">
<label for="is_special_days_exists_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input {if isset($edit) && $objFeaturePrice->is_special_days_exists == 0} checked="checked" {elseif !isset($smarty.post.is_special_days_exists) && !isset($edit)}checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
<input {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 0} checked="checked" {elseif (isset($edit) && $objFeaturePrice->is_special_days_exists == 0) || !isset($edit)} checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
@@ -135,7 +172,7 @@
</div>
<div class="form-group week_days" {if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists) || (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}style="display:block;"{/if}>
<label for="Price Impact Way" class="control-label col-lg-3">
<label for="special_days" class="control-label col-lg-3">
{l s='Select Week Days' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3 checkboxes-wrap">
@@ -200,17 +237,17 @@
<div class="form-group">
<label for="Price Impact Way" class="control-label col-lg-3">
{l s='Impact Way :' mod='hotelreservationsystem'}
{l s='Impact Way' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="price_impact_way" id="price_impact_way">
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Decrease Price' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Increase Price' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Fixed Price' mod='hotelreservationsystem'}
</option>
</select>
@@ -219,14 +256,14 @@
<div class="form-group">
<label for="Price Impact Type" class="control-label col-lg-3">
{l s='Impact Type :' mod='hotelreservationsystem'}
{l s='Impact Type' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="price_impact_type" id="price_impact_type" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}disabled="disabled"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}selected = "selected"{/if}>
<select class="form-control" name="price_impact_type" id="price_impact_type" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}disabled="disabled"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
{l s='Percentage' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way)) || (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
{l s='Amount' mod='hotelreservationsystem'}
</option>
</select>