diff --git a/admin/themes/default/template/controllers/normal_products/informations.tpl b/admin/themes/default/template/controllers/normal_products/informations.tpl
index a9ad62206..74d3a5b85 100644
--- a/admin/themes/default/template/controllers/normal_products/informations.tpl
+++ b/admin/themes/default/template/controllers/normal_products/informations.tpl
@@ -446,12 +446,11 @@
{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}
{*
diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl
index 201cbc41d..9cb9e5a1a 100644
--- a/admin/themes/default/template/controllers/products/informations.tpl
+++ b/admin/themes/default/template/controllers/products/informations.tpl
@@ -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}
diff --git a/classes/Configuration.php b/classes/Configuration.php
index 8b3392b25..85d5f0828 100644
--- a/classes/Configuration.php
+++ b/classes/Configuration.php
@@ -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
*/
diff --git a/classes/Product.php b/classes/Product.php
index 3c34bd1c3..ac8f01e6f 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -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);
}
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index b3f3b4c1a..66dc1c963 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -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);
diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php
index c54c25390..5e8c7707f 100644
--- a/controllers/admin/AdminPPreferencesController.php
+++ b/controllers/admin/AdminPPreferencesController.php
@@ -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.'),
diff --git a/controllers/admin/AdminPreferencesController.php b/controllers/admin/AdminPreferencesController.php
index 0881b5616..a97ec7b54 100644
--- a/controllers/admin/AdminPreferencesController.php
+++ b/controllers/admin/AdminPreferencesController.php
@@ -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.'),
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index 7e6d5908f..f1038c05d 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -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);
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
index d831ca6e3..b75340770 100644
--- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
@@ -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()
{
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
index 89f4df737..9b92aaa73 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
@@ -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(
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php
index 0652f90c7..0635c619c 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php
@@ -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()
diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
index ade1d9abc..75160764d 100644
--- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
+++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
@@ -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);
diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl
index 1f5ea4578..b473873ee 100644
--- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl
+++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl
@@ -150,8 +150,9 @@
+ 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}
{/foreach}
diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl
index d1191997d..875e3957b 100644
--- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl
+++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl
@@ -32,7 +32,7 @@
+ {if !isset($objFeaturePrice) || !$objFeaturePrice->id}
+
+ {if isset($hotel_tree)}
+
+ {/if}
+ {/if}
+
+
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
-
-
-