Merge branch 'develop' into gli-2269

This commit is contained in:
vishalsingh.qlo325
2025-03-28 15:28:19 +05:30
34 changed files with 389 additions and 272 deletions

View File

@@ -204,7 +204,7 @@ class HotelBookingDemands extends ObjectModel
}
// Rounding as per configurations
$totalAmount += Tools::processPriceRounding($amount, $quantity);
$totalAmount = Tools::processPriceRounding($amount, $quantity);
$values .= '('.(int)$this->id.','.(int)$idTax.','.(float)$amount.','.
(float)$totalAmount.'),';

View File

@@ -1872,6 +1872,7 @@ class HotelBookingDetail extends ObjectModel
$reallocatedBookingId = 0;
// get the cart booking data for the given booking
if (Validate::isLoadedObject($objOldHotelBooking = new HotelBookingDetail($idHotelBooking))) {
$objectHotelBookingFrom = clone $objOldHotelBooking;
$objHotelRoomInfo = new HotelRoomInformation($idRoom);
$idNewRoomType = $objHotelRoomInfo->id_product;
if ($objOldHotelBooking->id_product != $idNewRoomType) {
@@ -2098,6 +2099,7 @@ class HotelBookingDetail extends ObjectModel
if ($result &= $objBookingDetail->save()) {
$reallocatedBookingId = $objBookingDetail->id;
$objectHotelBookingTo = $objBookingDetail;
// Get Booking Demands of the old booking to add in the new booking creation
$objBookingDemand = new HotelBookingDemands();
if ($oldBookingDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
@@ -2278,6 +2280,7 @@ class HotelBookingDetail extends ObjectModel
$result &= $objOldHotelBooking->save();
$reallocatedBookingId = $objOldHotelBooking->id;
$objectHotelBookingTo = $objOldHotelBooking;
}
if ($result && $reallocatedBookingId) {
@@ -2286,6 +2289,8 @@ class HotelBookingDetail extends ObjectModel
array(
'id_htl_booking_from' => $idHotelBooking,
'id_htl_booking_to' => $reallocatedBookingId,
'objectHotelBookingFrom' => $objectHotelBookingFrom,
'objectHotelBookingTo' => $objectHotelBookingTo,
)
);

View File

@@ -24,17 +24,17 @@ class HotelHelper
{
$objModule = new HotelreservationSystem();
$jsVars = array(
'display_name' => $objModule->l('Display', 'HotelHelper', false, true),
'records_name' => $objModule->l('records per page', 'HotelHelper', false, true),
'no_product' => $objModule->l('No records found', 'HotelHelper', false, true),
'show_page' => $objModule->l('Showing page', 'HotelHelper', false, true),
'show_of' => $objModule->l('of', 'HotelHelper', false, true),
'no_record' => $objModule->l('No records available', 'HotelHelper', false, true),
'filter_from' => $objModule->l('filtered from', 'HotelHelper', false, true),
't_record' => $objModule->l('total records', 'HotelHelper', false, true),
'search_item' => $objModule->l('Search', 'HotelHelper', false, true),
'p_page' => $objModule->l('Previous', 'HotelHelper', false, true),
'n_page' => $objModule->l('Next', 'HotelHelper', false, true),
'display_name' => $objModule->l('Display', 'HotelHelper', true),
'records_name' => $objModule->l('records per page', 'HotelHelper', true),
'no_product' => $objModule->l('No records found', 'HotelHelper', true),
'show_page' => $objModule->l('Showing page', 'HotelHelper', true),
'show_of' => $objModule->l('of', 'HotelHelper', true),
'no_record' => $objModule->l('No records available', 'HotelHelper',true),
'filter_from' => $objModule->l('filtered from', 'HotelHelper', true),
't_record' => $objModule->l('total records', 'HotelHelper', true),
'search_item' => $objModule->l('Search', 'HotelHelper', true),
'p_page' => $objModule->l('Previous', 'HotelHelper', true),
'n_page' => $objModule->l('Next', 'HotelHelper', true),
);
Media::addJsDef($jsVars);
@@ -2231,6 +2231,10 @@ class HotelHelper
$objProduct->price_calculation_method = $serviceProduct['price_calculation_method'];
$objProduct->is_virtual = 1;
$objProduct->indexed = 1;
if ($objProduct->auto_add_to_cart && $objProduct->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM) {
$objProduct->id_tax_rules_group = 0;
}
$objProduct->save();
$idProduct = $objProduct->id;

View File

@@ -239,6 +239,13 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
$totalPrice += $product['total_price_tax_excl'];
}
} else {
$taxes = OrderDetailCore::getTaxListStatic($product['id_order_detail']);
$tax_temp = array();
foreach ($taxes as $tax) {
$obj = new Tax($tax['id_tax']);
$tax_temp[] = sprintf('%1$s%2$s%%', ($obj->rate + 0), ' ');
}
$product_tax_label = implode(', ', $tax_temp);
if (isset($selectedAdditionalServices['additional_services'])) {
$selectedAdditionalServices['total_price_tax_excl'] += $product['total_price_tax_excl'];
$selectedAdditionalServices['total_price_tax_incl'] += $product['total_price_tax_incl'];
@@ -257,6 +264,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'unit_price_tax_incl' => $product['unit_price_tax_incl'],
'total_price_tax_excl' => $product['total_price_tax_excl'],
'total_price_tax_incl' => $product['total_price_tax_incl'],
'product_tax_label' => $product_tax_label,
);
} else {
$selectedAdditionalServices['id_order'] = $product['id_order'];
@@ -282,6 +290,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'unit_price_tax_incl' => $product['unit_price_tax_incl'],
'total_price_tax_excl' => $product['total_price_tax_excl'],
'total_price_tax_incl' => $product['total_price_tax_incl'],
'product_tax_label' => $product_tax_label,
),
);
}

View File

@@ -222,6 +222,7 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
$smartyVars['MAX_GLOBAL_BOOKING_DATE'] = (Configuration::get('MAX_GLOBAL_BOOKING_DATE'));
$smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME');
$smartyVars['WK_ORDER_REFUND_ALLOWED'] = Configuration::get('WK_ORDER_REFUND_ALLOWED');
$this->context->smarty->assign($smartyVars);
@@ -322,6 +323,10 @@ class AdminAddHotelController extends ModuleAdminController
}
}
if ($activeRefund && !Configuration::get('WK_ORDER_REFUND_ALLOWED')) {
$this->errors[] = $this->l('Enable order refunds to allow hotel-wise refunds.');
}
// validate Friendly URL values
if (!trim(Tools::getValue('link_rewrite_'.$defaultLangId))) {
$this->errors[] = $this->l('Friendly URL is required at least in ').

View File

@@ -747,13 +747,13 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
}
} else {
// remove room from cart
$objHotelCartBookingData = new HotelCartBookingData($id_cart_book_data);
if ($objHotelCartBookingData->deleteCartBookingData(
$obj_booking_dtl->id_cart,
$objHotelCartBookingData->id_product,
$objHotelCartBookingData->id_room,
$objHotelCartBookingData->date_from,
$objHotelCartBookingData->date_to
if ((Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData((int) $id_cart_book_data)))
&& $objHotelCartBookingData->deleteCartBookingData(
$objHotelCartBookingData->id_cart,
$objHotelCartBookingData->id_product,
$objHotelCartBookingData->id_room,
$objHotelCartBookingData->date_from,
$objHotelCartBookingData->date_to
)) {
$response['success'] = true;
if ($ajax_delete) {
@@ -994,7 +994,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
'invalid_occupancy_txt' => $this->l('Invalid occupancy(adults/children) found.', null, true),
'PS_BACKDATE_ORDER_ALLOW' => $PS_BACKDATE_ORDER_ALLOW,
// 'check_calender_var' => $check_calender_var,
'txtSomeErr' => $this->l('Some error occurred. Please try again.'),
'txtSomeErr' => $this->l('Some error occurred. Please try again.', null, true),
'no_rm_avail_txt' => $this->l('No room available.', null, true),
'no_realloc_rm_avail_txt' => $this->l('No room available for reallocation.', null, true),
'no_realloc_rm_type_avail_txt' => $this->l('No room type available for reallocation.', null, true),

View File

@@ -1,4 +1,26 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*/
class AdminOrderRefundRulesController extends ModuleAdminController
{
public function __construct()
@@ -302,6 +324,23 @@ class AdminOrderRefundRulesController extends ModuleAdminController
}
}
protected function processUpdateOptions()
{
parent::processUpdateOptions();
if (empty($this->errors) && !Tools::getValue('WK_ORDER_REFUND_ALLOWED')) {
$objHotelBranchInfo = new HotelBranchInformation();
if ($hotels = $objHotelBranchInfo->getAllHotels()) {
foreach ($hotels as $hotel) {
$objHotelBranchInfo = new HotelBranchInformation($hotel['id']);
if ($objHotelBranchInfo->active_refund) {
$objHotelBranchInfo->active_refund = 0;
$objHotelBranchInfo->save();
}
}
}
}
}
public function setMedia()
{
parent::setMedia();

View File

@@ -482,20 +482,20 @@
{hook h='displayAdminAddHotelFormRefundPoliciesTabBefore' id_hotel=$hook_arg_id_hotel}
{if isset($hotel_info.id) && $hotel_info.id}
{if isset($WK_ORDER_REFUND_ALLOWED) && !$WK_ORDER_REFUND_ALLOWED}
<div class="alert alert-info">
{l s='To enable hotel-wise refunds, activate order refunds in' mod='hotelreservationsystem'} <a href="{$link->getAdminLink('AdminOrderRefundRules')|escape:'html':'UTF-8'}" target="_blank">{l s='Manage Order Refund Rules' mod='hotelreservationsystem'}</a>
</div>
{/if}
<div class="form-group">
<label for="active_refund" class="control-label col-sm-5">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title='{l s='Enable, if you want to enable refund for this hotel.' mod='hotelreservationsystem'}'>{l s='Enable refund' mod='hotelreservationsystem'}</span>
</label>
<div class="col-sm-7">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" value="1" id="active_refund_on" name="active_refund"
{if isset($smarty.post.active_refund)}{if $smarty.post.active_refund}checked="checked"{/if}{elseif isset($hotel_info) && $hotel_info.active_refund}checked="checked"{/if}>
<input type="radio" value="1" id="active_refund_on" name="active_refund" {if isset($WK_ORDER_REFUND_ALLOWED) && !$WK_ORDER_REFUND_ALLOWED} disabled="disabled" {elseif isset($smarty.post.active_refund)}{if $smarty.post.active_refund}checked="checked"{/if}{elseif isset($hotel_info) && $hotel_info.active_refund}checked="checked"{/if}>
<label for="active_refund_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" value="0" id="active_refund_off" name="active_refund"
{if isset($smarty.post.active_refund)}{if !$smarty.post.active_refund}checked="checked"{/if}{elseif !isset($hotel_info)}checked="checked"{elseif isset($hotel_info) && !$hotel_info.active_refund}checked="checked"{/if}>
<input type="radio" value="0" id="active_refund_off" name="active_refund" {if isset($WK_ORDER_REFUND_ALLOWED) && !$WK_ORDER_REFUND_ALLOWED} disabled="disabled" checked="checked" {elseif isset($smarty.post.active_refund)}{if !$smarty.post.active_refund}checked="checked"{/if}{elseif !isset($hotel_info)}checked="checked"{elseif isset($hotel_info) && !$hotel_info.active_refund}checked="checked"{/if}>
<label for="active_refund_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>

View File

@@ -264,6 +264,21 @@ class WkRoomSearchHelper
));
}
$totalColumns = 9;// min value
if ($locationEnabled) {
$totalColumns += 4;
}
if (!(count($hotelsInfo) <= 1 && !$smartyVars['show_hotel_name'])) {
$totalColumns += 5;
}
if (Configuration::get('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
$totalColumns += 4;
}
$smartyVars['total_columns'] = $totalColumns;
Context::getContext()->smarty->assign($smartyVars);
}
}

View File

@@ -337,23 +337,6 @@ const BookingSearchManager = {
return true;
},
}
function updateGridColumns() {
const gridContainer = $('#search_hotel_block_form > .grid');
$(gridContainer).each(function() {
const gridItems = $(this).find('div.grid-item');
let totalColumns = 0;
Array.from(gridItems).forEach(item => {
totalColumns += parseInt(getComputedStyle(item).getPropertyValue('--col-span'));
});
$(this).css('grid-template-columns', `repeat(${totalColumns}, 1fr)`);
Array.from(gridItems).forEach(item => {
item.style.gridColumn = `span ${getComputedStyle(item).getPropertyValue('--col-span')}`;
});
})
}
$(document).ready(function() {
// initialize booking search fields

View File

@@ -23,7 +23,7 @@
{if isset($hotels_info) && count($hotels_info)}
<div class="header-rmsearch-wrapper" id="xs_room_search_form">
<div class="header-rmsearch-primary">
<div class="fancy_search_header_xs">
<div class="fancy_search_header_xs" style="display:none;">
<p>{l s='Search Rooms' mod='wkroomsearchblock'}</p>
<hr>
</div>

View File

@@ -20,10 +20,10 @@
<form method="POST" id="search_hotel_block_form">
{hook h='displaySearchFormFieldsBefore'}
{block name="search_form_fields_wrapper"}
<div class="grid" id="search_form_fields_wrapper">
<div class="grid" id="search_form_fields_wrapper" style="grid-template-columns: repeat({$total_columns}, 1fr);">
{block name='search_form_location'}
{if isset($location_enabled) && $location_enabled}
<div class="form-group grid-item area-4">
<div class="form-group grid-item area-4" style="grid-column: span 4;">
<div class="dropdown">
<input type="text" class="form-control header-rmsearch-input input-location" id="hotel_location" name="hotel_location" autocomplete="off" placeholder="{l s='Hotel Location' mod='wkroomsearchblock'}" {if isset($search_data)}value="{$search_data['location']|escape:'htmlall':'UTF-8'}"{/if}>
<input hidden="hidden" name="location_category_id" id="location_category_id" {if isset($search_data)}value="{$search_data['location_category_id']|escape:'htmlall':'UTF-8'}"{/if}>
@@ -40,7 +40,7 @@
<input type="hidden" id="id_hotel" name="id_hotel" value="{$hotels_info[0]['id']|escape:'htmlall':'UTF-8'}">
<input type="hidden" id="htl_name" class="form-control header-rmsearch-input" value="{$hotels_info[0]['hotel_name']}" readonly>
{else}
<div class="form-group grid-item area-5">
<div class="form-group grid-item area-5" style="grid-column: span 5;">
<input type="hidden" id="hotel_cat_id" name="hotel_cat_id" {if isset($search_data)}value="{$search_data['htl_dtl']['id_category']|escape:'htmlall':'UTF-8'}"{/if}>
<input type="hidden" id="id_hotel" name="id_hotel" {if isset($search_data)}value="{$search_data['htl_dtl']['id']|escape:'htmlall':'UTF-8'}"{/if}>
<input type="hidden" id="max_order_date" name="max_order_date" value="{if isset($max_order_date)}{$max_order_date|escape:'htmlall':'UTF-8'}{/if}">
@@ -60,7 +60,7 @@
{block name='search_form_dates'}
{if isset($multiple_dates_input) && $multiple_dates_input}
<div class="grid-item area-5 multi-date" id="daterange_value">
<div class="grid-item area-5 multi-date" id="daterange_value" style="grid-column: span 5;">
<div class="form-group">
<input type="hidden" id="check_in_time" name="check_in_time" {if isset($search_data)}value="{$search_data['date_from']|escape:'htmlall':'UTF-8'}"{/if}>
<div class="form-control header-rmsearch-input input-date" autocomplete="off" id="daterange_value_from" placeholder="{l s='Check-in' mod='wkroomsearchblock'}"><span>{l s='Check-in' mod='wkroomsearchblock'}</span></div>
@@ -71,7 +71,7 @@
</div>
</div>
{else}
<div class="form-group grid-item area-5">
<div class="form-group grid-item area-5" style="grid-column: span 5;">
<input type="hidden" id="check_in_time" name="check_in_time" {if isset($search_data)}value="{$search_data['date_from']|escape:'htmlall':'UTF-8'}"{/if}>
<input type="hidden" id="check_out_time" name="check_out_time" {if isset($search_data)}value="{$search_data['date_to']|escape:'htmlall':'UTF-8'}"{/if}>
<div class="form-control header-rmsearch-input input-date" id="daterange_value" autocomplete="off" placeholder="{l s='Check-in - Check-out' mod='wkroomsearchblock'}" tabindex="-1"><span>{l s='Check-in' mod='wkroomsearchblock'} &nbsp;<i class="icon icon-minus"></i>&nbsp; {l s='Check-out' mod='wkroomsearchblock'}</span></div>
@@ -81,7 +81,7 @@
{block name='search_form_occupancy'}
{if isset($is_occupancy_wise_search) && $is_occupancy_wise_search}
<div class="form-group grid-item area-4">
<div class="form-group grid-item area-4" style="grid-column: span 4;">
<div class="dropdown">
<button class="form-control input-occupancy header-rmsearch-input {if isset($error) && $error == 1}error_border{/if}" type="button" data-toggle="dropdown" id="guest_occupancy">
<span class="pull-left">{if (isset($search_data['occupancy_adults']) && $search_data['occupancy_adults'])}{$search_data['occupancy_adults']} {if $search_data['occupancy_adults'] > 1}{l s='Adults' mod='wkroomsearchblock'}{else}{l s='Adult' mod='wkroomsearchblock'}{/if}, {if isset($search_data['occupancy_children']) && $search_data['occupancy_children']}{$search_data['occupancy_children']} {if $search_data['occupancy_children'] > 1}
@@ -235,7 +235,7 @@
{/if}
{/block}
{block name='search_form_submit'}
<div class="form-group grid-item search_room_submit_block area-4">
<div class="form-group grid-item search_room_submit_block area-4" style="grid-column: span 4;">
<button type="submit" class="btn btn btn-primary" name="search_room_submit" id="search_room_submit">
<span>{l s='Search Rooms' mod='wkroomsearchblock'}</span>
</button>
@@ -244,10 +244,3 @@
</div>
{/block}
</form>
<script>
{literal}
// Call the function to set the grid columns on load
updateGridColumns();
{/literal}
</script>