Merge branch 'develop' into gli-1799

This commit is contained in:
Sumit Panwar
2024-05-22 15:02:12 +05:30
51 changed files with 305 additions and 200 deletions

View File

@@ -68,7 +68,7 @@ class HotelAdvancedPayment extends ObjectModel
*/
public function getIdAdvPaymentByIdProduct($id_product)
{
$result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".$id_product);
$result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".(int) $id_product);
if ($result) {
return $result;

View File

@@ -794,14 +794,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
* @param [int] $id_product [id of the product]
* @return [array] [returns all feature prices by product]
*/
public function getFeaturePricesbyIdProduct($id_product)
public function getFeaturePricesbyIdProduct($id_product, $id_cart = 0, $id_guest = 0, $id_room = 0)
{
$idLang = Context::getContext()->language->id;
return Db::getInstance()->executeS(
'SELECT hrfp.*, hrfpl.`feature_price_name` FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` hrfp
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang` hrfpl
ON(hrfp.`id_feature_price` = hrfpl.`id_feature_price` AND hrfpl.`id_lang` = '.(int)$idLang.')
WHERE `id_product` = '.(int)$id_product
WHERE `id_product` = '.(int)$id_product.' AND `id_cart` = '.(int)$id_cart.' AND `id_guest` = '.(int)$id_guest.' AND `id_room` = '.(int)$id_room
);
}

View File

@@ -150,18 +150,6 @@ class AdminHotelFeaturesController extends ModuleAdminController
$this->errors[] = $this->l('Please add atleast one Child features.');
}
foreach ($languages as $lang) {
if (!trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
'parent_ftr_name_'.$defaultLangId
);
} else {
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
'parent_ftr_name_'.$lang['id_lang']
);
}
}
if (!count($this->errors)) {
if (isset($parentFeatureId) && $parentFeatureId) {
$objHotelFeatures = new HotelFeatures($parentFeatureId);
@@ -297,13 +285,20 @@ class AdminHotelFeaturesController extends ModuleAdminController
public function ajaxProcessDeleteFeature()
{
$idFeature = Tools::getValue('feature_id');
$objHotelFeatures = new HotelFeatures();
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
die('success');
$response = array('status' => false);
if ($this->tabAccess['delete']) {
$idFeature = Tools::getValue('feature_id');
$objHotelFeatures = new HotelFeatures();
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
$response['status'] = true;
} else {
$response['msg'] = $this->l('Some error occurred while deleting feature. Please try again.');
}
} else {
echo 0;
$response['msg'] = $this->l('You do not have the permission to delete this.');
}
$this->ajaxDie(json_encode($response));
}
public function setMedia()

View File

@@ -493,7 +493,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$cartrule->date_from = date('Y-m-d H:i:s', $now);
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
$cartrule->active = 1;
$cartrule->highlight = 1;
$cartrule->reduction_amount = $totalRefundedAmount;
$cartrule->reduction_tax = true;
$cartrule->minimum_amount_currency = $objOrder->id_currency;

View File

@@ -463,12 +463,13 @@ $(document).ready(function() {
action: 'deleteFeature',
},
method: 'POST',
success: function(data) {
if (data == 'success') {
dataType: 'json',
success: function(response) {
if (response.status) {
alert(success_delete_msg);
$('#grand_feature_div_' + ftr_id).remove();
} else {
alert(error_delete_msg);
alert(response.msg);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {

View File

@@ -1,5 +1,5 @@
<div class="copyRightWrapper">
<p class="copyRight">
&copy; {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date}&nbsp;<a href="{$base_dir}">&nbsp;{$WK_HTL_CHAIN_NAME}</a>.&nbsp;{l s=' All rights reserved.' mod='hotelreservationsystem'}
&copy;{if isset($WK_HTL_ESTABLISHMENT_YEAR) && $WK_HTL_ESTABLISHMENT_YEAR} {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date}&nbsp;{/if}<a href="{$base_dir}">&nbsp;{$WK_HTL_CHAIN_NAME}</a>.&nbsp;{l s=' All rights reserved.' mod='hotelreservationsystem'}
</p>
</div>

View File

@@ -29,11 +29,20 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
$this->bootstrap = true;
$this->context = Context::getContext();
$this->_select = ' pl.`name`, hbil.`hotel_name` ';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON (pl.`id_product` = a.`id_product` AND pl.id_lang = '.(int) $this->context->language->id.')';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (hrt.`id_product` = a.`id_product`)';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
ON (hrt.`id_hotel` = hbil.`id` AND hbil.`id_lang` = pl.`id_lang`)';
$this->fields_options = array(
'global' => array(
'title' => $this->l('Hotel Room Display Setting'),
'icon' => 'icon-cogs',
'fields' => array(
'title' => $this->l('Hotel Room Display Setting'),
'icon' => 'icon-cogs',
'fields' => array(
'HOTEL_ROOM_DISPLAY_HEADING' => array(
'title' => $this->l('Hotel Room Block Title'),
'type' => 'textLang',
@@ -73,6 +82,16 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
'search' => false,
'callback' => 'getProductImage',
),
'name' => array(
'title' => $this->l('Room Type'),
'align' => 'center',
'orderby' => false,
),
'hotel_name' => array(
'title' => $this->l('Hotel'),
'align' => 'center',
'orderby' => false,
),
'active' => array(
'title' => $this->l('Active'),
'align' => 'center',
@@ -109,6 +128,24 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
$this->identifier = 'id_room_block';
parent::__construct();
if ($this->hotelList = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1)) {
$objHotelRoomType = new HotelRoomType();
if ($this->loadObject(true)
&& $this->object->id
&& ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $this->object->id_product))
) {
$idsHotel = array_column($this->hotelList, 'id_hotel');
if (!in_array($roomTypeInfo['id_hotel'], $idsHotel)) {
$this->tabAccess['edit'] = 0;
$this->tabAccess['view'] = 0;
}
}
} else {
if ($this->loadObject(true) && $this->object->id) {
$this->tabAccess['view'] =0;
$this->tabAccess['edit'] =0;
}
}
}
public function getProductImage($idProduct)
@@ -152,23 +189,27 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
if (!($this->loadObject(true))) {
return;
} else if (!$this->object->id && empty($this->hotelList)) {
$this->warnings[] = $this->l('No hotel found to create new hotel room block.');
return;
}
$productName = $idProduct = false;
if ($this->display == 'edit') {
$objRoomBlock = new WkHotelRoomDisplay($obj->id);
$idProduct = $objRoomBlock->id_product;
$productName = false;
if ($idProduct = $this->object->id_product) {
$product = new Product($idProduct, false, Configuration::get('PS_LANG_DEFAULT'));
$productName = $product->name;
$objHotelRoomType = new HotelRoomType();
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $product->id)) {
$this->fields_value['id_hotel'] = $roomInfo['id_hotel'];
}
}
$this->context->smarty->assign(
array(
'productName' => $productName,
'idProduct' => $idProduct,
'idProduct' => $idProduct
)
);
$html = $this->context->smarty->fetch(
@@ -182,6 +223,19 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
'icon' => 'icon-globe'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Select hotel'),
'name' => 'id_hotel',
'required' => true,
'class' => 'chosen',
'options' => array(
'query' => $this->hotelList,
'id' => 'id_hotel',
'name' => 'hotel_name'
),
'hint' => $this->l('Select the hotel to search for the room types.'),
),
array(
'label' => $this->l('Search Room Type'),
'type' => 'html',
@@ -384,7 +438,7 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
if (isset($pos[2]) && (int) $pos[2] === $idRoomBlock) {
if ($objRoomBlock = new WkHotelRoomDisplay((int) $pos[2])) {
if (isset($position)
&& $objRoomBlock->updatePosition($way, $position, $idRoomBlock)
&& $objRoomBlock->updatePosition($way, $position)
) {
echo 'ok position '.(int) $position.' for hotel room block '.(int) $pos[1].'\r\n';
} else {

View File

@@ -32,27 +32,31 @@ $(document).ready(function() {
var word = $(this).val();
var d = new Date();
var n = d.getTime();
trigger_ajax = $.ajax({
url: "ajax_products_list.php",
dataType: 'json',
data: {
q: word,
_: n,
booking_product: '1',
},
success: function(result) {
if (result) {
var html = '';
$.each(result, function(key, value) {
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">' + value.name + '</a></li>';
});
suggestion_ul.html(html).show();
} else {
suggestion_ul.empty().hide();
suggestion_ul.siblings("input#id_product").val(null);
var id_hotel = parseInt($('#id_hotel').val());
if (!isNaN(id_hotel)) {
trigger_ajax = $.ajax({
url: "ajax_products_list.php",
dataType: 'json',
data: {
q: word,
_: n,
booking_product: '1',
id_hotel: id_hotel
},
success: function(result) {
if (result) {
var html = '';
$.each(result, function(key, value) {
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">'+value.name+' (#'+value.id+')</a></li>';
});
suggestion_ul.html(html).show();
} else {
suggestion_ul.empty().hide();
suggestion_ul.siblings("input#id_product").val(null);
}
}
}
});
});
}
}
}
});
@@ -73,4 +77,9 @@ $(document).ready(function() {
$('ul.prod_suggest_ul').empty().hide();
}
});
$(document).on('change', '#id_hotel', function () {
// resetting the fields on hotel change
$('#id_product').val('');
$('#productName').val('');
});
});

View File

@@ -159,11 +159,13 @@ class WkRoomSearchHelper
$searchedData['location'] = $objLocationCategory->name;
} else {
$locationCategoryId = $objCategory->id_parent;
$searchedData['location'] = $searchedData['htl_dtl']['city'];
if (isset($searchedData['htl_dtl']['state_name'])) {
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name'];
if ($searchedData['htl_dtl']) {
$searchedData['location'] = $searchedData['htl_dtl']['city'];
if (isset($searchedData['htl_dtl']['state_name'])) {
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['state_name'];
}
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name'];
}
$searchedData['location'] .= ', '.$searchedData['htl_dtl']['country_name'];
}
$searchedData['location_category_id'] = $locationCategoryId;