Merge branch 'Qloapps:develop' into develop

This commit is contained in:
ambuj
2026-10-21 17:25:00 +05:30
committed by GitHub
189 changed files with 10255 additions and 402 deletions

View File

@@ -18,6 +18,13 @@ $cms_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_pr
if (!$products_accesses['edit'] && !$cms_accesses['edit']) {
die(Tools::displayError());
}
$tokenTab = $products_accesses['edit'] ? 'AdminProducts' : 'AdminCmsContent';
$isMutatingRequest = isset($_POST['submit']) || in_array(basename($_SERVER['SCRIPT_NAME']), array('execute.php', 'upload.php', 'ajax_calls.php'), true);
if ($isMutatingRequest && (!isset($_REQUEST['token']) || !hash_equals(Tools::getAdminTokenLite($tokenTab), (string) $_REQUEST['token']))) {
die('invalid token');
}
//------------------------------------------------------------------------------
// DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
//------------------------------------------------------------------------------

View File

@@ -2,6 +2,7 @@
include('config/config.php');
$_SESSION["verify"] = "RESPONSIVEfilemanager";
$fmTokenValue = Tools::getAdminTokenLite($products_accesses['edit'] ? 'AdminProducts' : 'AdminCmsContent');
if (isset($_POST['submit'])) {
include('upload.php');
@@ -242,6 +243,7 @@ if (isset($_POST['submit'])) {
<script>
var ext_img = new Array('<?php echo implode("','", $ext_img)?>');
var allowed_ext = new Array('<?php echo implode("','", $ext)?>');
var fmToken = "<?php echo $fmTokenValue; ?>";
var loading_bar =<?php echo $loading_bar?"true":"false";
?>;
var image_editor =<?php echo $aviary_active?"true":"false";
@@ -257,6 +259,7 @@ if (isset($_POST['submit'])) {
maxFilesize: <?php echo $MaxSizeUpload;
?>, // MB
url: "upload.php",
params: {token: fmToken},
accept: function (file, done) {
var extension = file.name.split('.').pop();
extension = extension.toLowerCase();
@@ -286,7 +289,7 @@ if (isset($_POST['submit'])) {
$.ajax({
type: "POST",
url: "ajax_calls.php?action=save_img",
data: { url: newURL, path: $('#sub_folder').val() + $('#fldr_value').val(), name: $('#aviary_img').data('name') }
data: { url: newURL, path: $('#sub_folder').val() + $('#fldr_value').val(), name: $('#aviary_img').data('name'), token: fmToken }
}).done(function (msg) {
featherEditor.close();
d = new Date();
@@ -391,6 +394,7 @@ if (isset($_POST['submit'])) {
?>"/>
<input type="hidden" name="path_thumb" value="<?php echo Tools::safeOutput($subfolder.$subdir);
?>"/>
<input type="hidden" name="token" value="<?php echo Tools::safeOutput($fmTokenValue); ?>"/>
<div class="fallback">
<?php echo lang_Upload_file ?>:<br/>
@@ -1138,6 +1142,7 @@ if (isset($_POST['submit'])) {
?>"
title="<?php echo lang_Preview ?>" data-url="ajax_calls.php?action=media_preview&title=<?php echo Tools::safeOutput($filename);
?>&file=<?php echo Tools::safeOutput(Context::getContext()->shop->physical_uri.'img/cms/'.$subfolder.$subdir.$file);
?>&token=<?php echo urlencode($fmTokenValue);
?>"
href="javascript:void('');"><i class=" icon-eye-open"></i></a>
<?php

View File

@@ -35,7 +35,7 @@ $(document).ready(function(){
$.ajax({
type: "POST",
url: "ajax_calls.php?action=extract",
data: { path: m }
data: { path: m, token: fmToken }
}).done(function( msg ) {
if (msg!="")
bootbox.alert(msg);
@@ -220,7 +220,7 @@ $(document).ready(function(){
sortDescending=!sortDescending;
if (js_script) {
$.ajax({
url: "ajax_calls.php?action=sort&sort_by="+_this.attr('data-sort')+"&descending="+sortDescending
url: "ajax_calls.php?action=sort&sort_by="+_this.attr('data-sort')+"&descending="+sortDescending+"&token="+encodeURIComponent(fmToken)
}).done(function( msg ) {
});
@@ -318,7 +318,7 @@ $(document).ready(function(){
$.ajax({
type: "POST",
url: "execute.php?action=create_folder",
data: {path: folder_path, path_thumb: folder_path_thumb}
data: {path: folder_path, path_thumb: folder_path_thumb, token: fmToken}
}).done(function( msg ) {
setTimeout(function(){window.location.href = $('#refresh').attr('href') + '&' + new Date().getTime();},300);
@@ -336,7 +336,7 @@ $(document).ready(function(){
_this.find('i').addClass('icon-white');
$.ajax({
url: "ajax_calls.php?action=view&type="+_this.attr('data-value')
url: "ajax_calls.php?action=view&type="+_this.attr('data-value')+"&token="+encodeURIComponent(fmToken)
}).done(function( msg ) {
if (msg!="") {
bootbox.alert(msg);
@@ -719,7 +719,7 @@ function execute_action(action,file1,file2,name,container,function_name){
$.ajax({
type: "POST",
url: "execute.php?action="+action,
data: {path: file1, path_thumb: file2, name: name.replace('/','')}
data: {path: file1, path_thumb: file2, name: name.replace('/',''), token: fmToken}
}).done(function( msg ) {
if (msg!="") {
bootbox.alert(msg);

File diff suppressed because one or more lines are too long

View File

@@ -25,8 +25,34 @@
{extends file="helpers/form/form.tpl"}
{block name="input_row"}
<style>
#logo_image-images-thumbnails img {
max-width: 80px;
max-height: 80px;
padding: 5px;
}
</style>
{$smarty.block.parent}
{if $input.name == 'name'}
{hook h="displayFeatureForm" id_feature=$form_id}
{/if}
{if $input.name == 'logo_icon'}
<script type="text/javascript">
$(document).ready(function() {
// the uploader renders its own nested .form-group, so pick the field row that holds the label
function getFieldRow(selector) {
return $(selector).parents('.form-group').filter(function() {
return $(this).children('label.control-label').length > 0;
}).first();
}
function toggleFeatureLogoType() {
var isIcon = $('#logo_type').val() === 'icon';
getFieldRow('#logo_image').toggle(!isIcon);
getFieldRow('#logo_icon').toggle(isIcon);
}
$('#logo_type').on('change', toggleFeatureLogoType);
toggleFeatureLogoType();
});
</script>
{/if}
{/block}

View File

@@ -62,7 +62,7 @@
</th>
<th class="col-sm-2 center">
<label class="control-label">
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Set date ranges when %s is set to Temporarily Inactive.' sprintf=$htl_room_type['selling_object_plural_name']}">
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Set date ranges when %s are not available for booking.' sprintf=$htl_room_type['selling_object_plural_name']}">
{l s='Disable Dates'}
</span>
</label>
@@ -111,9 +111,9 @@
<input type="text" class="form-control room_comment" value="{if isset($room_info['comment'])}{$room_info['comment']|escape:'html':'UTF-8'}{/if}" name="{$var_name_room_info|cat:'[comment]'}">
</td>
<td class="col-sm-2 center">
<a class="btn btn-default deactiveDatesModal {if $room_info['id_status'] != $rm_status['STATUS_TEMPORARY_INACTIVE']['id'] }disabled{/if}" data-toggle="modal" data-target="#deactiveDatesModal" data-id-room="{if isset($room_info['id'])}{$room_info['id']}{/if}">{if $room_info['id_status'] != $rm_status['STATUS_TEMPORARY_INACTIVE']['id'] }{l s='Add Dates'}{else}{l s='View Dates'}{/if}
<a class="btn btn-default deactiveDatesModal" data-toggle="modal" data-target="#deactiveDatesModal" data-id-room="{if isset($room_info['id'])}{$room_info['id']}{/if}">{if isset($room_info['disable_dates_json']) && json_decode($room_info['disable_dates_json'])}{l s='View Dates'}{else}{l s='Add Dates'}{/if}
</a>
<input type="hidden" class="form-control disable_dates_json" name="{$var_name_room_info|cat:'[disable_dates_json]'}" {if $room_info['id_status'] == $rm_status['STATUS_TEMPORARY_INACTIVE']['id']}value="{$room_info['disable_dates_json']|escape:'html':'UTF-8'}"{/if}>
<input type="hidden" class="form-control disable_dates_json" name="{$var_name_room_info|cat:'[disable_dates_json]'}" {if isset($room_info['disable_dates_json'])}value="{$room_info['disable_dates_json']|escape:'html':'UTF-8'}"{/if}>
</td>
{* Since the data can also be used from post incase of errors, which will cause issues with the id index *}
<td class="col-sm-1 center">
@@ -381,7 +381,7 @@
<input type="text" name="bulk_update_room_comment"/>
</div>
</div>
<div class="from-group table-responsive-row clearfix" style="display:none;">
<div class="from-group table-responsive-row clearfix">
<div class="rooms-disable-dates-title">{l s='Disable Dates'}</div>
<table class="table rooms-disable-dates">
<thead>
@@ -495,7 +495,7 @@
<input type="text" name="bulk_create_room_comment"/>
</div>
</div>
<div class="from-group table-responsive-row clearfix" style="display:none;">
<div class="from-group table-responsive-row clearfix">
<div class="rooms-disable-dates-title">{l s='Disable Dates'}</div>
<table class="table rooms-disable-dates">
<thead>
@@ -785,16 +785,6 @@
});
});
// on changing the room status as disabled for some date range
$(document).on('change', '.room_status', function(){
var status_val = $(this).val();
if (status_val == rm_status.STATUS_TEMPORARY_INACTIVE.id) {
$(this).closest('.room_data_values').find('.deactiveDatesModal').removeClass('disabled');
} else {
$(this).closest('.room_data_values').find('.deactiveDatesModal').addClass('disabled');
}
});
// Initializing datepicker for date from for the disable dates calendar
$('#disable_dates_form .date_from_container').datepicker({
showOtherMonths: true,
@@ -1023,6 +1013,7 @@
const roomRowIndex = parseInt($('#deactiveDatesModal').attr('data-room-row-index'));
const roomRow = $('#product-configuration .hotel-room tr.room_data_values[data-row-index='+roomRowIndex+']');
$(roomRow).find('.disable_dates_json').val(JSON.stringify(disableDates));
$(roomRow).find('.deactiveDatesModal').text(disableDates.length ? '{l s='View Dates'}' : '{l s='Add Dates'}');
DisableDatesObj.reset();
DisableDatesObj.allowCalendarActions();
});
@@ -1059,15 +1050,6 @@
BulkUpdateRoomModal.submitBulkDelete();
});
$(document).on('change', 'select[name="bulk_update_room_status"], select[name="bulk_create_room_status"]', function(){
var status_val = $(this).val();
if (status_val == rm_status.STATUS_TEMPORARY_INACTIVE.id) {
$(this).closest('.modal-body').find('.rooms-disable-dates').parent().show();
} else {
$(this).closest('.modal-body').find('.rooms-disable-dates').parent().hide();
}
});
$(document).on('focus', '.disabled_date_from, .disabled_date_to', function () {
$('.disabled_date_from').datepicker({
showOtherMonths: true,
@@ -1109,7 +1091,7 @@
$('#bulkUpdateRoomModal').on('show.bs.modal', function(e){
if (!$(e.relatedTarget).attr('disabled')) {
$('#bulkUpdateRoomModal table tbody').html('');
$('.bulk_update_room_status').val('0').closest('.modal-body').find('.rooms-disable-dates').parent().hide();
$('.bulk_update_room_status').val('0');
$('[name="bulk_update_room_comment"]').val('');
$('[name="bulk_update_room_floor"]').val('');
$('#page-loader').show();
@@ -1125,7 +1107,7 @@
$('#bulkCreateRoomModal').on('show.bs.modal', function(e){
$('#bulkCreateRoomModal table tbody').html('');
$('.bulk_create_room_status').val(rm_status.STATUS_ACTIVE.id).closest('.modal-body').find('.rooms-disable-dates').parent().hide();
$('.bulk_create_room_status').val(rm_status.STATUS_ACTIVE.id);
$('[name="bulk_create_room_comment"]').val('');
$('[name="bulk_create_room_floor"]').val('');
$('[name="bulk_create_room_prefix"]').val(''),

View File

@@ -29,6 +29,9 @@ class FeatureCore extends ObjectModel
/** @var string Name */
public $name;
public $position;
public $logo_type;
public $logo;
public $is_featured;
/**
* @see ObjectModel::$definition
@@ -39,6 +42,9 @@ class FeatureCore extends ObjectModel
'multilang' => true,
'fields' => array(
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'logo_type' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 10),
'logo' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255),
'is_featured' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
/* Lang fields */
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
@@ -117,11 +123,16 @@ class FeatureCore extends ObjectModel
$this->position = Feature::getHigherPosition() + 1;
}
$return = parent::add($autodate, true);
$return = parent::add($autodate, $nullValues);
Hook::exec('actionFeatureSave', array('id_feature' => $this->id));
return $return;
}
public static function getLogoImageName($idFeature, $logo)
{
return preg_match('/^[A-Za-z0-9_]+\.jpg$/', (string) $logo) ? $logo : (int) $idFeature.'.jpg';
}
public function delete()
{
/* Also delete related attributes */

View File

@@ -4859,7 +4859,7 @@ class ProductCore extends ObjectModel
}
if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache)) {
self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT name, value, pf.id_feature
SELECT name, value, pf.id_feature, f.logo_type, f.logo, f.is_featured
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
@@ -4868,6 +4868,10 @@ class ProductCore extends ObjectModel
WHERE pf.id_product = '.(int)$id_product.'
ORDER BY f.position ASC'
);
foreach (self::$_frontFeaturesCache[$id_product.'-'.$id_lang] as &$frontFeature) {
$frontFeature['logo_image'] = Feature::getLogoImageName($frontFeature['id_feature'], $frontFeature['logo']);
}
unset($frontFeature);
}
return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
}
@@ -7045,6 +7049,12 @@ class ProductCore extends ObjectModel
$feature['value'] = (int) $feature['id_feature'];
$feature['input_name'] = 'feature_value_parents';
$feature['children'] = array();
if (!empty($feature['is_featured'])) {
$feature['badge'] = array(
'class' => 'badge-success',
'title' => Translate::getAdminTranslation('Featured', 'AdminProducts'),
);
}
$selectedValues = isset($selectedFeatureValues[(int) $feature['id_feature']])
? $selectedFeatureValues[(int) $feature['id_feature']]
: array();

View File

@@ -397,6 +397,8 @@ class ValidateCore
*/
public static function isCleanHtml($html, $allow_iframe = false)
{
$html = (string) $html;
$eventAttributeRegex = '/<\s*\w+[^>]*\s(on\w+)=["\'][^"\']*["\']/ims';
$events = 'onabort|onactivate|onactive|onaddsourcebuffer|onaddstream|onaddtrack|onafterprint|onafterscriptexecute|onafterupdate|onalerting|onanimationcancel|onanimationend|onanimationiteration|onanimationstart'

View File

@@ -1768,7 +1768,6 @@ class FrontControllerCore extends Controller
'categoriescmsTree' => CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1),
'voucherAllowed' => (int)CartRule::isFeatureActive(),
'PS_DISPLAY_BEST_SELLERS' => Configuration::get('PS_DISPLAY_BEST_SELLERS'),
'display_store' => Configuration::get('PS_STORES_DISPLAY_SITEMAP'),
'conditions' => Configuration::get('PS_CONDITIONS'),
'id_cgv' => Configuration::get('PS_CONDITIONS_CMS_ID'),
'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'),

View File

@@ -141,6 +141,8 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
$serviceGroups = array();
$roomTypeRows = array();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
foreach ($bookings as $booking) {
$nights = (int)HotelHelper::getNumberOfDays($booking['date_from'], $booking['date_to']);
if ($nights <= 0) {
@@ -160,7 +162,6 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
$bookingServices = array();
// Auto-added services bundled with room price (for cost calculation only)
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$autoAddedWithRoomPriceTaxExcl = (float)$objServiceProductOrderDetail->getRoomTypeServiceProducts(
(int)$this->order->id, 0, 0,
isset($booking['id_product']) ? (int)$booking['id_product'] : 0,
@@ -245,6 +246,43 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
}
unset($roomTypeRow);
// --- Hotel products ---
$hotelProducts = array();
$products = $objServiceProductOrderDetail->getServiceProductsInOrder(
(int) $this->order->id,
0,
0,
Product::SELLING_PREFERENCE_WITH_HOTEL
);
if (is_array($products)) {
foreach ($products as $product) {
$taxLabel = self::l('No tax');
if ($taxes = OrderDetail::getTaxListStatic((int) $product['id_order_detail'])) {
$taxTemp = array();
foreach ($taxes as $tax) {
$objTax = new Tax($tax['id_tax']);
$taxTemp[] = sprintf(self::l('%1$s%2$s%%'), $objTax->rate + 0, '&nbsp;');
}
$taxLabel = implode(', ', $taxTemp);
}
$hotelName = '';
if (!empty($product['id_hotel'])) {
$objProductHotel = new HotelBranchInformation((int) $product['id_hotel'], (int) $this->order->id_lang);
$hotelName = $objProductHotel->hotel_name;
}
$hotelProducts[] = array(
'name' => $product['name'].(!empty($product['option_name']) ? ' : '.$product['option_name'] : ''),
'hotel_name' => $hotelName,
'tax_label' => $taxLabel,
'quantity' => (int) $product['quantity'],
'unit_price_tax_excl' => (float) $product['unit_price_tax_excl'],
'total_price_tax_excl' => (float) $product['total_price_tax_excl'],
);
}
}
$guestAddress = '';
$guest = new Customer((int)$this->order->id_customer);
@@ -353,6 +391,7 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
'total_room_nights' => (int)$totalRoomNights,
'room_type_rows' => array_values($roomTypeRows),
'service_groups' => $serviceGroups,
'hotel_products' => $hotelProducts,
'payment_method' => $paymentMethod,
'footer' => $footer,
'payment_policy' => $paymentPolicy,

View File

@@ -19,7 +19,7 @@
<meta meta_page="new-products" left="1" right="0"/>
<meta meta_page="password" left="0" right="0"/>
<!-- <meta meta_page="prices-drop" left="1" right="0"/> -->
<!-- <meta meta_page="sitemap" left="1" right="0"/> -->
<meta meta_page="sitemap" left="0" right="0"/>
<meta meta_page="supplier" left="0" right="0"/>
<meta meta_page="address" left="0" right="0"/>
<meta meta_page="addresses" left="0" right="0"/>

View File

@@ -52,19 +52,20 @@ class AdminFeaturesControllerCore extends AdminController
'align' => 'center',
'class' => 'fixed-width-xs'
),
'logo' => array(
'title' => $this->l('Icon'),
'align' => 'text-center',
'callback' => 'displayLogo',
'orderby' => false,
'search' => false,
'class' => 'fixed-width-xs'
),
'name' => array(
'title' => $this->l('Name'),
'width' => 'auto',
'filter_key' => 'b!name'
),
'logo' => array(
'title' => $this->l('Icon'),
'align' => 'text-center',
'image' => 'rf',
'orderby' => false,
'search' => false,
'class' => 'fixed-width-xs'
),/*by webkul to show feature image*/
/*by webkul to show feature image*/
/*'value' => array(
'title' => $this->l('Values'),
'orderby' => false,
@@ -72,6 +73,16 @@ class AdminFeaturesControllerCore extends AdminController
'align' => 'center',
'class' => 'fixed-width-xs'
),*/
'is_featured' => array(
'title' => $this->l('Is Featured'),
'type' => 'bool',
'active' => 'is_featured',
'align' => 'center',
'filter_key' => 'a!is_featured',
'filter_type' => 'int',
'class' => 'fixed-width-sm',
'orderby' => false
),
'position' => array(
'title' => $this->l('Position'),
'filter_key' => 'a!position',
@@ -179,9 +190,9 @@ class AdminFeaturesControllerCore extends AdminController
}
// by webkul to get media link.
// $ps_img_url = _PS_IMG_DIR_.'rf/'.$obj->id.'.jpg';
$img_url = $this->context->link->getMediaLink(_PS_IMG_.'rf/'.$obj->id.'.jpg');
$img_url = $this->context->link->getMediaLink(_PS_IMG_.'rf/'.Feature::getLogoImageName($obj->id, $obj->logo));
if ($img_exist = Tools::file_get_contents($img_url)) {
$image = "<img class='img-thumbnail img-responsive' style='max-width:100px' src='".$img_url."'>";
$image = "<img class='img-thumbnail img-responsive' src='".$img_url."'>";
}
$this->toolbar_title = $this->l('Add a new room feature');
@@ -200,14 +211,50 @@ class AdminFeaturesControllerCore extends AdminController
'hint' => $this->l('Enter a name for the room feature. Invalid characters:').' <>;=#{}',
'required' => true
),
array(
'type' => 'switch',
'label' => $this->l('Is Featured'),
'name' => 'is_featured',
'is_bool' => true,
'values' => array(
array('id' => 'is_featured_on', 'value' => 1, 'label' => $this->l('Yes')),
array('id' => 'is_featured_off', 'value' => 0, 'label' => $this->l('No')),
),
),
array(
'type' => 'select',
'label' => $this->l('Logo Type'),
'name' => 'logo_type',
'required' => true,
'options' => array(
'query' => array(
array('id' => 'image', 'name' => $this->l('Image (Upload)')),
array('id' => 'icon', 'name' => $this->l('Icon (Font Awesome)')),
),
'id' => 'id',
'name' => 'name',
),
),
array(
'type' => 'file',
'label' => $this->l('Room Feature Logo'),
'name' => 'logo',
'name' => 'logo_image',
'image' => $img_exist ? $image : false,
'display_image' => true,
'hint' => $this->l('Upload a room feature logo.'),
'required' => true
),
array(
'type' => 'text',
'label' => $this->l('Icon Class'),
'name' => 'logo_icon',
'required' => true,
'col' => 4,
'hint' => $this->l('Font Awesome icon class. Replace fa- with icon- (e.g. fa-wifi becomes icon-wifi).'),
'desc' => sprintf(
$this->l('Refer to %s for available icons.'),
'<a href="https://fontawesome.com/v4/cheatsheet" target="_blank">https://fontawesome.com/v4/cheatsheet</a>'
),
)
)
);
@@ -234,9 +281,51 @@ class AdminFeaturesControllerCore extends AdminController
)
);
$this->fields_value['logo_icon'] = ($obj->logo_type == 'icon') ? $obj->logo : '';
return parent::renderForm();
}
/**
* List callback: render the feature logo as an icon or as the uploaded image thumbnail.
*
* @param string $logo Icon class (when logo type is icon)
* @param array $row List row
* @return string
*/
public function displayLogo($logo, $row)
{
if (isset($row['logo_type']) && $row['logo_type'] == 'icon') {
return $logo ? '<i class="'.Tools::safeOutput($logo).'"></i>' : '';
}
$imageName = Feature::getLogoImageName($row['id_feature'], $logo);
return ImageManager::thumbnail(
_PS_IMG_DIR_.'rf/'.$imageName,
'feature_mini_'.basename($imageName, '.jpg').'_'.(int) $this->context->shop->id.'.jpg',
45,
'jpg'
);
}
/**
* Toggle the Is Featured value from the list (like the status toggle).
*/
public function processToggleIsFeatured()
{
if (!$this->loadObject()) {
return false;
}
$this->object->is_featured = !$this->object->is_featured;
if ($this->object->save()) {
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
} else {
$this->errors[] = $this->l('An error occurred while updating "is featured".');
}
}
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
@@ -528,6 +617,15 @@ class AdminFeaturesControllerCore extends AdminController
}
parent::initProcess();
// Toggle Is Featured from the list
if (Tools::getIsset('is_featured'.$this->table)) {
if ($this->tabAccess['edit'] === 1) {
$this->action = 'toggleIsFeatured';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
}
public function postProcess()
@@ -622,31 +720,65 @@ class AdminFeaturesControllerCore extends AdminController
$_POST[$key] = str_replace('\n', '', str_replace('\r', '', $value));
}
}
$featureImage = $_FILES['logo'];
if (!$idFeature || (isset($featureImage['tmp_name']) && $featureImage['tmp_name'])) {
if ($featureImage && $featureImage['tmp_name'] && $featureImage['name']) {
$logoType = Tools::getValue('logo_type');
$featureImage = isset($_FILES['logo_image']) ? $_FILES['logo_image'] : null;
$objCurrentFeature = new Feature($idFeature);
$oldLogo = $objCurrentFeature->logo;
$oldLogoType = $objCurrentFeature->logo_type;
if (!in_array($logoType, array('image', 'icon'))) {
$this->errors[] = $this->l('Logo type is invalid.');
$logoType = 'image';
}
if (!in_array(Tools::getValue('is_featured', 0), array('0', '1', 0, 1), true)) {
$this->errors[] = $this->l('Is Featured value is invalid.');
}
$_POST['logo_type'] = $logoType;
// Empty logo would be saved as NULL (Feature::add() uses null values), so image type keeps a placeholder until the image is saved.
$_POST['logo'] = 'image';
if ($logoType === 'icon') {
$logoIcon = trim(Tools::getValue('logo_icon'));
if (!$logoIcon) {
$this->errors[] = $this->l('Icon class is required.');
} elseif (Tools::strlen($logoIcon) > 255) {
$this->errors[] = $this->l('Icon class is too long.');
} elseif (!preg_match('/^icon-[a-z0-9]+(-[a-z0-9]+)*$/', $logoIcon)) {
$this->errors[] = $this->l('Icon class is invalid. It must start with "icon-" and contain only lowercase letters, numbers and hyphens (e.g. icon-wifi).');
} else {
$_POST['logo'] = $logoIcon;
}
} else {
$hasUpload = $featureImage && !empty($featureImage['tmp_name']);
$hasExisting = $idFeature && file_exists(_PS_IMG_DIR_.'rf/'.Feature::getLogoImageName($idFeature, $oldLogo));
if ($hasUpload) {
if ($error = ImageManager::validateUpload($featureImage, Tools::getMaxUploadSize())) {
$this->errors[] = $error;
}
} else {
} elseif (!$hasExisting) {
$this->errors[] = $this->l('Please select a logo for this feature.');
} elseif ($oldLogoType === 'image' && $oldLogo) {
// no new image: keep the current image name
$_POST['logo'] = $oldLogo;
}
}
if (count($this->errors)) {
$this->display = $idFeature ? 'edit' : 'add';
return false;
}
$objFeature = parent::processSave();
if (!count($this->errors)) {
// save feature image
if (isset($featureImage['tmp_name']) && $featureImage['tmp_name']) {
// if already feature image then delete it once before uploading new image
if ($idFeature) {
$currentImg = _PS_TMP_IMG_DIR_.'feature_mini_'.$objFeature->id.'_'.$this->context->shop->id.'.jpg';
if (file_exists($currentImg)) {
unlink($currentImg);
}
}
// upload feature image
// save feature image: <id>.jpg is kept for the webservice, a random named copy is used for display
// so that browsers do not show a cached old image
if ($logoType === 'image' && isset($featureImage['tmp_name']) && $featureImage['tmp_name']) {
$imgPath = _PS_IMG_DIR_.'rf/'.$objFeature->id.'.jpg';
if (!ImageManager::resize($featureImage['tmp_name'], $imgPath)) {
$imageName = $objFeature->id.'_'.substr(md5(uniqid(mt_rand(), true)), 0, 12).'.jpg';
if (ImageManager::resize($featureImage['tmp_name'], $imgPath) && copy($imgPath, _PS_IMG_DIR_.'rf/'.$imageName)) {
$objFeature->logo = $imageName;
$objFeature->update();
} else {
$this->errors[] = $this->l('Some error occurred while uploding room feature logo. Please try again.');
}
}

View File

@@ -231,11 +231,11 @@ class AdminImportControllerCore extends AdminController
'floor' => array('label' => $this->l('Floor')),
'id_product' => array('label' => $this->l('Room Type ID *')),
'id_status' => array(
'label' => $this->l('Room status (1/2/3)'),
'help' => $this->l('1 = Active, 2 = Inactive, 3 = Temporarily Inactive')),
'label' => $this->l('Room status (1/2)'),
'help' => $this->l('1 = Active, 2 = Inactive')),
'comment' => array('label' => $this->l('Extra Information')),
'dates' => array('label' => $this->l('Inactive date ranges and Reason(yyyy-mm-dd)'),
'help' => $this->l('If Temporarily Inactive (date_from:date_to:reason, date_from:date_to:reason,...)')
'dates' => array('label' => $this->l('Disable date ranges and Reason(yyyy-mm-dd)'),
'help' => $this->l('date_from:date_to:reason, date_from:date_to:reason,...')
),
);
break;
@@ -1996,46 +1996,31 @@ class AdminImportControllerCore extends AdminController
$lang_field_error = $objHotelRoomInfo->validateFieldsLang(UNFRIENDLY_ERROR, true);
$res = false;
if ($this->checkRequiredFields($info, 'room_num')) {
if ($objHotelRoomInfo->id_status == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE
&& (!isset($objHotelRoomInfo->dates) || !$objHotelRoomInfo->dates)
) {
$this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved due to missing disable dates.'),
(isset($info['room_num']) && !empty($info['room_num']))? Tools::safeOutput($info['room_num']) : 'No Name',
(isset($info['id']) && !empty($info['id']))? Tools::safeOutput($info['id']) : 'No ID'
);
} else if (Validate::isLoadedObject($objProduct = new Product((int) $info['id_product']))
if (Validate::isLoadedObject($objProduct = new Product((int) $info['id_product']))
&& Product::isBookingProduct($objProduct->id)
) {
if ($field_error === true && $lang_field_error === true) {
if ($res = $objHotelRoomInfo->add()) {
if ($idRoom = $objHotelRoomInfo->id) {
if ($objHotelRoomInfo->id_status == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
if (isset($objHotelRoomInfo->dates)
&& $objHotelRoomInfo->dates
) {
foreach ($objHotelRoomInfo->dates as $disableDate) {
$datesData = explode(':', $disableDate);
$reason = '';
if(isset($datesData[2])) {
$reason = $datesData[2];
}
if (isset($datesData[0]) && isset($datesData[1])
&& strtotime($datesData[1]) > strtotime($datesData[0])
) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $objHotelRoomInfo->id_product;
$objHotelRoomDisableDates->id_room = $idRoom;
$objHotelRoomDisableDates->date_from = date('Y-m-d', strtotime($datesData[0]));
$objHotelRoomDisableDates->date_to = date('Y-m-d', strtotime($datesData[1]));
$objHotelRoomDisableDates->reason = $reason;
$objHotelRoomDisableDates->add();
}
if (isset($objHotelRoomInfo->dates) && $objHotelRoomInfo->dates) {
foreach ($objHotelRoomInfo->dates as $disableDate) {
$datesData = explode(':', $disableDate);
$reason = '';
if(isset($datesData[2])) {
$reason = $datesData[2];
}
if (isset($datesData[0]) && isset($datesData[1])
&& strtotime($datesData[1]) > strtotime($datesData[0])
) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $objHotelRoomInfo->id_product;
$objHotelRoomDisableDates->id_room = $idRoom;
$objHotelRoomDisableDates->date_from = date('Y-m-d', strtotime($datesData[0]));
$objHotelRoomDisableDates->date_to = date('Y-m-d', strtotime($datesData[1]));
$objHotelRoomDisableDates->reason = $reason;
$objHotelRoomDisableDates->add();
}
} else {
$this->warnings[] = Tools::displayError('Please set date from and date to incase of temporary inactive status.');
}
}
}

View File

@@ -75,7 +75,7 @@ class AdminMetaControllerCore extends AdminController
parent::__construct();
$this->sm_file = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$this->context->shop->id.'_index_sitemap.xml';
$this->sm_file = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'sitemap.xml';
// Options to generate friendly urls
$mod_rewrite = Tools::modRewriteActive();
$general_fields = array(
@@ -134,7 +134,11 @@ class AdminMetaControllerCore extends AdminController
}
// Options to generate robot.txt
$robots_description = $this->l('Your robots.txt file MUST be in your website\'s root directory and nowhere else (e.g. http://www.example.com/robots.txt).');
$robots_url = Tools::safeOutput($this->context->link->getBaseLink().'robots.txt');
$robots_description = sprintf(
$this->l('Your robots.txt file MUST be in your website\'s root directory and nowhere else (e.g. %s).'),
'<a href="'.$robots_url.'" target="_blank">'.$robots_url.'</a>'
);
if ($this->checkConfiguration($this->rb_file)) {
$robots_description .= $this->l('Generate your "robots.txt" file by clicking on the following button (this will erase the old robots.txt file)');
$robots_submit = array('name' => 'submitRobots', 'title' => $this->l('Generate robots.txt file'));

View File

@@ -3233,10 +3233,8 @@ class AdminProductsControllerCore extends AdminController
}
$room['booked_dates'] = json_encode($bookedDates);
if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disableDates);
}
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disableDates);
$room['connected_rooms_count'] = HotelConnectedRoom::getTotalConnectedRooms($room['id']);
}
@@ -3794,13 +3792,7 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomInfo->id_status = $roomInfo['id_status'];
$objHotelRoomInfo->floor = trim($roomInfo['floor']);
$objHotelRoomInfo->comment = trim($roomInfo['comment']);
if ($objHotelRoomInfo->save()
&& $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE
) {
// directly deleting the dates since we are validating the dates using hooks before this.
$objRoomDisableDates = new HotelRoomDisableDates();
$objRoomDisableDates->deleteRoomDisableDates($objHotelRoomInfo->id);
}
$objHotelRoomInfo->save();
}
}
}
@@ -3826,12 +3818,6 @@ class AdminProductsControllerCore extends AdminController
foreach ($roomsInfo as $key => $roomInfo) {
$roomIndex = $key + 1;
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
if ($roomInfo['disable_dates_json'] === 0) {
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
if ($roomInfo['room_num'] && !Validate::isGenericName($roomInfo['room_num'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid room number for room %s.'), $roomIndex);
}
@@ -3844,13 +3830,6 @@ class AdminProductsControllerCore extends AdminController
if (count($objHotelRoomInformation->getFutureBookings($roomInfo['id']))) {
$this->errors[] = sprintf(Tools::displayError('Cannot change room %s status to inactive as it already has some bookings, Please check the bookings and move those bookings to another room if you want make this room inactive'), $roomInfo['room_num']);
}
} elseif ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
if (!is_array($disableDates)
|| !count($disableDates)
) {
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
Hook::exec('actionValidateRoomInformation', array('room_information' => $roomInfo));
}
@@ -5210,7 +5189,7 @@ class AdminProductsControllerCore extends AdminController
$idProduct = Tools::getValue('id_product');
if ($this->tabAccess['edit'] === 1) {
if (!Validate::isDate($dateFrom) || !Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Please select a valid date range to temporary disable this room');
$this->errors[] = $this->l('Please select a valid date range to disable this room');
} else if ($idRoom && Validate::isLoadedObject($objHotelRoomInfo = new HotelRoomInformation((int) $idRoom))) {
$dateTo = date('Y-m-d', strtotime($dateTo));
$objHotelBookingDetail = new HotelBookingDetail();
@@ -5234,10 +5213,7 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomDisableDates->date_from = $dateFrom;
$objHotelRoomDisableDates->date_to = $dateTo;
$objHotelRoomDisableDates->reason = trim(Tools::getValue('reason'));
$objHotelRoomInfo->id_status = HotelRoomInformation::STATUS_TEMPORARY_INACTIVE;
if ($objHotelRoomInfo->save()
&& $objHotelRoomDisableDates->save()
) {
if ($objHotelRoomDisableDates->save()) {
$response['id_disable_date'] = $objHotelRoomDisableDates->id;
$response['event_title'] = $this->l('Disabled');
if (Tools::getValue('id_disable_date')) {
@@ -5331,12 +5307,7 @@ class AdminProductsControllerCore extends AdminController
} else {
$response['status'] = true;
$this->confirmations[] = $this->l('Removed successfully.');
if (!($disableDates = $objRoomDisableDates->getRoomDisableDates($idRoom))) {
$objRoomInfo = new HotelRoomInformation($idRoom);
$objRoomInfo->id_status = HotelRoomInformation::STATUS_ACTIVE;
$objRoomInfo->save();
}
$disableDates = $objRoomDisableDates->getRoomDisableDates($idRoom);
$response['disable_dates'] = $disableDates;
}
@@ -5370,13 +5341,8 @@ class AdminProductsControllerCore extends AdminController
&& (int) $idDisableDate
&& Validate::isLoadedObject($objRoomDisableDates = new HotelRoomDisableDates($idDisableDate))
) {
$idRoom = $objRoomDisableDates->id_room;
if (!$objRoomDisableDates->delete()) {
$this->errors[] = Tools::displayError('An error occurred while trying to perform this operation.');
} else if (!$objRoomDisableDates->getRoomDisableDates($idRoom)) {
$objRoomInfo = new HotelRoomInformation($idRoom);
$objRoomInfo->id_status = HotelRoomInformation::STATUS_ACTIVE;
$objRoomInfo->save();
}
} else {
$this->errors[] = Tools::displayError('Invalid request');
@@ -5419,45 +5385,47 @@ class AdminProductsControllerCore extends AdminController
$room['id_status'] = Tools::getValue('id_status');
$disableDates = array();
if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = Tools::getValue('disable_dates');
$room['disable_dates_json'] = json_encode($disableDates);
if (!$disableDates) {
$this->errors[] = Tools::displayError('Please add at least one date range for updating the rooms status to temporary inactive.');
} else {
$hasMissingRowError = false;
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
if (!$hasMissingRowError) {
$hasMissingRowError = true;
$this->errors[] = Tools::displayError('Some dates are missing. Please select all the date ranges.');
}
$rowsToHighlight[] = $key;
}
if (is_array($rawDisableDates = Tools::getValue('disable_dates'))) {
foreach ($rawDisableDates as $key => $dateRange) {
if (trim($dateRange['date_from']) || trim($dateRange['date_to'])) {
$disableDates[$key] = $dateRange;
}
}
}
if (!count($this->errors)) {
$error = false;
foreach ($disableDates as $keyOuter => $dateRangeOuter) {
foreach ($disableDates as $keyInner => $dateRangeInner) {
if ($keyInner != $keyOuter) {
if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to']))
|| (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to']))
) {
if (!$error) {
$error = Tools::displayError('Some dates are conflicting with each other. Please check and reselect the date ranges.');
}
$rowsToHighlight[] = $keyOuter;
$rowsToHighlight[] = $keyInner;
if ($disableDates) {
$hasMissingRowError = false;
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
if (!$hasMissingRowError) {
$hasMissingRowError = true;
$this->errors[] = Tools::displayError('Some dates are missing. Please select all the date ranges.');
}
$rowsToHighlight[] = $key;
}
}
if (!count($this->errors)) {
$error = false;
foreach ($disableDates as $keyOuter => $dateRangeOuter) {
foreach ($disableDates as $keyInner => $dateRangeInner) {
if ($keyInner != $keyOuter) {
if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to']))
|| (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to']))
) {
if (!$error) {
$error = Tools::displayError('Some dates are conflicting with each other. Please check and reselect the date ranges.');
}
$rowsToHighlight[] = $keyOuter;
$rowsToHighlight[] = $keyInner;
}
}
}
}
if ($error) {
$this->errors[] = $error;
}
if ($error) {
$this->errors[] = $error;
}
}
}
@@ -5471,12 +5439,12 @@ class AdminProductsControllerCore extends AdminController
if (count($objHotelRoomInfo->getFutureBookings($idRoom))) {
$this->errors[] = sprintf(Tools::displayError('Cannot change room %s status to inactive as it already has some bookings, Please check the bookings and move those bookings to another room if you want make this room inactive'), $objHotelRoomInfo->room_num);
}
} else if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE && $disableDates) {
foreach ($disableDates as $key => $dateRange) {
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) {
$bookedRows[$bookingRow['id']] = new HotelBookingDetail($bookingRow['id']);
$rowsToHighlight[] = $key;
}
}
foreach ($disableDates as $key => $dateRange) {
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) {
$bookedRows[$bookingRow['id']] = new HotelBookingDetail($bookingRow['id']);
$rowsToHighlight[] = $key;
}
}
@@ -5513,20 +5481,14 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomInfo->comment = $roomInfo['comment'];
}
if ($objHotelRoomInfo->save()
&& $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE
) {
// directly deleting the dates since we are validating the dates using hooks before this.
$objRoomDisableDates = new HotelRoomDisableDates();
$objRoomDisableDates->deleteRoomDisableDates($objHotelRoomInfo->id);
} else {
foreach ($disableDates as $key => $dateRange) {
if ($objHotelRoomInfo->save()) {
foreach ($disableDates as $dateRange) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $objHotelRoomInfo->id_product;
$objHotelRoomDisableDates->id_room = $roomInfo['id'];
$objHotelRoomDisableDates->date_from = $dateRange['date_from'];
$objHotelRoomDisableDates->date_to = $dateRange['date_to'];
$objHotelRoomDisableDates->reason = $dateRange['reason'];
$objHotelRoomDisableDates->reason = isset($dateRange['reason']) ? $dateRange['reason'] : '';
$objHotelRoomDisableDates->save();
}
}
@@ -5597,22 +5559,47 @@ class AdminProductsControllerCore extends AdminController
$roomsInfo['id_status'] = Tools::getValue('id_status');
$disableDates = array();
if ($roomsInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = Tools::getValue('disable_dates');
$roomsInfo['disable_dates_json'] = json_encode($disableDates);
if (!$disableDates) {
$this->errors[] = sprintf(Tools::displayError('Please add at least one date range for updating the %s status to temporary inactive.') , $roomTypeInfo['selling_object_name']);
} else {
$hasMissingRowError = false;
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
if (!$hasMissingRowError) {
$hasMissingRowError = true;
$this->errors[] = Tools::displayError('Some dates are missing. Please select all the date ranges.');
}
if (is_array($rawDisableDates = Tools::getValue('disable_dates'))) {
foreach ($rawDisableDates as $key => $dateRange) {
if (trim($dateRange['date_from']) || trim($dateRange['date_to'])) {
$disableDates[$key] = $dateRange;
}
}
}
$rowsToHighlight[] = $key;
if ($disableDates) {
$hasMissingRowError = false;
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
if (!$hasMissingRowError) {
$hasMissingRowError = true;
$this->errors[] = Tools::displayError('Some dates are missing. Please select all the date ranges.');
}
$rowsToHighlight[] = $key;
}
}
if (!count($this->errors)) {
$error = false;
foreach ($disableDates as $keyOuter => $dateRangeOuter) {
foreach ($disableDates as $keyInner => $dateRangeInner) {
if ($keyInner != $keyOuter) {
if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to']))
|| (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to']))
) {
if (!$error) {
$error = Tools::displayError('Some dates are conflicting with each other. Please check and reselect the date ranges.');
}
$rowsToHighlight[] = $keyOuter;
$rowsToHighlight[] = $keyInner;
}
}
}
}
if ($error) {
$this->errors[] = $error;
}
}
}
@@ -5647,14 +5634,14 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomInfo->comment = $roomsInfo['comment'];
}
if ($objHotelRoomInfo->save() && $objHotelRoomInfo->id_status == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
foreach ($disableDates as $key => $dateRange) {
if ($objHotelRoomInfo->save()) {
foreach ($disableDates as $dateRange) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $objHotelRoomInfo->id_product;
$objHotelRoomDisableDates->id_room = $objHotelRoomInfo->id;
$objHotelRoomDisableDates->date_from = $dateRange['date_from'];
$objHotelRoomDisableDates->date_to = $dateRange['date_to'];
$objHotelRoomDisableDates->reason = $dateRange['reason'];
$objHotelRoomDisableDates->reason = isset($dateRange['reason']) ? $dateRange['reason'] : '';
$objHotelRoomDisableDates->save();
}
}

View File

@@ -1439,7 +1439,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
// Unavailable are:
// - inactive rooms (unavailable for all nights in the range)
// - temporarily inactive rooms for overlapping disabled date ranges (night-wise)
// - active rooms for overlapping disabled date ranges (night-wise)
$countInactiveRooms = (int)Db::getInstance()->getValue(
'SELECT IFNULL(COUNT(hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
@@ -1500,7 +1500,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
ON (hrdd.`id_room` = hri.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_ACTIVE.'
AND hrdd.`date_from` < "'.pSQL($dateTo).'"
AND hrdd.`date_to` > "'.pSQL($dateFrom).'"
AND p.`active` = 1
@@ -1508,7 +1508,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
(!is_null($idsHotel) ? HotelBranchInformation::addHotelRestriction($idsHotel, 'hri') : '')
);
// Booked nights overlapping temporary disable ranges should not be counted as unavailable.
// Booked nights overlapping disable ranges should not be counted as unavailable.
$countOccupiedTemporaryInactiveNights = (int)Db::getInstance()->getValue(
'SELECT IFNULL(SUM(
GREATEST(
@@ -1537,7 +1537,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
ON (hri.`id` = hbd.`id_room`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_ACTIVE.'
AND p.`active` = 1
AND p.`booking_product` = 1
AND hbd.`id` NOT IN ('.OrderReturn::getRefundedBookingIdsSubquery().')
@@ -2023,13 +2023,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_inactive,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
ON (hrdd.`id_room` = hri.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
AND p.`active` = 1'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
@@ -2104,13 +2104,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_inactive,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
ON (hrdd.`id_room` = hri.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
AND p.`active` = 1'.
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').
@@ -2168,13 +2168,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_inactive,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
ON (hrdd.`id_room` = hri.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
AND p.`active` = 1'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'

View File

@@ -80,12 +80,6 @@ class AdminStoresControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
'PS_STORES_DISPLAY_SITEMAP' => array(
'title' => $this->l('Display in the sitemap page'),
'hint' => $this->l('Display a link to the store locator in the sitemap page.'),
'cast' => 'intval',
'type' => 'bool'
),
'PS_STORES_SIMPLIFIED' => array(
'title' => $this->l('Show a simplified store locator'),
'hint' => $this->l('No map, no search, only a store directory.'),

View File

@@ -183,6 +183,7 @@ class CategoryControllerCore extends FrontController
$sort_value = Tools::getValue('sort_value');
$filter_data = Tools::getValue('filter_data');
$amenities = [];
$featureValues = [];
$price = [];
if (!empty($filter_data)) {
foreach ($filter_data as $key => $value) {
@@ -190,6 +191,11 @@ class CategoryControllerCore extends FrontController
foreach ($value as $a_k => $a_v) {
$amenities[] = $a_v;
}
} elseif ($key == 'features') {
// one group of feature value ids per feature
foreach ($value as $idFeatureValues) {
$featureValues[] = array_map('intval', (array) $idFeatureValues);
}
} elseif ($key == 'price') {
$price['from'] = $value[0];
$price['to'] = $value[1];
@@ -207,6 +213,7 @@ class CategoryControllerCore extends FrontController
'id_cart' => $this->context->cart->id,
'id_guest' => $this->context->cookie->id_guest,
'amenities' => $amenities,
'feature_values' => $featureValues,
'price' => $price,
);

View File

@@ -560,6 +560,7 @@ class GuestTrackingControllerCore extends FrontController
'refund_allowed' => false,
'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
'is_guest' => true,
'has_room_booking' => (bool) HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false),
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,

View File

@@ -464,6 +464,7 @@ class OrderDetailControllerCore extends FrontController
'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues,
'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
'is_guest' => false,
'has_room_booking' => (bool) HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false),
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false),
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,

View File

@@ -59,6 +59,10 @@ class PdfBookingVoucherControllerCore extends FrontController
die(Tools::displayError('The booking voucher was not found.'));
}
if (!HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false)) {
die(Tools::displayError('The booking voucher was not found.'));
}
$this->order = $order;
}

View File

@@ -411,6 +411,23 @@ class ProductControllerCore extends FrontController
$roomAmenities = HotelRoomTypeAmenities::getAmenities($this->product->id, $this->context->language->id);
$hotelAmenities = HotelBranchAmenities::getAmenities($hotel_id, $this->context->language->id);
// featured amenities: room type level first, then hotel level, without duplicates
$featuredAmenities = array();
$featuredAmenitiesList = array_merge(
HotelRoomTypeAmenities::getAmenities($this->product->id, $this->context->language->id, true),
HotelBranchAmenities::getAmenities($hotel_id, $this->context->language->id, true)
);
$featuredAmenities = array_values(array_column(
array_reverse($featuredAmenitiesList),
null,
'id'
));
usort($featuredAmenities, function ($a, $b) {
return strcmp($a['name'], $b['name']);
});
$this->context->smarty->assign(
array(
'id_hotel' => $hotel_id,
@@ -440,6 +457,7 @@ class ProductControllerCore extends FrontController
'room_type_features' => $roomFeatures,
'room_dynamic_amenities' => $roomAmenities,
'hotel_dynamic_amenities' => $hotelAmenities,
'featured_amenities' => $featuredAmenities,
'amenity_img_dir' => _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_amenities/',
'hotel_image_link' => $hotelImageLink,
'hotel_has_images' => (bool) HotelImage::getCover($hotel_id),

View File

@@ -28,11 +28,6 @@ class SitemapControllerCore extends FrontController
{
public $php_self = 'sitemap';
public function init()
{
Tools::redirect($this->context->link->getPageLink('index'));
}
public function setMedia()
{
parent::setMedia();
@@ -48,7 +43,10 @@ class SitemapControllerCore extends FrontController
{
parent::initContent();
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$categoriesTree = Category::getRootCategory()->recurseLiteCategTree(0);
$this->addRoomTypes($categoriesTree);
$categoriesTree['children'] = $this->getHotelNodes($categoriesTree);
$this->context->smarty->assign('categoriesTree', $categoriesTree);
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int)CartRule::isFeatureActive());
$this->context->smarty->assign('PS_DISPLAY_BEST_SELLERS', Configuration::get('PS_DISPLAY_BEST_SELLERS'));
@@ -56,4 +54,63 @@ class SitemapControllerCore extends FrontController
$this->setTemplate(_PS_THEME_DIR_.'sitemap.tpl');
}
/**
* Add the room types of each hotel to the category tree (key room_types of the hotel category node).
*
* @param array $node Category tree node, updated by reference
*/
protected function addRoomTypes(&$node)
{
static $hotelCategories = null;
if ($hotelCategories === null) {
$hotelCategories = array();
$rows = Db::getInstance()->executeS(
'SELECT `id`, `id_category` FROM `'._DB_PREFIX_.'htl_branch_info` WHERE `active` = 1'
);
foreach ((array) $rows as $row) {
$hotelCategories[(int) $row['id_category']] = (int) $row['id'];
}
}
if (isset($hotelCategories[$node['id']])) {
$idLang = (int) $this->context->language->id;
$idShop = (int) $this->context->shop->id;
$node['room_types'] = array();
$rows = Db::getInstance()->executeS(
'SELECT hrt.`id_product` FROM `'._DB_PREFIX_.'htl_room_type` hrt
INNER JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.`id_product` = hrt.`id_product` AND ps.`id_shop` = '.$idShop.')
WHERE hrt.`id_hotel` = '.(int) $hotelCategories[$node['id']].' AND ps.`active` = 1 AND ps.`visibility` <> \'none\'
ORDER BY hrt.`id_product`'
);
foreach ((array) $rows as $row) {
$product = new Product((int) $row['id_product'], false, $idLang);
if (!$product->link_rewrite) {
continue;
}
$node['room_types'][] = array(
'name' => $product->name,
'link' => $this->context->link->getProductLink($product, $product->link_rewrite, null, null, $idLang, $idShop),
);
}
}
foreach ($node['children'] as &$child) {
$this->addRoomTypes($child);
}
}
protected function getHotelNodes($node)
{
$hotels = array();
if (isset($node['room_types'])) {
$node['children'] = array();
$hotels[] = $node;
} else {
foreach ($node['children'] as $child) {
$hotels = array_merge($hotels, $this->getHotelNodes($child));
}
}
return $hotels;
}
}

View File

@@ -1,3 +1,3 @@
Room No;Floor;Room Type ID;Room Status (1 = Active, 2 = Inactive, 3 = Temporarily Inactive);Extra Information;Disabled Dates And Reason Incase Of Temporary Inactive
GR-109;First;1;3;Newly added room;2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2
Room No;Floor;Room Type ID;Room Status (1 = Active, 2 = Inactive);Extra Information;Disabled Dates And Reason
GR-109;First;1;1;Newly added room;2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2
DR-107;First;2;1;;
1 Room No Floor Room Type ID Room Status (1 = Active, 2 = Inactive, 3 = Temporarily Inactive) Room Status (1 = Active, 2 = Inactive) Extra Information Disabled Dates And Reason Incase Of Temporary Inactive Disabled Dates And Reason
2 GR-109 First 1 3 1 Newly added room 2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2 2024-01-01:2024-01-02:Reason1, 2023-02-03:2023-02-02:Reason2
3 DR-107 First 2 1 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -824,6 +824,9 @@ CREATE TABLE `PREFIX_employee_shop` (
CREATE TABLE `PREFIX_feature` (
`id_feature` int(10) unsigned NOT NULL auto_increment,
`position` int(10) unsigned NOT NULL DEFAULT '0',
`logo_type` varchar(10) NOT NULL DEFAULT 'image',
`logo` varchar(255) NOT NULL DEFAULT '',
`is_featured` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_feature`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;

View File

@@ -38,12 +38,10 @@
<configurable>1</configurable>
</meta>
-->
<!--
<meta id="sitemap">
<page>sitemap</page>
<configurable>1</configurable>
</meta>
-->
<meta id="supplier">
<page>supplier</page>
<configurable>1</configurable>

View File

@@ -722,6 +722,7 @@ class InstallModelInstall extends InstallAbstractModel
'blockcart',
'blockuserinfo',
'qlochannelmanagerconnector',
'qlogooglehotelconnector'
);
}
return $modules;

View File

@@ -59,7 +59,7 @@ class HotelAmenities extends ObjectModel
public function delete()
{
if ($id = $this->id) {
$imgFile = dirname(__FILE__).'/../views/img/hotel_amenities/'.(int)$id.'.jpg';
$imgFile = dirname(__FILE__).'/../views/img/hotel_amenities/'.($this->logo_type == 'image' && $this->logo ? basename($this->logo) : (int)$id.'.jpg');
if (file_exists($imgFile)) {
unlink($imgFile);
}

View File

@@ -308,6 +308,9 @@ class HotelBookingDetail extends ObjectModel
if (!isset($params['amenities'])) {
$params['amenities'] = 0;
}
if (!isset($params['feature_values'])) {
$params['feature_values'] = 0;
}
if (!isset($params['price'])) {
$params['price'] = 0;
}
@@ -600,11 +603,11 @@ class HotelBookingDetail extends ObjectModel
FROM `'._DB_PREFIX_.'htl_room_information`
WHERE `id_hotel`='.(int)$idHotel.' AND `id_status` = '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')';
// check room is temperory inactive
// check active room disabled for the requested dates
$sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, hri.`id_status`, hrdd.`date_from` AS `date_from`, hrdd.`date_to` AS `date_to`
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`)
WHERE hri.`id_hotel`='.(int) $idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (
WHERE hri.`id_hotel`='.(int) $idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_ACTIVE .' AND (
(hrdd.`date_from` <= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR
(hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR
(hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` >= \''.pSQL($dateTo).'\') OR
@@ -779,11 +782,11 @@ class HotelBookingDetail extends ObjectModel
(`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` >= \''.pSQL($dateTo).'\')
)) AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')';
// Exclude temporary disable rooms
// Exclude active rooms disabled for the requested dates
$excludeRoomId['disabled'] = 'SELECT hri.`id` AS id_room
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (hrdd.`date_from` < \''.pSql($dateTo).'\' AND hrdd.`date_to` > \''.pSql($dateFrom).'\') AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_ACTIVE .' AND (hrdd.`date_from` < \''.pSql($dateTo).'\' AND hrdd.`date_to` > \''.pSql($dateFrom).'\') AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
// LOS Restriction. Also, Remember to check max LOS restriction is greater than zero
if ($applyLosRestriction) {
@@ -1110,7 +1113,7 @@ class HotelBookingDetail extends ObjectModel
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`)
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (
WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_ACTIVE .' AND (
(hrdd.`date_from` <= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` < \''.pSQL($dateTo).'\') OR
(hrdd.`date_from` > \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` >= \''.pSQL($dateTo).'\') OR
(hrdd.`date_from` > \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` < \''.pSQL($dateTo).'\')
@@ -1829,13 +1832,19 @@ class HotelBookingDetail extends ObjectModel
if (!$only_search_data) {
if (!empty($bookingData)) {
$maxAmenities = (int) Configuration::get('WK_MAX_AMENITIES_ROOM_SEARCH');
$maxFeatures = (int) Configuration::get('WK_MAX_FEATURES_ROOM_SEARCH');
$maxFeatureValues = (int) Configuration::get('WK_MAX_FEATURE_VALUES_ROOM_SEARCH');
foreach ($bookingData['rm_data'] as $key => $value) {
// featured amenities for display in room type list
$product_feature = HotelRoomTypeAmenities::getAmenities(
$featured_amenities = HotelRoomTypeAmenities::getAmenities(
$value['id_product'],
$context->language->id,
true
);
if ($maxAmenities) {
$featured_amenities = array_slice($featured_amenities, 0, $maxAmenities);
}
if (!empty($amenities) && $amenities) {
$roomAmenityIds = array_column(HotelRoomTypeAmenities::getAmenities($value['id_product']), 'id');
if (array_diff($amenities, $roomAmenityIds)) {
@@ -1843,6 +1852,16 @@ class HotelBookingDetail extends ObjectModel
continue;
}
}
if (!empty($feature_values)) {
$roomFeatureValueIds = array_map('intval', array_column(Product::getFeaturesStatic($value['id_product']), 'id_feature_value'));
// AND between features, OR between the values of one feature
foreach ($feature_values as $featureValueGroup) {
if (!array_intersect($featureValueGroup, $roomFeatureValueIds)) {
unset($bookingData['rm_data'][$key]);
continue 2;
}
}
}
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 1, $bookingParams['occupancy']);
if (!empty($price) && ((float) $price['from'] > $productFeaturePrice || (float) $price['to'] < $productFeaturePrice)) {
unset($bookingData['rm_data'][$key]);
@@ -1859,7 +1878,32 @@ class HotelBookingDetail extends ObjectModel
$cover_img = $context->link->getImageLink($value['link_rewrite'], $context->language->iso_code.'-default', 'home_default');
}
$bookingData['rm_data'][$key]['image'] = $cover_img;
$bookingData['rm_data'][$key]['feature'] = $product_feature;
$bookingData['rm_data'][$key]['featured_amenities'] = $featured_amenities;
// featured room features (is_featured) for display below the short description
$featuredFeatures = array();
foreach (Product::getFrontFeaturesStatic($context->language->id, $value['id_product']) as $roomFeature) {
// one entry per featured feature, its values are shown together after the feature icon
if ($roomFeature['is_featured']) {
if (!isset($featuredFeatures[$roomFeature['id_feature']])) {
$featuredFeatures[$roomFeature['id_feature']] = $roomFeature;
$featuredFeatures[$roomFeature['id_feature']]['values'] = array();
}
$featuredFeatures[$roomFeature['id_feature']]['values'][] = $roomFeature['value'];
}
}
$featuredFeatures = array_values($featuredFeatures);
if ($maxFeatures) {
$featuredFeatures = array_slice($featuredFeatures, 0, $maxFeatures);
}
foreach ($featuredFeatures as &$featuredFeature) {
if ($maxFeatureValues) {
$featuredFeature['values'] = array_slice($featuredFeature['values'], 0, $maxFeatureValues);
}
$featuredFeature['value'] = implode(', ', $featuredFeature['values']);
}
unset($featuredFeature);
$bookingData['rm_data'][$key]['featured_features'] = $featuredFeatures;
$bookingData['rm_data'][$key]['price'] = $prod_price;
$bookingData['rm_data'][$key]['feature_price'] = $productFeaturePrice;
$bookingData['rm_data'][$key]['price_without_reduction'] = $productPriceWithoutReduction;

View File

@@ -1515,6 +1515,8 @@ class HotelCartBookingData extends ObjectModel
$objCartBookingData = new HotelCartBookingData();
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$maxFeatures = (int) Configuration::get('WK_MAX_FEATURES_ROOM_SEARCH');
$maxFeatureValues = (int) Configuration::get('WK_MAX_ROOM_TYPE_FEATURE_VALUES');
foreach ($cartRoomTypes as $prodKey => $product) {
if (Validate::isLoadedObject(
@@ -1596,8 +1598,29 @@ class HotelCartBookingData extends ObjectModel
$hotelInfo['htl_features'] = $hotelAmenities;
}
}
// append roomtype features
$hotelInfo['room_features'] = $objProduct->getFrontFeatures($idLang);
// append featured roomtype features
$hotelInfo['room_features'] = array();
foreach ($objProduct->getFrontFeatures($idLang) as $roomFeature) {
if ($roomFeature['is_featured']) {
// the values of a feature are shown together
if (!isset($hotelInfo['room_features'][$roomFeature['id_feature']])) {
$hotelInfo['room_features'][$roomFeature['id_feature']] = $roomFeature;
$hotelInfo['room_features'][$roomFeature['id_feature']]['values'] = array();
}
$hotelInfo['room_features'][$roomFeature['id_feature']]['values'][] = $roomFeature['value'];
}
}
$hotelInfo['room_features'] = array_values($hotelInfo['room_features']);
if ($maxFeatures) {
$hotelInfo['room_features'] = array_slice($hotelInfo['room_features'], 0, $maxFeatures);
}
foreach ($hotelInfo['room_features'] as &$roomFeature) {
if ($maxFeatureValues) {
$roomFeature['values'] = array_slice($roomFeature['values'], 0, $maxFeatureValues);
}
$roomFeature['value'] = implode(', ', $roomFeature['values']);
}
unset($roomFeature);
$cartHotelData[$prodKey]['hotel_info'] = $hotelInfo;
}

View File

@@ -977,6 +977,66 @@ class HotelHelper
);
// lang fields
$languages = Language::getLanguages(false);
// FontAwesome icons (admin/front icon- classes) for default amenities, keyed by amenity position.
// Amenities without a suitable icon keep their default image.
$amenityIcons = array(
1 => 'icon-building',
2 => 'icon-video-camera',
3 => 'icon-users',
4 => 'icon-microphone',
5 => 'icon-pencil',
6 => 'icon-fax',
7 => 'icon-wifi',
8 => 'icon-wifi',
9 => 'icon-bus',
10 => 'icon-newspaper-o',
11 => 'icon-shopping-cart',
12 => 'icon-glass',
14 => 'icon-diamond',
16 => 'icon-music',
17 => 'icon-microphone',
18 => 'icon-film',
21 => 'icon-plug',
22 => 'icon-credit-card',
23 => 'icon-money',
25 => 'icon-book',
26 => 'icon-medkit',
27 => 'icon-gift',
29 => 'icon-paw',
30 => 'icon-child',
32 => 'icon-fire',
33 => 'icon-bell',
34 => 'icon-cutlery',
35 => 'icon-car',
37 => 'icon-shopping-cart',
38 => 'icon-hospital-o',
39 => 'icon-envelope',
41 => 'icon-language',
42 => 'icon-car',
45 => 'icon-wifi',
46 => 'icon-fax',
47 => 'icon-tree',
48 => 'icon-car',
49 => 'icon-fire',
50 => 'icon-child',
53 => 'icon-car',
55 => 'icon-leaf',
56 => 'icon-car',
57 => 'icon-car',
58 => 'icon-key',
59 => 'icon-heartbeat',
60 => 'icon-bicycle',
64 => 'icon-ship',
69 => 'icon-life-ring',
70 => 'icon-gamepad',
72 => 'icon-anchor',
73 => 'icon-leaf',
87 => 'icon-glass',
88 => 'icon-cutlery',
90 => 'icon-coffee',
91 => 'icon-cutlery',
98 => 'icon-leaf',
);
$imgDir = dirname(__FILE__).'/../views/img/hotel_amenities/';
$i = 1;
$defaultImageIndex = 0;
@@ -1009,6 +1069,13 @@ class HotelHelper
$obj_amenity->id_parent = $idParent;
$obj_amenity->save();
if (isset($amenityIcons[$defaultImageIndex])) {
$obj_amenity->logo_type = 'icon';
$obj_amenity->logo = $amenityIcons[$defaultImageIndex];
$obj_amenity->save();
continue;
}
$srcImg = $imgDir.'_default/'.$defaultImageIndex.'.jpg';
if (file_exists($srcImg)) {
if (ImageManager::resize($srcImg, $imgDir.$obj_amenity->id.'.jpg')) {
@@ -1114,6 +1181,9 @@ class HotelHelper
Configuration::updateValue('PS_MIN_BOOKING_OFFSET', 0);
Configuration::updateValue('HTL_FEATURE_PRICING_PRIORITY', 'specific_date;special_day;date_range');
Configuration::updateValue('WK_MAX_AMENITIES_ROOM_SEARCH', 0);
Configuration::updateValue('WK_MAX_FEATURES_ROOM_SEARCH', 0);
Configuration::updateValue('WK_MAX_ROOM_TYPE_FEATURE_VALUES', 0);
Configuration::updateValue('WK_GOOGLE_ACTIVE_MAP', 0);
Configuration::updateValue('WK_MAP_HOTEL_ACTIVE_ONLY', 1);
@@ -1165,6 +1235,9 @@ class HotelHelper
{
$idLang = (int) Configuration::get('PS_LANG_DEFAULT');
$position = 0;
$featureIcons = $this->getDefaultRoomFeatureIcons();
// features marked as featured by default
$featuredFeatures = array('Bed Type', 'Room Size', 'Balcony Type', 'Wi-Fi Speed', 'AC Type', 'TV Type');
foreach ($this->getDefaultRoomFeatures() as $featureName => $featureValues) {
$idFeature = (int) Feature::addFeatureImport($featureName, $position);
@@ -1172,6 +1245,15 @@ class HotelHelper
return false;
}
$objFeature = new Feature($idFeature);
$objFeature->is_featured = in_array($featureName, $featuredFeatures);
// features without an icon keep their default image (img/rf/<id>.jpg)
if (isset($featureIcons[$featureName])) {
$objFeature->logo_type = 'icon';
$objFeature->logo = $featureIcons[$featureName];
}
$objFeature->update();
foreach ($featureValues as $featureValue) {
$idFeatureValue = (int) FeatureValue::addFeatureValueImport($idFeature, $featureValue, null, $idLang, false);
if (!$idFeatureValue) {
@@ -1185,6 +1267,23 @@ class HotelHelper
return true;
}
/**
* Return the icon class (admin/front icon- classes) of each default room feature.
*
* @return array
*/
protected function getDefaultRoomFeatureIcons()
{
return array(
'Bed Type' => 'icon-bed',
'Room Size' => 'icon-arrows-alt',
'View' => 'icon-eye',
'Heating Type' => 'icon-fire',
'TV Type' => 'icon-desktop',
'Wi-Fi Speed' => 'icon-wifi',
);
}
/**
* Return the default room feature/value seed set.
*
@@ -2192,6 +2291,73 @@ class HotelHelper
// save advance payment information
$this->saveAdvancedPaymentInfo($product_id);
// assign features to the room type as per the room type
$roomTypeFeatures = $this->getDefaultRoomTypeFeatures();
if (isset($roomTypeFeatures[$roomTypeDataDefult['name']])) {
$this->saveDummyRoomTypeFeatures($product, $roomTypeFeatures[$roomTypeDataDefult['name']]);
}
}
}
/**
* Return the features (and their values) of each demo room type, keyed by the room type name.
*
* @return array
*/
protected function getDefaultRoomTypeFeatures()
{
return array(
'General Rooms' => array(
'Bed Type' => array('Double', 'Bunk Bed'),
'Room Size' => array('300 sq ft'),
'Balcony Type' => array('None'),
'AC Type' => array('Fan Only'),
'TV Type' => array('LED TV'),
'Wi-Fi Speed' => array('Basic'),
),
'Delux Rooms' => array(
'Bed Type' => array('Queen'),
'Room Size' => array('400 sq ft'),
'Balcony Type' => array('Private Balcony'),
'AC Type' => array('Split AC'),
'TV Type' => array('Smart TV'),
'Wi-Fi Speed' => array('High Speed'),
),
'Executive Rooms' => array(
'Bed Type' => array('King'),
'Room Size' => array('600 sq ft'),
'Balcony Type' => array('Juliet Balcony', 'Patio'),
'AC Type' => array('Central AC'),
'TV Type' => array('Smart TV'),
'Wi-Fi Speed' => array('High Speed'),
),
'Luxury Rooms' => array(
'Bed Type' => array('Super King'),
'Room Size' => array('800 sq ft'),
'Balcony Type' => array('Rooftop Access', 'Veranda'),
'AC Type' => array('Central AC'),
'TV Type' => array('OLED TV'),
'Wi-Fi Speed' => array('Premium/Fiber'),
),
);
}
/**
* Assign the given features to a demo room type.
*
* @param Product $objProduct
* @param array $features Feature name => array of feature values
*/
public function saveDummyRoomTypeFeatures($objProduct, $features)
{
$idLang = (int) Configuration::get('PS_LANG_DEFAULT');
foreach ($features as $featureName => $featureValues) {
$idFeature = (int) Feature::addFeatureImport($featureName);
foreach ($featureValues as $featureValue) {
$idFeatureValue = (int) FeatureValue::addFeatureValueImport($idFeature, $featureValue, null, $idLang, false);
$objProduct->addFeaturesToDB($idFeature, $idFeatureValue);
}
}
}

View File

@@ -121,7 +121,7 @@ class HotelRoomDisableDates extends ObjectModel
}
if (!count($disableDates)) {
$wkDateErrors[] = $hotelResModInstance->l('Please enter disable dates for status temporary disable.', 'HotelRoomDisableDates');
$wkDateErrors[] = $hotelResModInstance->l('Please enter disable dates.', 'HotelRoomDisableDates');
}
return $wkDateErrors;
@@ -140,7 +140,7 @@ class HotelRoomDisableDates extends ObjectModel
/**
* Disabled/maintenance room rows for the out-of-order report.
* Returns both scheduled disable-date entries AND permanently inactive rooms (STATUS_INACTIVE).
* Returns scheduled disable-date entries of active rooms AND permanently inactive rooms (STATUS_INACTIVE).
*
* @param array $params date_from, date_to, id_hotel, id_product, floor, id_lang
* @return array
@@ -179,7 +179,8 @@ class HotelRoomDisableDates extends ObjectModel
FROM `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
INNER JOIN `'._DB_PREFIX_.'htl_room_information` hri ON (hri.`id` = hrdd.`id_room`)
'.$sharedJoins.'
WHERE hrdd.`date_from` < "'.$dateTo.' 23:59:59"
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
AND hrdd.`date_from` < "'.$dateTo.' 23:59:59"
AND hrdd.`date_to` > "'.$dateFrom.' 00:00:00"'
.$floorFilter.$productFilter.$hotelRestriction.'

View File

@@ -35,7 +35,6 @@ class HotelRoomInformation extends ObjectModel
const STATUS_ACTIVE = 1;
const STATUS_INACTIVE = 2;
const STATUS_TEMPORARY_INACTIVE = 3;
const STATUS_SEARCH_LOS_UNSATISFIED = 4;
const STATUS_SEARCH_OCCUPANCY_UNSATISFIED = 5;
@@ -153,10 +152,6 @@ class HotelRoomInformation extends ObjectModel
'id' => HotelRoomInformation::STATUS_INACTIVE,
'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_INACTIVE)
),
'STATUS_TEMPORARY_INACTIVE' => array(
'id' => HotelRoomInformation::STATUS_TEMPORARY_INACTIVE,
'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_TEMPORARY_INACTIVE)
),
);
return $status;
}
@@ -167,7 +162,6 @@ class HotelRoomInformation extends ObjectModel
$status = array(
HotelRoomInformation::STATUS_ACTIVE => $moduleInstance->l('Active', 'hotelreservationsystem'),
HotelRoomInformation::STATUS_INACTIVE => $moduleInstance->l('Inactive', 'hotelreservationsystem'),
HotelRoomInformation::STATUS_TEMPORARY_INACTIVE => $moduleInstance->l('Temporarily Inactive', 'hotelreservationsystem'),
HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED => $moduleInstance->l('Length of stay restriction not satisfied', 'hotelreservationsystem'),
HotelRoomInformation::STATUS_SEARCH_OCCUPANCY_UNSATISFIED => $moduleInstance->l('Occupancy exceeds room capacity', 'hotelreservationsystem'),
);
@@ -353,7 +347,7 @@ class HotelRoomInformation extends ObjectModel
$roomTypes = Db::getInstance()->executeS(
'SELECT hri.`id_product`, pl.`name` AS room_type_name,
COUNT(hri.`id`) AS total_rooms,
SUM(CASE WHEN hri.`id_status` IN ('.(int) self::STATUS_INACTIVE.','.(int) self::STATUS_TEMPORARY_INACTIVE.') THEN 1 ELSE 0 END) AS ooo_rooms
SUM(CASE WHEN hri.`id_status` = '.(int) self::STATUS_INACTIVE.' THEN 1 ELSE 0 END) AS ooo_rooms
FROM `'._DB_PREFIX_.'htl_room_information` hri
INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hri.`id_product` AND p.`active` = 1)
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
@@ -385,6 +379,22 @@ class HotelRoomInformation extends ObjectModel
$bookingsByProduct[$b['id_product']][] = $b;
}
// Active rooms blocked by a disable date range (inactive rooms are already counted as out of order)
$disabledRaw = Db::getInstance()->executeS(
'SELECT hri.`id_product`, hrdd.`id_room`, hrdd.`date_from`, hrdd.`date_to`
FROM `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
INNER JOIN `'._DB_PREFIX_.'htl_room_information` hri ON (hri.`id` = hrdd.`id_room`)
WHERE hri.`id_status` = '.(int) self::STATUS_ACTIVE.'
AND hrdd.`date_from` < "'.$dateToNext.'" AND hrdd.`date_to` > "'.$dateFrom.'"'
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hri')
.($idProduct ? ' AND hri.`id_product` = '.$idProduct : '')
);
$disabledByProduct = array();
foreach ($disabledRaw as $d) {
$disabledByProduct[$d['id_product']][] = $d;
}
$result = array();
$current = $dateFrom;
while ($current <= $dateTo) {
@@ -399,9 +409,17 @@ class HotelRoomInformation extends ObjectModel
}
}
}
$disabledRooms = array();
if (isset($disabledByProduct[$idProd])) {
foreach ($disabledByProduct[$idProd] as $d) {
if ($d['date_from'] < $next && $d['date_to'] > $current) {
$disabledRooms[$d['id_room']] = true;
}
}
}
$booked = count($bookedRooms);
$total = (int) $rt['total_rooms'];
$ooo = (int) $rt['ooo_rooms'];
$ooo = (int) $rt['ooo_rooms'] + count($disabledRooms);
$available = max(0, $total - $booked - $ooo);
$result[] = array(
'date' => $current,
@@ -441,10 +459,8 @@ class HotelRoomInformation extends ObjectModel
return Db::getInstance()->executeS(
'SELECT hri.`id` AS id_room, hri.`room_num`, hri.`floor`,
CASE WHEN hri.`id_status` = '.(int) self::STATUS_TEMPORARY_INACTIVE.' AND hrdd.`id_room` IS NULL
THEN '.(int) self::STATUS_ACTIVE.'
ELSE hri.`id_status`
END AS id_status,
hri.`id_status`,
IF(hri.`id_status` = '.(int) self::STATUS_ACTIVE.' AND hrdd.`id_room` IS NOT NULL, 1, 0) AS is_disabled,
hri.`id_product`, hri.`id_hotel`,
pl.`name` AS room_type_name, hbil.`hotel_name`,
bkgs.`id_order`, bkgs.`date_from`, bkgs.`date_to`,

View File

@@ -177,23 +177,21 @@ class HotelRoomType extends ObjectModel
$objHRInformation->comment = $room['comment'];
if ($objHRInformation->save()) {
$idRoom = $objHRInformation->id;
if ((int)$room['id_status'] === (int)HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = Db::getInstance()->executeS(
'SELECT * FROM `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
WHERE hrdd.`id_room` = '.(int)$room['id']
);
$disableDates = Db::getInstance()->executeS(
'SELECT * FROM `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
WHERE hrdd.`id_room` = '.(int)$room['id']
);
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $disableDate) {
$objHRDisableDates = new HotelRoomDisableDates();
$objHRDisableDates->id_room_type = $idHotelRoomTypeNew;
$objHRDisableDates->id_room = $idRoom;
$objHRDisableDates->date_from = $disableDate['date_from'];
$objHRDisableDates->date_to = $disableDate['date_to'];
$objHRDisableDates->reason = $disableDate['reason'];
if (!$objHRDisableDates->save()) {
return false;
}
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $disableDate) {
$objHRDisableDates = new HotelRoomDisableDates();
$objHRDisableDates->id_room_type = $idHotelRoomTypeNew;
$objHRDisableDates->id_room = $idRoom;
$objHRDisableDates->date_from = $disableDate['date_from'];
$objHRDisableDates->date_to = $disableDate['date_to'];
$objHRDisableDates->reason = $disableDate['reason'];
if (!$objHRDisableDates->save()) {
return false;
}
}
}

View File

@@ -127,12 +127,12 @@ class AdminHotelAmenitiesController extends ModuleAdminController
}
}
$imgPath = $this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg';
$logoFile = (isset($amenity['logo_type']) && $amenity['logo_type'] == 'image') ? $amenity['logo'] : '';
$this->context->smarty->assign(array(
'amenity' => $amenity,
'id_category' => $idCategory,
'existing_img' => ($idAmenity && file_exists($imgPath))
? $this->module->getPathUri().self::IMG_DIR.$idAmenity.'.jpg'
'existing_img' => ($logoFile && file_exists($this->module->getLocalPath().self::IMG_DIR.$logoFile))
? $this->module->getPathUri().self::IMG_DIR.$logoFile
: false,
));
} else {
@@ -236,7 +236,9 @@ class AdminHotelAmenitiesController extends ModuleAdminController
}
} else {
$hasUpload = isset($_FILES['logo_image']) && !empty($_FILES['logo_image']['tmp_name']);
$hasExisting = $idAmenity && file_exists($this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg');
$objCurrent = new HotelAmenities($idAmenity);
$hasExisting = $idAmenity && $objCurrent->logo_type == 'image' && $objCurrent->logo
&& file_exists($this->module->getLocalPath().self::IMG_DIR.$objCurrent->logo);
if (!$hasUpload && !$hasExisting) {
$this->errors[] = $this->l('Please upload an image for this amenity.');
}
@@ -248,6 +250,7 @@ class AdminHotelAmenitiesController extends ModuleAdminController
}
$objHotelAmenities = $idAmenity ? new HotelAmenities($idAmenity) : new HotelAmenities();
$oldImage = ($objHotelAmenities->logo_type == 'image') ? $objHotelAmenities->logo : '';
foreach ($languages as $lang) {
$val = trim(Tools::getValue('amenity_name_'.$lang['id_lang']));
$objHotelAmenities->name[$lang['id_lang']] = $val ?: $nameDefault;
@@ -263,8 +266,8 @@ class AdminHotelAmenitiesController extends ModuleAdminController
return;
}
if ($logoType === 'icon') {
$imgFile = $this->module->getLocalPath().self::IMG_DIR.$objHotelAmenities->id.'.jpg';
if ($logoType === 'icon' && $oldImage) {
$imgFile = $this->module->getLocalPath().self::IMG_DIR.$oldImage;
if (file_exists($imgFile)) {
unlink($imgFile);
}
@@ -279,8 +282,13 @@ class AdminHotelAmenitiesController extends ModuleAdminController
if (!is_dir($imgDir)) {
mkdir($imgDir, 0755, true);
}
if (ImageManager::resize($imgFile['tmp_name'], $imgDir.$objHotelAmenities->id.'.jpg')) {
$objHotelAmenities->logo = $objHotelAmenities->id.'.jpg';
// random file name so that browsers do not show a cached old image
$imageName = $objHotelAmenities->id.'_'.substr(md5(uniqid(mt_rand(), true)), 0, 12).'.jpg';
if (ImageManager::resize($imgFile['tmp_name'], $imgDir.$imageName)) {
if ($oldImage && file_exists($imgDir.$oldImage)) {
unlink($imgDir.$oldImage);
}
$objHotelAmenities->logo = $imageName;
$objHotelAmenities->save();
} else {
$this->errors[] = $this->l('Error uploading amenity image.');

View File

@@ -165,6 +165,33 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
),
'hint' => $this->l('Enable to display hotels list on the contact us page.'),
),
'WK_MAX_AMENITIES_ROOM_SEARCH' => array(
'title' => $this->l('Maximum featured amenities in room search'),
'hint' => $this->l('Maximum number of featured amenities to display for each room type on the front office room search page.'),
'desc' => $this->l('Set to 0 to display all featured amenities.'),
'type' => 'text',
'cast' => 'intval',
'class' => 'fixed-width-xl',
'default' => '0',
),
'WK_MAX_FEATURES_ROOM_SEARCH' => array(
'title' => $this->l('Maximum featured features in room search'),
'hint' => $this->l('Maximum number of featured features to display for each room type on the front office room search page.'),
'desc' => $this->l('Set to 0 to display all featured features.'),
'type' => 'text',
'cast' => 'intval',
'class' => 'fixed-width-xl',
'default' => '0',
),
'WK_MAX_ROOM_TYPE_FEATURE_VALUES' => array(
'title' => $this->l('Maximum room type feature values per featured feature'),
'hint' => $this->l('Maximum number of room type feature values to display for each featured feature on the front office room search and order pages. For example, if the featured feature Bed Type has the values Single, Double and Queen and this is set to 2, only "Single, Double" is displayed.'),
'desc' => $this->l('Set to 0 to display all values of each featured feature.'),
'type' => 'text',
'cast' => 'intval',
'class' => 'fixed-width-xl',
'default' => '0',
),
),
'submit' => array('title' => $this->l('Save')),
),
@@ -529,6 +556,15 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
} elseif (Tools::getValue('WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT') > 100) {
$this->errors[] = $this->l('Minimum partial payment percentage should not be more than 100.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_AMENITIES_ROOM_SEARCH'))) {
$this->errors[] = $this->l('Maximum featured amenities in room search is invalid. Enter 0 or a positive number.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_FEATURES_ROOM_SEARCH'))) {
$this->errors[] = $this->l('Maximum featured features in room search is invalid. Enter 0 or a positive number.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_ROOM_TYPE_FEATURE_VALUES'))) {
$this->errors[] = $this->l('Maximum room type feature values per featured feature is invalid. Enter 0 or a positive number.');
}
if (Tools::getValue('WK_GOOGLE_ACTIVE_MAP')) {
if (!Tools::getValue('PS_API_KEY')) {
$this->errors[] = $this->l('Please enter Google API key.');

View File

@@ -386,7 +386,7 @@ class HotelReservationSystem extends Module
// delete the feature prices of the room type
HotelRoomTypeFeaturePricing::deleteFeaturePrices(false, $idProduct);
// delete the disable dates (temporary inactive status) of the room type
// delete the disable dates of the room type
$objRoomDisableDates = new HotelRoomDisableDates();
$objRoomDisableDates->deleteRoomDisableDatesByIdRoomType($idProduct);
}
@@ -607,6 +607,9 @@ class HotelReservationSystem extends Module
'WK_CUSTOMER_SUPPORT_PHONE_NUMBER',
'WK_CUSTOMER_SUPPORT_EMAIL',
'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST',
'WK_MAX_AMENITIES_ROOM_SEARCH',
'WK_MAX_FEATURES_ROOM_SEARCH',
'WK_MAX_ROOM_TYPE_FEATURE_VALUES',
'QLO_HEADER_MEDIA_TYPE',
'QLO_HEADER_CONTENT_ALIGN',
'QLO_HEADER_VIDEO_SOURCE_TYPE',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -68,9 +68,9 @@
<tr id="amenity_row_{$amenity.id}">
<td class="fixed-width-xs">
{if $amenity.logo_type == 'icon' && $amenity.logo}
<i class="{$amenity.logo|escape:'htmlall':'UTF-8'}"></i>
<i class="{$amenity.logo|escape:'htmlall':'UTF-8'}" style="color: #555555;"></i>
{elseif $amenity.logo_type == 'image' && $amenity.logo}
<img src="{$img_base_url}{$amenity.id}.jpg"
<img src="{$img_base_url}{$amenity.logo|escape:'htmlall':'UTF-8'}"
alt="{$amenity.name|escape:'htmlall':'UTF-8'}"
class="htl-amenity-logo-img" />
{else}

Some files were not shown because too many files have changed in this diff Show More