Merge branch 'develop' into gli-1517_2

This commit is contained in:
vishalsingh.qlo325
2024-09-16 15:04:33 +05:30
51 changed files with 2728 additions and 1885 deletions

View File

@@ -1,2 +1,117 @@
#leave_bprice
margin-left: 0px
#deactiveDatesModal
.fc-popover-body .fc-daygrid-event-harness
.fc-event-end, .fc-event-start
margin-left: unset
margin-right: unset
.fc-popover.fc-more-popover
max-width: 450px
.fc-daygrid-event
box-shadow: 0px 1px 2px 0px rgba(171, 171, 171, 0.3)
border-radius: 4px
.fc-daygrid-day-bg
min-height: 40px
.fc-h-event.fc-event
border-color: #FFFFFF
background: #FFFFFF
.fc-h-event .fc-event-main
color: #333333
.fc-h-event.fc-event.calendar_hover_highlight
border-color: #CAE4FF
background: #CAE4FF
.fc-event-title-container
cursor: pointer
padding: 4px
.highlight-event-day
background: #F5F5F5
.fc-event-title
text-overflow: ellipsis
white-space: nowrap
max-width: 65%
overflow: hidden
padding-left: 10px
.event_title_container, .fc-popover-body .fc-event-title
border-left: 2px solid red
#disable_dates_form
.date_from_container, .date_to_container
.ui-datepicker
position: absolute
top: 62px
left: 5px
position: relative
textarea
border-radius: 4px
.form-group
.control-label
margin-bottom: 5px
.btn
border-radius: 5px
.modal-title
.add_disable_dates, .close
margin-right: 10px
.remove_disable_dates
margin-right: 20px
.close
line-height: 2
.disable_dates_title
.disable_dates_room_num
color: grey
display: inline-block
font-weight: 600
line-height: 2
.delete_disable_dates
margin-left: 10px
.delete_disable_dates:hover , .edit_disable_dates:hover
cursor: pointer
.tooltip_info_block
.tooltip_title
margin: 10px 5px
font-weight: 600
min-width: 340px
.tooltip_container
.tooltip_title
.close
opacity: 0.6
padding-bottom: 5px
font-weight: 600
.tooltip_label
font-weight: 400
color: #888888
margin-bottom: 5px
.tooltip_event_title
border: 1px solid #D9D9D9
border-radius: 6px
padding: 5px 10px
.tooltip_content
.tooltip_reason
word-wrap: break-word
max-height: 200px
overflow: auto
.tooltip_reason_container, .id_event
margin-top: 10px
&> div
display: inline-block
.row
margin-left: 0
margin-right: 0
ul.disable_dates_actions
.btn
text-align: left
display: block
border: none
padding-left: 0
margin-bottom: 0
list-style-type: none
font-size: 14px
z-index: 99999
position: absolute
min-width: 450px
max-width: 450px
background: #fff
box-shadow: 0 8px 25px -2px rgba(0,0,0,0.20)
padding: 15px
border-radius: 6px
.tooltip_action_block
min-width: unset

View File

@@ -137,6 +137,23 @@ body
padding-right: 8px
.form-group
margin-bottom: 8px
#page-loader
position: fixed
display: none
inset: 0
z-index: 10000
background-color: rgba(0, 0, 0, 0.5)
span
position: absolute
inset: 0
display: flex
justify-content: center
align-items: center
i
color: #fff
font-size: 50px
//data-focus
.data-focus

View File

@@ -124,3 +124,25 @@ html
ul#ellipsis_submenu
left: 0
right: unset
#deactiveDatesModal
.tooltip_container
.disable_dates_actions
.btn
text-align: right !important
padding-inline-start: unset
.fc-event-title
border-left: unset !important
border-right: 2px solid red !important
padding-right: 10px !important
padding-left: unset !important
.delete_disable_dates
margin-left: unset !important
margin-right: 10px
.remove_disable_dates
margin-right: 10px !important
margin-left: 20px
.alert.alert-danger
text-align: right !important
.error_message_label
float: right !important

View File

@@ -124,7 +124,7 @@
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-id_order="{$data['id_order']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}' data-allotment_type='{$data['booking_type']}' data-allotment_type_label='{if $data['booking_type'] == $ALLOTMENT_MANUAL}{l s='Manual'}{else}{l s='Auto'}{/if}' data-comment='{$data.comment}'>
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-id_order="{$data['id_order']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}' data-allotment_type='{$data.booking_type}' data-allotment_type_label='{if $data.booking_type == $ALLOTMENT_MANUAL}{l s='Manual'}{else}{l s='Auto'}{/if}' data-comment='{$data.comment}'>
<i class="icon-refresh"></i>
{l s='Reallocate/Swap Room'}
</a>

View File

@@ -45,7 +45,7 @@
<td>
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
<input type="text" class="form-control unit_price" value="{Tools::ps_round($demand['unit_price_tax_excl'], 2)}">
<input type="text" class="form-control unit_price" value="{$demand['unit_price_tax_excl']}">
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
@@ -115,7 +115,7 @@
{else}
{assign var=demand_price value=$demand['price_tax_excl']}
{/if}
<input type="text" class="form-control unit_price" value="{Tools::ps_round($demand_price, 2)}" data-id-product="{$product['id_product']}">
<input type="text" class="form-control unit_price" value="{$demand_price}" data-id-product="{$product['id_product']}">
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}

View File

@@ -57,9 +57,11 @@
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
<p style="display:{if $service['quantity'] > $service['max_quantity']}block{else}none{/if}; margin-top: 4px;">
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']}</span>
</p>
{if $service['max_quantity']}
<p style="display:{if $service['quantity'] > $service['max_quantity']}block{else}none{/if}; margin-top: 4px;">
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']}</span>
</p>
{/if}
</div>
{else}
--

View File

@@ -78,7 +78,7 @@
<td class="demand_price_{$demand['id_global_demand']}">
<div class="input-group price_input" {if !isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="option_price_{$option['id']|escape:'html':'UTF-8'}" value="{if isset($selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price'])}{Tools::ps_round($selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price'], 2)|escape:'html':'UTF-8'}{else}{Tools::ps_round($option['price'], 2)|escape:'html':'UTF-8'}{/if}"/>
<input type="text" name="option_price_{$option['id']|escape:'html':'UTF-8'}" value="{if isset($selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price'])}{$selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price']|escape:'html':'UTF-8'}{else}{$option['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
<div class="price_display" {if isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
{displayPrice price={$option['price']|escape:'html':'UTF-8'} currency=$idDefaultcurrency}
@@ -112,7 +112,7 @@
<div class="input-group price_input" {if !isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
<input type="text" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
value="{if isset($selectedDemands[$demand['id_global_demand']]['price'])}{Tools::ps_round($selectedDemands[$demand['id_global_demand']]['price'], 2)|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{Tools::ps_round($demand['price'], 2)|escape:'html':'UTF-8'}{/if}"/>
value="{if isset($selectedDemands[$demand['id_global_demand']]['price'])}{$selectedDemands[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
</div>
<div class="price_display" {if isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
{displayPrice price={$demand['price']|escape:'html':'UTF-8'} currency=$idDefaultcurrency}

View File

@@ -17,21 +17,17 @@
* @license LICENSE.txt
*}
{l s='This room already has bookings for highlighted date range(s):'}
<table width="70%">
<tr>
<th class="text-center">{l s='Order ID'}</th>
<th class="text-center">{l s='Date From'}</th>
<th class="text-center">{l s='Date To'}</th>
</tr>
{foreach from=$booked_rows_list item=booked_row}
<tr>
<td class="text-center">
<a href="{$link->getAdminLink('AdminOrders')}&id_order={$booked_row->id_order}&vieworder" target="_blank"><strong>#{$booked_row->id_order|intval}</strong></a>
</td>
<td class="text-center">{dateFormat date=$booked_row->date_from}</td>
<td class="text-center">{dateFormat date=$booked_row->date_to}</td>
</tr>
{/foreach}
</table>
{l s='This room already has a booking for the selected date range.'}
<div class="row">
<div class="col-xs-12">
<span class="error_message_label">{l s='Order ID'}:</span> <a href="{$link->getAdminLink('AdminOrders')}&id_order={$orderDetails->id_order}&vieworder" target="_blank"><strong>#{$orderDetails->id_order|intval}</strong></a>
</div>
<div class="col-xs-12">
<span class="error_message_label">{l s='Date From'}:</span> {dateFormat date=$orderDetails->date_from}
</div>
<div class="col-xs-12">
<span class="error_message_label">{l s='Date To'}:</span> {dateFormat date=$orderDetails->date_to}
</div>
<div>
</div>
</div>

View File

@@ -371,3 +371,4 @@
<div id="main">
<div id="content" class="{if !$bootstrap}nobootstrap{else}bootstrap{/if}">
{/if}
<div id="page-loader"><span><i class="icon-refresh icon-spin icon-fw"></i></span></div>

View File

@@ -721,29 +721,6 @@ class CartCore extends ObjectModel
$cart_shop_context
);
/*Before Changes by webkul*/
// switch (Configuration::get('PS_ROUND_TYPE'))
// {
// case Order::ROUND_TOTAL:
// $row['total'] = $row['price_with_reduction_without_tax'] * (int)$row['cart_quantity'];
// $row['total_wt'] = $row['price_with_reduction'] * (int)$row['cart_quantity'];
// break;
// case Order::ROUND_LINE:
// $row['total'] = Tools::ps_round($row['price_with_reduction_without_tax'] * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
// $row['total_wt'] = Tools::ps_round($row['price_with_reduction'] * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
// break;
// case Order::ROUND_ITEM:
// default:
// $row['total'] = Tools::ps_round($row['price_with_reduction_without_tax'], _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
// $row['total_wt'] = Tools::ps_round($row['price_with_reduction'], _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
// break;
// }
//$row['price_wt'] = $row['price_with_reduction'];
//
//
/*By Webkul */
if ($row['booking_product']) {
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
@@ -757,81 +734,57 @@ class CartCore extends ObjectModel
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
$cartRoomInfo['id_room'],
0
);
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
$cartRoomInfo['id_room'],
0
);
$totalPriceByProductTaxIncl += $roomTotalPrice['total_price_tax_incl'];
$totalPriceByProductTaxExcl += $roomTotalPrice['total_price_tax_excl'];
}
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_TOTAL:
$row['total'] = $totalPriceByProductTaxExcl;
$row['total_wt'] = $totalPriceByProductTaxIncl;
break;
case Order::ROUND_LINE:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
break;
case Order::ROUND_ITEM:
default:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
break;
}
// Rounding as per configurations
$row['total'] = Tools::processPriceRounding($totalPriceByProductTaxExcl);
$row['total_wt'] = Tools::processPriceRounding($totalPriceByProductTaxIncl);
}
} else if (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $row['service_product_type']) {
$row['total'] = 0;
$row['total_wt'] = 0;
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$totalPriceByProductTaxIncl = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, true, null);
$totalPriceByProductTaxExcl = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart($this->id, (int)$row['id_product'], 0, 0, 0, 0, 0, false, null);
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_TOTAL:
$row['total'] = $totalPriceByProductTaxExcl;
$row['total_wt'] = $totalPriceByProductTaxIncl;
break;
case Order::ROUND_LINE:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
break;
case Order::ROUND_ITEM:
default:
$row['total'] = Tools::ps_round($totalPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($totalPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
break;
if ($servicesWithRoom = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->id,
(int)$row['id_product'],
0,
0,
0,
0,
0,
0,
null,
$row['auto_add_to_cart'],
null,
null
)) {
foreach ($servicesWithRoom as $service) {
// Rounding as per configurations
$row['total'] += Tools::processPriceRounding($service['unit_price_tax_excl'], $service['quantity']);
$row['total_wt'] += Tools::processPriceRounding($service['unit_price_tax_incl'], $service['quantity']);
}
}
} else {
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
$unitPriceByProductTaxIncl = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$row['id_product'], 0, true);
$unitPriceByProductTaxExcl = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$row['id_product'], 0, false);
switch (Configuration::get('PS_ROUND_TYPE'))
{
case Order::ROUND_TOTAL:
$row['total'] = $unitPriceByProductTaxExcl * (int)$row['cart_quantity'];
$row['total_wt'] = $unitPriceByProductTaxIncl * (int)$row['cart_quantity'];
break;
case Order::ROUND_LINE:
$row['total'] = Tools::ps_round($unitPriceByProductTaxExcl * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
$row['total_wt'] = Tools::ps_round($unitPriceByProductTaxIncl * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
break;
// Rounding as per configurations
$row['total'] += Tools::processPriceRounding($unitPriceByProductTaxExcl, $row['cart_quantity']);
$row['total_wt'] += Tools::processPriceRounding($unitPriceByProductTaxIncl, $row['cart_quantity']);
case Order::ROUND_ITEM:
default:
$row['total'] = Tools::ps_round($unitPriceByProductTaxExcl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
$row['total_wt'] = Tools::ps_round($unitPriceByProductTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
break;
}
$row['price_wt'] = $row['price_with_reduction'];
}
@@ -1794,19 +1747,36 @@ class CartCore extends ObjectModel
$objHotelServiceProductCartDetail = new HotelServiceProductCartDetail();
$price = $objHotelServiceProductCartDetail->getHotelProductUnitPrice($this->id, (int)$product['id_product'], 0, $with_taxes);
} else if (!$product['booking_product'] && Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type']) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$totalPriceByProduct = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
if ($servicesWithRoom = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$this->id,
(int)$product['id_product'],
isset($product['id_hotel']) ? $product['id_hotel'] : 0,
0,
0,
0,
0,
$with_taxes,
0,
0,
null,
$product['auto_add_to_cart'],
null,
null
);
)) {
foreach ($servicesWithRoom as $service) {
if ($with_taxes) {
$servicePrice = $service['total_price_tax_incl'];
} else {
$servicePrice = $service['total_price_tax_excl'];
}
// Rounding as per configurations
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += $servicePrice;
} else {
$products_total[$id_tax_rules_group] += $servicePrice;
}
}
}
} else if ($roomTypesByIdProduct = $objCartBookingData->getCartInfoIdCartIdProduct($this->id, $product['id_product'])) {
// by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices....
$totalPriceByProduct = 0;
@@ -1825,9 +1795,9 @@ class CartCore extends ObjectModel
0
);
if ($with_taxes) {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_incl'];
$totalPriceByProduct = $roomTotalPrice['total_price_tax_incl'];
} else {
$totalPriceByProduct += $roomTotalPrice['total_price_tax_excl'];
$totalPriceByProduct = $roomTotalPrice['total_price_tax_excl'];
}
// If customer has selected advance payment of the cart
@@ -1846,40 +1816,16 @@ class CartCore extends ObjectModel
$totalPriceByProduct = $advProductPrice;
}
}
// Rounding as per configurations
if ($ps_round_type == Order::ROUND_TOTAL) {
$products_total[$id_tax_rules_group.'_'.$id_address] += Tools::processPriceRounding($totalPriceByProduct);
} else {
$products_total[$id_tax_rules_group] += Tools::processPriceRounding($totalPriceByProduct);
}
}
}
switch ($ps_round_type) {
case Order::ROUND_TOTAL:
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$products_total[$id_tax_rules_group.'_'.$id_address] += $totalPriceByProduct;
} else {
$products_total[$id_tax_rules_group.'_'.$id_address] += $price * (int)$product['cart_quantity'];
}
break;
case Order::ROUND_LINE:
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$product_price = $totalPriceByProduct;
} else {
$product_price = $price * $product['cart_quantity'];
}
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
break;
case Order::ROUND_ITEM:
default:
if ($product['booking_product'] || (Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product['service_product_type'])) {
$product_price = $totalPriceByProduct;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision);
} else {
$product_price = /*$with_taxes ? $tax_calculator->addTaxes($price) : */$price;
$products_total[$id_tax_rules_group] += Tools::ps_round($product_price, $compute_precision) * (int)$product['cart_quantity'];
}
break;
}
// price of extra demands on room type in the cart
$totalDemandsPrice += $objCartBookingData->getCartExtraDemands($this->id, $product['id_product'], 0, 0, 0, 1, 0, (int)$with_taxes);
}

View File

@@ -540,7 +540,7 @@ abstract class PaymentModuleCore extends Module
$price_wt = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart);
$product_price = Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt;
$product_price = Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, _PS_PRICE_COMPUTE_PRECISION_) : $price_wt;
$product_var_tpl = array(
'reference' => $product['reference'],
@@ -627,11 +627,11 @@ abstract class PaymentModuleCore extends Module
$used = array('incl' => 0, 'excl' => 0);
if (!isset($cart_rules[$key]['remaining'])) {
$cart_rules[$key]['remaining'] = $cart_rule['obj']->reduction_amount;
if ((int) $cart_rule['obj']->reduction_currency !== (int) $cart->id_currency) {
if ((int) $cart_rule['obj']->reduction_currency !== (int) $this->context->cart->id_currency) {
$cart_rules[$key]['remaining'] = Tools::convertPriceFull(
$cart_rule['obj']->reduction_amount,
new Currency($cart_rule['obj']->reduction_currency),
new Currency($cart->id_currency)
new Currency($this->context->cart->id_currency)
);
}
}
@@ -819,10 +819,11 @@ abstract class PaymentModuleCore extends Module
$objCartBookingData->id_room,
0
);
$objBookingDetail->date_from = $objCartBookingData->date_from;
$objBookingDetail->date_to = $objCartBookingData->date_to;
$objBookingDetail->total_price_tax_excl = Tools::ps_round($total_price['total_price_tax_excl'], 6);
$objBookingDetail->total_price_tax_incl = Tools::ps_round($total_price['total_price_tax_incl'], 6);
$objBookingDetail->total_price_tax_excl = $total_price['total_price_tax_excl'];
$objBookingDetail->total_price_tax_incl = $total_price['total_price_tax_incl'];
$objBookingDetail->adults = $objCartBookingData->adults;
$objBookingDetail->children = $objCartBookingData->children;
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
@@ -850,7 +851,7 @@ abstract class PaymentModuleCore extends Module
}
/*for saving details of the advance payment product wise*/
$objBookingDetail->total_paid_amount = Tools::ps_round($total_price['total_price_tax_incl'], 5);
$objBookingDetail->total_paid_amount = $total_price['total_price_tax_incl'];
if ($this->context->cart->is_advance_payment) {
$prod_adv_payment = $objAdvancedPayment->getIdAdvPaymentByIdProduct($idProduct);
if (!$prod_adv_payment
@@ -898,18 +899,17 @@ abstract class PaymentModuleCore extends Module
$idOption,
1
);
$qty = 1;
$numDays = 1;
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$numDays = $objBookingDetail->getNumberOfDays(
$objBookingDetail->date_from,
$objBookingDetail->date_to
);
if ($numDays > 1) {
$qty *= $numDays;
}
}
$objBookingDemand->total_price_tax_excl = $objBookingDemand->unit_price_tax_excl * $qty;
$objBookingDemand->total_price_tax_incl = $objBookingDemand->unit_price_tax_incl * $qty;
$objBookingDemand->total_price_tax_excl = Tools::processPriceRounding(($objBookingDemand->unit_price_tax_excl * $numDays));
$objBookingDemand->total_price_tax_incl = Tools::processPriceRounding(($objBookingDemand->unit_price_tax_incl * $numDays));
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;

View File

@@ -3299,10 +3299,12 @@ class ProductCore extends ObjectModel
);
}
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['price'])) {
$price = (float)$priceForRoomInfo['price'];
} elseif (!$specific_price || $specific_price['price'] < 0) {
$price = (float)$result['price'];
if (!$specific_price || $specific_price['price'] < 0) {
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['price'])) {
$price = (float)$priceForRoomInfo['price'];
} else {
$price = (float)$result['price'];
}
} else {
$price = (float)$specific_price['price'];
}

View File

@@ -3800,6 +3800,27 @@ exit;
}
return $base;
}
public static function processPriceRounding($value, $qty = 1, $roundType = null, $roundMode = null)
{
if (!$roundType) {
$roundType = Configuration::get('PS_ROUND_TYPE');
}
switch ($roundType) {
case Order::ROUND_TOTAL:
$value = $value;
break;
case Order::ROUND_LINE:
$value = Tools::ps_round(($value * $qty), _PS_PRICE_COMPUTE_PRECISION_, $roundMode);
break;
case Order::ROUND_ITEM:
default:
$value = Tools::ps_round($value, _PS_PRICE_COMPUTE_PRECISION_, $roundMode) * $qty;
break;
}
return $value;
}
}
/**

View File

@@ -2938,7 +2938,8 @@ class AdminControllerCore extends Controller
'current' => self::$currentIndex,
'token' => $this->token,
'host_mode' => defined('_PS_HOST_MODE_') ? 1 : 0,
'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT')
'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT'),
'language_is_rtl' => $this->context->language->is_rtl
));
if ($this->display_header) {

View File

@@ -2535,20 +2535,8 @@ class OrderCore extends ObjectModel
}
foreach ($tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $unit_amount) {
$total_tax_base = 0;
switch ($round_type) {
case Order::ROUND_ITEM:
$total_tax_base = $quantity * Tools::ps_round($discounted_price_tax_excl, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode);
$total_amount = $quantity * Tools::ps_round($unit_amount, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode);
break;
case Order::ROUND_LINE:
$total_tax_base = Tools::ps_round($quantity * $discounted_price_tax_excl, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode);
$total_amount = Tools::ps_round($quantity * $unit_amount, _PS_PRICE_COMPUTE_PRECISION_, $this->round_mode);
break;
case Order::ROUND_TOTAL:
$total_tax_base = $quantity * $discounted_price_tax_excl;
$total_amount = $quantity * $unit_amount;
break;
}
$total_tax_base = Tools::processPriceRounding($discounted_price_tax_excl, $quantity);
$totalPrice = Tools::processPriceRounding($unit_amount, $quantity);
if (!isset($breakdown[$id_tax])) {
$breakdown[$id_tax] = array('tax_base' => 0, 'tax_amount' => 0);

View File

@@ -398,22 +398,10 @@ class OrderDetailCore extends ObjectModel
$values = '';
foreach ($this->tax_calculator->getTaxesAmount($discounted_price_tax_excl) as $id_tax => $amount) {
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_ITEM:
$unit_amount = (float)Tools::ps_round($amount, _PS_PRICE_COMPUTE_PRECISION_);
$total_amount = $unit_amount * $this->product_quantity;
break;
case Order::ROUND_LINE:
$unit_amount = $amount;
$total_amount = Tools::ps_round($unit_amount * $this->product_quantity, _PS_PRICE_COMPUTE_PRECISION_);
break;
case Order::ROUND_TOTAL:
$unit_amount = $amount;
$total_amount = $unit_amount * $this->product_quantity;
break;
}
$values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$unit_amount.','.(float)$total_amount.'),';
$total_amount = Tools::processPriceRounding($unit_amount, $this->product_quantity, $order->round_type, $order->round_mode);
$values .= '('.(int)$this->id.','.(int)$id_tax.','.(float)$amount.','.(float)$total_amount.'),';
}
if ($replace) {

View File

@@ -283,7 +283,6 @@ class OrderSlipCore extends ObjectModel
/**
* @deprecated since 1.6.0.10 use OrderSlip::create() instead
*
*/
public static function createOrderSlip($order, $productList, $qtyList, $shipping_cost = false)
{
@@ -374,49 +373,55 @@ class OrderSlipCore extends ObjectModel
$id_tax_rules_group = Product::getIdTaxRulesGroupByIdProduct((int)$order_detail->product_id);
$tax_calculator = TaxManagerFactory::getManager($address, $id_tax_rules_group)->getTaxCalculator();
$order_slip->{'total_products_tax_'.$inc_or_ex_1} += $price * $numDays;
if (in_array(Configuration::get('PS_ROUND_TYPE'), array(Order::ROUND_ITEM, Order::ROUND_LINE))) {
if (!isset($total_products[$id_tax_rules_group])) {
$total_products[$id_tax_rules_group] = 0;
}
} else {
$ps_round_type = Configuration::get('PS_ROUND_TYPE');
if ($ps_round_type == Order::ROUND_TOTAL) {
if (!isset($total_products[$id_tax_rules_group.'_'.$id_address])) {
$total_products[$id_tax_rules_group.'_'.$id_address] = 0;
}
} else {
if (!isset($total_products[$id_tax_rules_group])) {
$total_products[$id_tax_rules_group] = 0;
}
}
$product_tax_incl_line = Tools::ps_round($tax_calculator->{$add_or_remove.'Taxes'}($price) * $numDays, _PS_PRICE_COMPUTE_PRECISION_);
$product_tax_inc_or_ex_1 = Tools::processPriceRounding(
($price * $numDays),
1,
$order->round_type,
$order->round_mode
);
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_ITEM:
$product_tax_incl = Tools::ps_round($tax_calculator->{$add_or_remove.'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_) * $numDays;
$total_products[$id_tax_rules_group] += $product_tax_incl;
break;
case Order::ROUND_LINE:
$product_tax_incl = $product_tax_incl_line;
$total_products[$id_tax_rules_group] += $product_tax_incl;
break;
case Order::ROUND_TOTAL:
$product_tax_incl = $product_tax_incl_line;
$total_products[$id_tax_rules_group.'_'.$id_address] += $price * $numDays;
break;
$order_slip->{'total_products_tax_'.$inc_or_ex_1} += $product_tax_inc_or_ex_1;
$product_tax_inc_or_ex_2 = Tools::processPriceRounding(
($tax_calculator->{$add_or_remove.'Taxes'}($price * $numDays)),
1,
$order->round_type,
$order->round_mode
);
if ($ps_round_type == Order::ROUND_TOTAL) {
$total_products[$id_tax_rules_group.'_'.$id_address] += $product_tax_inc_or_ex_2;
} else {
$total_products[$id_tax_rules_group] += $product_tax_inc_or_ex_2;
}
$booking['unit_price_tax_'.$inc_or_ex_1] = $price;
$booking['unit_price_tax_'.$inc_or_ex_2] = Tools::ps_round($tax_calculator->{$add_or_remove.'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_);
$booking['total_price_tax_'.$inc_or_ex_1] = Tools::ps_round($price * $numDays, _PS_PRICE_COMPUTE_PRECISION_);
$booking['total_price_tax_'.$inc_or_ex_2] = Tools::ps_round($product_tax_incl, _PS_PRICE_COMPUTE_PRECISION_);
$booking['unit_price_tax_'.$inc_or_ex_2] = $tax_calculator->{$add_or_remove.'Taxes'}($price);
$booking['total_price_tax_'.$inc_or_ex_1] = $product_tax_inc_or_ex_1;
$booking['total_price_tax_'.$inc_or_ex_2] = $product_tax_inc_or_ex_2;
}
unset($product);
foreach ($total_products as $key => $price) {
if (Configuration::get('PS_ROUND_TYPE') == Order::ROUND_TOTAL) {
$tmp = explode('_', $key);
$address = Address::initialize((int)$tmp[1], true);
$tax_calculator = TaxManagerFactory::getManager($address, $tmp[0])->getTaxCalculator();
$order_slip->{'total_products_tax_'.$inc_or_ex_2} += Tools::ps_round($tax_calculator->{$add_or_remove.'Taxes'}($price), _PS_PRICE_COMPUTE_PRECISION_);
$order_slip->{'total_products_tax_'.$inc_or_ex_2} += Tools::processPriceRounding(
($tax_calculator->{$add_or_remove.'Taxes'}($price)),
1,
$order->round_type,
$order->round_mode
);
} else {
$order_slip->{'total_products_tax_'.$inc_or_ex_2} += $price;
}

View File

@@ -841,6 +841,7 @@ class AdminCartsControllerCore extends AdminController
$cart['total_price'] = Tools::displayPrice($cart_obj->getOrderTotal(), $currency);
}
}
if (count($orders)) {
foreach ($orders as &$order) {
$order['total_paid_real'] = Tools::displayPrice($order['total_paid_real'], $currency);

View File

@@ -165,7 +165,10 @@ class AdminCustomerThreadsControllerCore extends AdminController
'lang' => true
)
),
'submit' => array('title' => $this->l('Save'))
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitOptionsCustomerService'
)
),
'general' => array(
'title' => $this->l('Customer service options'),
@@ -232,7 +235,10 @@ class AdminCustomerThreadsControllerCore extends AdminController
'hint' => $this->l('Do not use start-TLS to encrypt the session, even with servers that support it.'),
),
),
'submit' => array('title' => $this->l('Save')),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitOptionsIMAPConfig'
),
),
);
@@ -312,6 +318,22 @@ class AdminCustomerThreadsControllerCore extends AdminController
public function postProcess()
{
if ($this->tabAccess['edit'] === '1') {
// using this to separate the saving process for the both option fields
$fields = $this->fields_options;
if (Tools::isSubmit('submitOptionsCustomerService')) {
unset($this->fields_options['general']);
$this->processUpdateOptions();
} else if (Tools::isSubmit('submitOptionsIMAPConfig')) {
unset($this->fields_options['contact']);
$this->processUpdateOptions();
}
$this->fields_options = $fields;
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread')) {
if (($id_contact = (int)Tools::getValue('id_contact'))) {
Db::getInstance()->execute('

File diff suppressed because it is too large Load Diff

View File

@@ -502,6 +502,9 @@ class AdminProductsControllerCore extends AdminController
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js');
$this->addJs(__PS_BASE_URI__.'js/vendor/spin.js');
$this->addJs(__PS_BASE_URI__.'js/vendor/ladda.js');
$this->addCSS(_PS_JS_DIR_.'fullcalendar/main.css');
$this->addJs(_PS_JS_DIR_.'fullcalendar/main.js');
$this->addJS(_PS_JS_DIR_.'/datatable/jquery.dataTables.min.js');
$this->addJS(_PS_JS_DIR_.'/datatable/dataTables.bootstrap.js');
}
@@ -2964,8 +2967,8 @@ class AdminProductsControllerCore extends AdminController
$room['booked_dates'] = json_encode($bookedDates);
if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disabledDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disabledDates);
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disableDates);
}
}
$data->assign('htl_room_info', $hotelRoomInfo);
@@ -2977,6 +2980,7 @@ class AdminProductsControllerCore extends AdminController
'product' => $obj,
'htl_info' => $hotelInfo,
'rm_status' => $roomStatus,
'locale' => $this->context->language->iso_code
)
);
} else {
@@ -3461,50 +3465,6 @@ class AdminProductsControllerCore extends AdminController
}
}
public function validateDisableDateRanges($disableDates, $roomIndex, $idRoom)
{
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $disable_key => $disableDate) {
if (!$disableDate['date_to'] && !$disableDate['date_from']) {
unset($disableDates[$disable_key]);
} elseif (!Validate::isDate($disableDate['date_from']) || !Validate::isDate($disableDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('Please add valid disable dates for room %s.'),
$roomIndex
);
} elseif (($disableDate['date_from'] && !$disableDate['date_to']) || (!$disableDate['date_from'] && $disableDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('Please fill date from and date to for disable dates for room %s.'),
$roomIndex
);
} else {
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($disableDates as $key => $disDate) {
if ($key != $disable_key) {
if ((($disableDate['date_from'] < $disDate['date_from']) && ($disableDate['date_to'] <= $disDate['date_from'])) || (($disableDate['date_from'] > $disDate['date_from']) && ($disableDate['date_from'] >= $disDate['date_to']))) {
// continue
} else {
$this->errors[] = sprintf(
Tools::displayError('Disable dates are conflicting for room %s. Please add non-conflicting dates.'),
$roomIndex
);
}
}
// check if room has booking for current date range
if ($objHotelBookingDetail->chechRoomBooked($idRoom, $disDate['date_from'], $disDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('The room %s already has bookings for selected disable dates. Please reselect disable dates.'),
$roomIndex
);
}
}
}
}
} else {
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
public function processConfiguration()
{
// Check if save of configuration tab is submitted
@@ -3536,31 +3496,12 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomInfo->id_status = $roomInfo['id_status'];
$objHotelRoomInfo->floor = $roomInfo['floor'];
$objHotelRoomInfo->comment = $roomInfo['comment'];
if ($objHotelRoomInfo->save()) {
$idRoom = $objHotelRoomInfo->id;
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->deleteRoomDisableDates($idRoom);
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
foreach ($disableDates as $disableDate) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $id_product;
$objHotelRoomDisableDates->id_room = $idRoom;
$objHotelRoomDisableDates->date_from = $disableDate['date_from'];
$objHotelRoomDisableDates->date_to = $disableDate['date_to'];
$objHotelRoomDisableDates->reason = $disableDate['reason'];
$objHotelRoomDisableDates->add();
}
Hook::exec(
'actionRoomDisableDatesAddAfter',
array(
'room_info' => $roomInfo,
'disable_dates' => $disableDates
)
);
}
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);
}
}
}
@@ -3597,7 +3538,6 @@ class AdminProductsControllerCore extends AdminController
if ($roomInfo['floor'] && !Validate::isGenericName($roomInfo['floor'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid floor for room %s.'), $roomIndex);
}
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_INACTIVE) {
$objHotelRoomInformation = new HotelRoomInformation();
if (count($objHotelRoomInformation->getFutureBookings($roomInfo['id']))) {
@@ -3605,10 +3545,13 @@ class AdminProductsControllerCore extends AdminController
}
} elseif ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
if ($roomInfo['disable_dates_json'] !== 0) {
$this->validateDisableDateRanges($disableDates, $roomInfo['room_num'], $roomInfo['id']);
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));
}
} else {
$this->errors[] = Tools::displayError('Please add at least one room.');
@@ -5024,76 +4967,196 @@ class AdminProductsControllerCore extends AdminController
die(json_encode($response));
}
public function ajaxProcessValidateDisableDates()
public function assignAlerts()
{
$this->context->smarty->assign(array(
'errors' => $this->errors,
'confirmations' => $this->confirmations,
'warnings' => $this->warnings
));
}
public function ajaxProcessSubmitDisableDates()
{
$response = array('status' => false);
$idRoom = (int) Tools::getValue('id_room');
$disableDates = Tools::getValue('disable_dates');
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
$idProduct = Tools::getValue('id_product');
if (!Validate::isDate($dateFrom) || !Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Please select a valid date range to temporary disable this room');
} else if ($idRoom && Validate::isLoadedObject($objHotelRoomInfo = new HotelRoomInformation((int) $idRoom))) {
$dateTo = date('Y-m-d', strtotime($dateTo));
$objHotelBookingDetail = new HotelBookingDetail();
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateFrom, $dateTo)) {
$orderDetails = new HotelBookingDetail($bookingRow['id']);
$this->context->smarty->assign(array(
'link' => $this->context->link,
'orderDetails' => $orderDetails,
));
$rowsToHighlight = array();
$bookedRows = array();
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
$this->errors[] = $this->l('Some dates are missing. Please select all the date ranges.');
$rowsToHighlight[] = $key;
$this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl');
} else {
if (!Tools::getValue('id_disable_date')
|| !Validate::isLoadedObject($objHotelRoomDisableDates = new HotelRoomDisableDates((int) Tools::getValue('id_disable_date')))
) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $idProduct;
$objHotelRoomDisableDates->id_room = $idRoom;
}
}
if (!count($this->errors)) {
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']))
) {
$this->errors[] = $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.');
$rowsToHighlight[] = $keyOuter;
$rowsToHighlight[] = $keyInner;
}
}
}
}
}
if (!count($this->errors)) {
if ($idRoom) {
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($disableDates as $key => $dateRange) {
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) {
$bookedRows[] = new HotelBookingDetail($bookingRow['id']);
$rowsToHighlight[] = $key;
}
$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()
) {
$response['id_disable_date'] = $objHotelRoomDisableDates->id;
$response['event_title'] = $this->l('Disabled');
if (Tools::getValue('id_disable_date')) {
$this->confirmations[] = $this->l('Successfully updated.');
} else {
$this->confirmations[] = $this->l('Disable date added successfully.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while trying to save the disable dates.');
}
}
} else if (!$idRoom) {
$this->errors[] = Tools::displayError('You need to save this room first before adding any disabled dates.');
}
if (count($bookedRows)) {
$this->context->smarty->assign(array(
'link' => $this->context->link,
'booked_rows_list' => $bookedRows,
));
$this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl');
}
$this->errors = array_unique($this->errors);
$rowsToHighlight = array_values(array_unique($rowsToHighlight));
if (!count($this->errors)) {
$response['status'] = true;
} else {
$this->context->smarty->assign(array(
'errors' => $this->errors,
));
$response['errors'] = $this->context->smarty->fetch('alerts.tpl');
$response['rows_to_highlight'] = $rowsToHighlight;
if ($this->errors) {
$this->errors = array_unique($this->errors);
$response['status'] = false;
} else {
$response['status'] = true;
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessRemoveDisableDatesInDateRange()
{
$response = array('status' => false);
$idRoom = (int) Tools::getValue('id_room');
$dateFrom = date('Y-m-d', strtotime(Tools::getValue('date_from')));
$dateTo = date('Y-m-d', strtotime(Tools::getValue('date_to')));
if (!Tools::getValue('date_from') || !Tools::getValue('date_to')) {
$this->errors[] = Tools::displayError('Please select valid date range.');
} else {
$objRoomDisableDates = new HotelRoomDisableDates();
$params = array(
'date_from' => $dateFrom,
'date_to' => $dateTo,
'id_room' => $idRoom
);
Hook::exec('actionRoomDisableDatesRemoveBefore', array('disable_dates', $params));
if (empty($this->errors)
&& ($disableDates = $objRoomDisableDates->checkIfRoomAlreadyDisabled($params))
) {
$newDates = array();
foreach ($disableDates as $disableDatesInfo) {
$objRoomDisableDates = new HotelRoomDisableDates($disableDatesInfo['id']);
$newDates[0]['date_from'] = $disableDatesInfo['date_from'];
$newDates[0]['date_to'] = $params['date_from'];
$newDates[1]['date_from'] = $params['date_to'];
$newDates[1]['date_to'] = date('Y-m-d', strtotime($disableDatesInfo['date_to']));
if (strtotime($newDates[0]['date_from']) >= strtotime($newDates[0]['date_to'])) {
unset($newDates[0]);
}
if (strtotime($newDates[1]['date_from']) >= strtotime($newDates[1]['date_to'])) {
unset($newDates[1]);
}
foreach ($newDates as $newDate) {
$objNewDisableDates = new HotelRoomDisableDates();
$objNewDisableDates->id_room_type = $objRoomDisableDates->id_room_type;
$objNewDisableDates->id_room = $objRoomDisableDates->id_room;
$objNewDisableDates->date_from = $newDate['date_from'];
$objNewDisableDates->date_to = $newDate['date_to'];
$objNewDisableDates->reason = $objRoomDisableDates->reason;
$objNewDisableDates->save();
}
$objRoomDisableDates->delete();
}
} else if (!$disableDates) {
$this->errors[] = Tools::displayError('Room is not disabled for the selected date range.');
}
}
if (count($this->errors)) {
$response['status'] = false;
} 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();
}
$response['disable_dates'] = $disableDates;
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessGetDisableDates()
{
$response['status'] = false;
if (($idRoom = Tools::getValue('id_room'))
&& Validate::isLoadedObject(new HotelRoomInformation($idRoom))
) {
$objRoomDisableDates = new HotelRoomDisableDates();
$disableDates = $objRoomDisableDates->getRoomDisableDates($idRoom);
$response['status'] = true;
$response['disable_dates'] = $disableDates;
}
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessDeleteDisableDate()
{
$response = array('status' => false);
$idDisableDate = Tools::getValue('id_disable_date');
Hook::exec('actionDisableDateDeleteBefore', array('id_disable_date', $idDisableDate));
if (empty($this->errors)
&& (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');
}
if (count($this->errors)) {
$response['status'] = false;
} else {
$response['status'] = true;
$this->confirmations[] = $this->l('Removed successfully');
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}

View File

@@ -233,7 +233,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)
GROUP BY LEFT(`invoice_date`, 10)'
);
@@ -251,7 +251,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)
GROUP BY LEFT(`invoice_date`, 7)'
);
@@ -494,7 +494,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND os.logable = 1 AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)
GROUP BY LEFT(`invoice_date`, 10)');
@@ -517,7 +517,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND os.logable = 1 AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)'
);
}
@@ -538,7 +538,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND "'.pSQL($date_to).' 23:59:59" AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)
GROUP BY LEFT(`invoice_date`, 10)');
@@ -563,7 +563,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
AND EXISTS (
SELECT 1
FROM `qlo_htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($id_hotel).'
)'
);
}

View File

@@ -276,7 +276,7 @@
<value>id_shop;id_currency;id_country;id_group</value>
</configuration>
<configuration id="PS_TAX_DISPLAY" name="PS_TAX_DISPLAY">
<value>0</value>
<value>1</value>
</configuration>
<configuration id="PS_SMARTY_FORCE_COMPILE" name="PS_SMARTY_FORCE_COMPILE">
<value>0</value>
@@ -522,7 +522,7 @@
<value>1</value>
</configuration>
<configuration id="PS_TAX_ADDRESS_TYPE" name="PS_TAX_ADDRESS_TYPE">
<value>id_address_delivery</value>
<value>id_address_invoice</value>
</configuration>
<configuration id="PS_SHOP_DEFAULT" name="PS_SHOP_DEFAULT">
<value>1</value>
@@ -885,7 +885,7 @@
<value>1</value>
</configuration>
<configuration id="PS_ROUND_TYPE" name="PS_ROUND_TYPE">
<value>2</value>
<value>1</value>
</configuration>
<configuration id="PS_PRICE_DISPLAY_PRECISION" name="PS_PRICE_DISPLAY_PRECISION">
<value>2</value>

View File

@@ -49,6 +49,9 @@ $(document).ready(function() {
action: 'initCartRuleDeleteModal',
id_cart_rule: id_cart_rule
},
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.success && result.confirm_delete) {
$('#moduleConfirmDelete').remove();
@@ -61,6 +64,9 @@ $(document).ready(function() {
resolve(false);
});
}
},
complete: function() {
$("#page-loader").hide();
}
});
});

View File

@@ -1920,6 +1920,9 @@ const BookingDocumentsModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitBookingDocumentsModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -1935,6 +1938,7 @@ const BookingDocumentsModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
@@ -2105,6 +2109,9 @@ const VoucherModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitVoucherModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2115,6 +2122,7 @@ const VoucherModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2139,6 +2147,9 @@ const OrderPaymentModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderPaymentModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2149,6 +2160,7 @@ const OrderPaymentModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2173,6 +2185,9 @@ const OrderPaymentDetailModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderPaymentDetailModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2195,6 +2210,7 @@ const OrderPaymentDetailModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2216,6 +2232,9 @@ const DocumentNoteModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderDocumentNoteModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2228,6 +2247,7 @@ const DocumentNoteModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2252,6 +2272,9 @@ const TravellerModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitTravellerModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2262,6 +2285,7 @@ const TravellerModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2330,6 +2354,9 @@ const RoomStatusModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitRoomStatusModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2356,6 +2383,7 @@ const RoomStatusModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2380,6 +2408,9 @@ const AddRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=initAddRoomBookingModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2467,6 +2498,7 @@ const AddRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2538,6 +2570,9 @@ const EditRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: data,
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2564,6 +2599,7 @@ const EditRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2614,6 +2650,9 @@ const CancelRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=initCancelRoomBookingModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2626,6 +2665,7 @@ const CancelRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2651,6 +2691,9 @@ const RoomAllotmentCommentModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_hotel_booking='+idHtlBooking+'&action=initRoomAllotmentCommentModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2663,6 +2706,7 @@ const RoomAllotmentCommentModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<localizationPack name="Croatia">
<currencies>
<currency name="Croatian Kuna" iso_code="HRK" iso_code_num="191" sign="kn" blank="1" conversion_rate="1.000000" format="2" decimals="1"/>
<currency name="Euro" iso_code="EUR" iso_code_num="978" sign="€" blank="1" conversion_rate="1.00" format="2" decimals="1"/>
</currencies>
<languages>
<language iso_code="hr"/>
@@ -165,4 +165,27 @@
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>
<states>
<state name="Bjelovarsko-bilogorska županija" iso_code="HR-07" country="HR" zone="Europe"/>
<state name="Brodsko-posavska županija" iso_code="HR-12" country="HR" zone="Europe"/>
<state name="Dubrovačko-neretvanska županija" iso_code="HR-19" country="HR" zone="Europe"/>
<state name="Grad Zagreb" iso_code="HR-21" country="HR" zone="Europe"/>
<state name="Istarska županija" iso_code="HR-18" country="HR" zone="Europe"/>
<state name="Karlovačka županija" iso_code="HR-04" country="HR" zone="Europe"/>
<state name="Koprivničko-križevačka županija" iso_code="HR-06" country="HR" zone="Europe"/>
<state name="Krapinsko-zagorska županija" iso_code="HR-02" country="HR" zone="Europe"/>
<state name="Ličko-senjska županija" iso_code="HR-09" country="HR" zone="Europe"/>
<state name="Međimurska županija" iso_code="HR-20" country="HR" zone="Europe"/>
<state name="Osječko-baranjska županija" iso_code="HR-14" country="HR" zone="Europe"/>
<state name="Požeško-slavonska županija" iso_code="HR-11" country="HR" zone="Europe"/>
<state name="Primorsko-goranska županija" iso_code="HR-08" country="HR" zone="Europe"/>
<state name="Sisačko-moslavačka županija" iso_code="HR-03" country="HR" zone="Europe"/>
<state name="Splitsko-dalmatinska županija" iso_code="HR-17" country="HR" zone="Europe"/>
<state name="Šibensko-kninska županija" iso_code="HR-15" country="HR" zone="Europe"/>
<state name="Varaždinska županija" iso_code="HR-05" country="HR" zone="Europe"/>
<state name="Virovitičko-podravska županija" iso_code="HR-10" country="HR" zone="Europe"/>
<state name="Vukovarsko-srijemska županija" iso_code="HR-16" country="HR" zone="Europe"/>
<state name="Zadarska županija" iso_code="HR-13" country="HR" zone="Europe"/>
<state name="Zagrebačka županija" iso_code="HR-01" country="HR" zone="Europe"/>
</states>
</localizationPack>

View File

@@ -356,7 +356,16 @@
</div> -->
{if isset($total_convenience_fee)}
<div class="layer_cart_row">
<strong class="dark">{l s='Convenience Fees' mod='blockcart'}</strong>
<strong class="dark">
{l s='Convenience Fees' mod='blockcart'}
{if $display_tax_label}
{if $priceDisplay == 1}
{l s='(tax excl.)' mod='blockcart'}
{else}
{l s='(tax incl.)' mod='blockcart'}
{/if}
{/if}
</strong>
<span class="price ajax_cart_convenience_fee pull-right">{convertPrice price=$total_convenience_fee}</span>
</div>
{/if}

View File

@@ -119,9 +119,9 @@ class HotelBookingDemands extends ObjectModel
if ($getTotalPrice) {
foreach ($roomTypeDemands as $demand) {
if ($useTax) {
$totalDemandsPrice += $demand['total_price_tax_incl'];
$totalDemandsPrice += Tools::processPriceRounding($demand['total_price_tax_incl']);
} else {
$totalDemandsPrice += $demand['total_price_tax_excl'];
$totalDemandsPrice += Tools::processPriceRounding($demand['total_price_tax_excl']);
}
}
} else {
@@ -202,24 +202,11 @@ class HotelBookingDemands extends ObjectModel
$objBkDetail = new HotelBookingDetail($this->id_htl_booking);
$quantity = $objBkDetail->getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
}
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_ITEM:
$unitAmount = (float)Tools::ps_round($amount, _PS_PRICE_COMPUTE_PRECISION_);
$totalAmount = $unitAmount * $quantity;
break;
case Order::ROUND_LINE:
$unitAmount = $amount;
$totalAmount = Tools::ps_round(
$unitAmount * $quantity,
_PS_PRICE_COMPUTE_PRECISION_
);
break;
case Order::ROUND_TOTAL:
$unitAmount = $amount;
$totalAmount = $unitAmount * $quantity;
break;
}
$values .= '('.(int)$this->id.','.(int)$idTax.','.(float)$unitAmount.','.
// Rounding as per configurations
$totalAmount += Tools::processPriceRounding($amount, $quantity);
$values .= '('.(int)$this->id.','.(int)$idTax.','.(float)$amount.','.
(float)$totalAmount.'),';
}
@@ -274,29 +261,15 @@ class HotelBookingDemands extends ObjectModel
if ($taxDetails) {
foreach ($taxDetails as &$detail) {
$priceTaxExcl = $detail['unit_price_tax_excl'];
$quantity = 1;
$numDays = 1;
$objBkDemand = new HotelBookingDemands($detail['id_booking_demand']);
if ($objBkDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$objBkDetail = new HotelBookingDetail($detail['id_htl_booking']);
$quantity = $objBkDetail->getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
}
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_ITEM:
$unitAmount = (float)Tools::ps_round($priceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
$totalTaxBase = $unitAmount * $quantity;
break;
case Order::ROUND_LINE:
$unitAmount = $priceTaxExcl;
$totalTaxBase = Tools::ps_round(
$unitAmount * $quantity,
_PS_PRICE_COMPUTE_PRECISION_
);
break;
case Order::ROUND_TOTAL:
$unitAmount = $priceTaxExcl;
$totalTaxBase = $unitAmount * $quantity;
break;
$numDays = $objBkDetail->getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
}
$totalTaxBase = $unitAmount * $numDays;
$detail['total_tax_base'] = $totalTaxBase;
}
}

View File

@@ -225,9 +225,6 @@ class HotelBookingDetail extends ObjectModel
$params['occupancy'] = array();
}
if (!isset($params['ratting'])) {
$params['ratting'] = -1;
}
if (!isset($params['amenities'])) {
$params['amenities'] = 0;
}
@@ -239,6 +236,10 @@ class HotelBookingDetail extends ObjectModel
$params['only_search_data'] = 0;
}
if (!isset($params['full_detail'])) {
$params['full_detail'] = 0;
}
Hook::exec('actionBookingDataParamsModifier', array('params' => &$params));
return $params;
@@ -399,7 +400,7 @@ class HotelBookingDetail extends ObjectModel
}
// Now we will formate the data after geting search result according to search type
$roomTypesDetail = $objRoomType->getRoomTypeDetailByRoomTypeIds($allowedIdRoomTypes);
$roomTypesDetail = $objRoomType->getRoomTypeDetailByRoomTypeIds($allowedIdRoomTypes, true, $full_detail);
if ($roomTypesDetail) {
// Formate data for response
$finalSearchResponse = array(
@@ -414,15 +415,12 @@ class HotelBookingDetail extends ObjectModel
$finalSearchResponse['stats']['total_rooms'] += $roomTypeDetail['numberOfRooms'];
$idProduct = $roomTypeDetail['id_product'];
$roomTypeSearchData = array(
'name' => (new Product((int) $idProduct, false, $this->context->cookie->id_lang))->name,
'id_product' => $idProduct,
'adults' => $roomTypeDetail['adults'],
'children' => $roomTypeDetail['children'],
'max_adults' => $roomTypeDetail['max_adults'],
'max_children' => $roomTypeDetail['max_children'],
'max_guests' => $roomTypeDetail['max_guests'],
'data' => array(),
$roomTypeSearchData = array_merge(
$roomTypeDetail,
array(
'id_product' => $idProduct,
'data' => array(),
)
);
if ($search_unavai) {
@@ -1195,6 +1193,7 @@ class HotelBookingDetail extends ObjectModel
}
}
unset($datetimeObj);
unset($roomDetail);
// If all dates are covered
if (!$datesToCover) {
@@ -1634,7 +1633,6 @@ class HotelBookingDetail extends ObjectModel
* @param [int] $only_search_data [used for product page and category page for block cart]
* @param [int] $adults []
* @param [int] $children []
* @param [] $ratting [description]
* @param [] $amenities [description]
* @param [] $price [description]
* @param [int] $id_cart [Id of the cart]
@@ -1645,10 +1643,6 @@ class HotelBookingDetail extends ObjectModel
*/
public function dataForFrontSearch($bookingParams)
{
// if (Module::isInstalled('productcomments')) {
// require_once _PS_MODULE_DIR_.'productcomments/ProductComment.php';
// }
$this->context = Context::getContext();
if (!isset($bookingParams['search_available'])) {
@@ -1664,6 +1658,7 @@ class HotelBookingDetail extends ObjectModel
$bookingParams['search_unavai'] = 0;
}
$bookingParams['full_detail'] = 1;
$bookingData = $this->getBookingData($bookingParams);
extract($this->getBookingDataParams($bookingParams));
@@ -1673,104 +1668,62 @@ class HotelBookingDetail extends ObjectModel
$objRoomType = new HotelRoomType();
foreach ($bookingData['rm_data'] as $key => $value) {
if (empty($value['data']['available'])) {
$product_feature = Product::getFrontFeaturesStatic($this->context->language->id, $value['id_product']);
$prod_amen = array();
if (!empty($amenities) && $amenities) {
$prod_amen = $amenities;
foreach ($product_feature as $a_key => $a_val) {
if (($pa_key = array_search($a_val['id_feature'], $prod_amen)) !== false) {
unset($prod_amen[$pa_key]);
if (empty($prod_amen)) {
break;
}
}
}
if (!empty($prod_amen)) {
unset($bookingData['rm_data'][$key]);
continue;
}
}
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax());
if (!empty($price) && ($price['from'] > $productFeaturePrice || $price['to'] < $productFeaturePrice)) {
unset($bookingData['rm_data'][$key]);
} else {
$prod_ratting = 0;
// if (Module::isInstalled('productcomments')) {
// $prod_ratting = ProductComment::getAverageGrade($value['id_product'])['grade'];
// }
// if (empty($prod_ratting)) {
// $prod_ratting = 0;
// }
continue;
}
if (count($value['data']['available'])) {
$prod_price = Product::getPriceStatic($value['id_product'], self::useTax());
$productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0);
$cover_image_arr = Product::getCover($value['id_product']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($value['link_rewrite'], $value['id_product'].'-'.$cover_image_arr['id_image'], 'home_default');
} else {
$cover_img = $this->context->link->getImageLink($value['link_rewrite'], $this->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]['price'] = $prod_price;
$bookingData['rm_data'][$key]['feature_price'] = $productFeaturePrice;
$bookingData['rm_data'][$key]['price_without_reduction'] = $productPriceWithoutReduction;
$bookingData['rm_data'][$key]['feature_price_diff'] = $productPriceWithoutReduction - $productFeaturePrice;
$bookingData['rm_data'][$key]['room_left'] = count($bookingData['rm_data'][$key]['data']['available']);
// if ($prod_ratting < $ratting && $ratting != -1) {
// unset($bookingData['rm_data'][$key]);
// } else
// {
$product = new Product($value['id_product'], false, $this->context->language->id);
$product_feature = $product->getFrontFeaturesStatic($this->context->language->id, $value['id_product']);
$prod_amen = array();
if (!empty($amenities) && $amenities) {
$prod_amen = $amenities;
foreach ($product_feature as $a_key => $a_val) {
if (($pa_key = array_search($a_val['id_feature'], $prod_amen)) !== false) {
unset($prod_amen[$pa_key]);
if (empty($prod_amen)) {
break;
}
}
}
if (!empty($prod_amen)) {
unset($bookingData['rm_data'][$key]);
}
// create URL with the parameters from URL
$urlData = array ('date_from' => $date_from, 'date_to' => $date_to);
if (!isset($occupancy)) {
$occupancy = Tools::getValue('occupancy');
}
if ($occupancy) {
$urlData['occupancy'] = $occupancy;
}
if ($location = Tools::getValue('location')) {
$urlData['location'] = $location;
}
if (empty($prod_amen)) {
$prod_price = Product::getPriceStatic($value['id_product'], self::useTax());
$productPriceWithoutReduction = $product->getPriceWithoutReduct(!self::useTax());
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax());
$productFeaturePriceWithoutAutoAdd = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 0);
if (empty($price) || ($price['from'] <= $prod_price && $price['to'] >= $prod_price)) {
$cover_image_arr = $product->getCover($value['id_product']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'home_default');
} else {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'home_default');
}
$room_left = count($bookingData['rm_data'][$key]['data']['available']);
$rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($value['id_product']);
$bookingData['rm_data'][$key]['name'] = $product->name;
$bookingData['rm_data'][$key]['image'] = $cover_img;
$bookingData['rm_data'][$key]['description'] = $product->description_short;
$bookingData['rm_data'][$key]['feature'] = $product_feature;
$bookingData['rm_data'][$key]['price'] = $prod_price;
$bookingData['rm_data'][$key]['feature_price'] = $productFeaturePrice;
$bookingData['rm_data'][$key]['feature_price_withoout_auto_add'] = $productFeaturePriceWithoutAutoAdd;
$bookingData['rm_data'][$key]['price_without_reduction'] = $productPriceWithoutReduction;
$bookingData['rm_data'][$key]['price_without_reduction_with_auto_add'] = $productPriceWithoutReduction + ($productFeaturePrice - $productFeaturePriceWithoutAutoAdd);
$bookingData['rm_data'][$key]['feature_price_diff'] = $bookingData['rm_data'][$key]['price_without_reduction_with_auto_add'] - $productFeaturePrice;
// if ($room_left <= (int)Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'))
$bookingData['rm_data'][$key]['room_left'] = $room_left;
$bookingData['rm_data'][$key]['adults'] = $rm_dtl['adults'];
$bookingData['rm_data'][$key]['children'] = $rm_dtl['children'];
$bookingData['rm_data'][$key]['ratting'] = $prod_ratting;
// if (Module::isInstalled('productcomments')) {
// $bookingData['rm_data'][$key]['num_review'] = ProductComment::getCommentNumber($value['id_product']);
// }
// create URL with the parameters from URL
$urlData = array ('date_from' => $date_from, 'date_to' => $date_to);
if (!isset($occupancy)) {
$occupancy = Tools::getValue('occupancy');
}
if ($occupancy) {
$urlData['occupancy'] = $occupancy;
}
if ($location = Tools::getValue('location')) {
$urlData['location'] = $location;
}
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$bookingData['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product).'?'.http_build_query($urlData);
} else {
$bookingData['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product).'&'.http_build_query($urlData);
}
} else {
unset($bookingData['rm_data'][$key]);
}
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$bookingData['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($value['id_product']).'?'.http_build_query($urlData);
} else {
$bookingData['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($value['id_product']).'&'.http_build_query($urlData);
}
// }
}
}
}
@@ -1902,6 +1855,7 @@ class HotelBookingDetail extends ObjectModel
public function reallocateBooking($idHotelBooking, $idRoom, $priceDiffTaxExcl = 0)
{
$result = true;
$reallocatedBookingId = 0;
// get the cart booking data for the given booking
if (Validate::isLoadedObject($objOldHotelBooking = new HotelBookingDetail($idHotelBooking))) {
$objHotelRoomInfo = new HotelRoomInformation($idRoom);
@@ -1912,7 +1866,10 @@ class HotelBookingDetail extends ObjectModel
$productQty = (int)$objOldHotelBooking->getNumberOfDays($objOldHotelBooking->date_from, $objOldHotelBooking->date_to);
$oldRoomPriceTaxExcl = $objOldHotelBooking->total_price_tax_excl / $productQty;
$newRoomPriceTaxExcl = $oldRoomPriceTaxExcl + $priceDiffTaxExcl;
// Calculate new room price per qty
$priceDiffPerQtyTaxExcl = $priceDiffTaxExcl / $productQty;
$newRoomPriceTaxExcl = $oldRoomPriceTaxExcl + $priceDiffPerQtyTaxExcl;
$totalRoomPriceTaxIncl = $objOldHotelBooking->total_price_tax_incl;
$totalRoomPriceTaxExcl = $objOldHotelBooking->total_price_tax_excl;
@@ -1936,6 +1893,7 @@ class HotelBookingDetail extends ObjectModel
$cart->add();
// Save context (in order to apply cart rule)
$this->context = Context::getContext();
$this->context->cart = $cart;
$this->context->customer = new Customer($objOrder->id_customer);
$this->context->currency = new Currency($objOrder->id_currency);
@@ -1947,7 +1905,7 @@ class HotelBookingDetail extends ObjectModel
$idNewRoomType,
$useTaxes,
null,
2,
6,
null,
false,
true,
@@ -1991,7 +1949,8 @@ class HotelBookingDetail extends ObjectModel
$objCartBookingData->id_product = $roomInfo['id_product'];
$objCartBookingData->id_room = $roomInfo['id_room'];
$objCartBookingData->id_hotel = $roomInfo['id_hotel'];
$objCartBookingData->booking_type = 1;
$objCartBookingData->booking_type = $objOldHotelBooking->booking_type;
$objCartBookingData->comment = $objOldHotelBooking->comment;
$objCartBookingData->quantity = $productQty;
$objCartBookingData->date_from = $objOldHotelBooking->date_from;
$objCartBookingData->date_to = $objOldHotelBooking->date_to;
@@ -2016,18 +1975,6 @@ class HotelBookingDetail extends ObjectModel
return false;
}
$totalRoomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idNewRoomType,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
0,
Group::getCurrent()->id,
$this->context->cart->id,
$this->context->cookie->id_guest,
$objCartBookingData->id_room,
0
);
// Add product to cart
$updateQuantity = $cart->updateQty(
$productQty,
@@ -2046,7 +1993,7 @@ class HotelBookingDetail extends ObjectModel
$objOrderInvoice->total_paid_tax_incl += (float)($cart->getOrderTotal($useTaxes, $totalMethod));
$objOrderInvoice->total_products += (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);
$objOrderInvoice->total_products_wt += (float)$cart->getOrderTotal($useTaxes, Cart::ONLY_PRODUCTS);
$objOrderInvoice->update();
$result &= $objOrderInvoice->update();
}
// Create Order detail information
@@ -2062,7 +2009,7 @@ class HotelBookingDetail extends ObjectModel
$objOrder->total_paid_tax_incl += (float)($cart->getOrderTotal($useTaxes, $totalMethod));
// Save changes of order
$objOrder->update();
$result &= $objOrder->update();
// Update Tax lines
$objOrderDetail->updateTaxAmount($objOrder);
@@ -2090,10 +2037,9 @@ class HotelBookingDetail extends ObjectModel
$objBookingDetail->id_hotel = $objCartBookingData->id_hotel;
$objBookingDetail->id_customer = $objOrder->id_customer;
$objBookingDetail->booking_type = $objCartBookingData->booking_type;
$objBookingDetail->id_status = 1;
$objBookingDetail->comment = $objCartBookingData->comment;
$objBookingDetail->id_status = 1;
$objBookingDetail->room_type_name = Product::getProductName($idNewRoomType, null, $objOrder->id_lang);
$objBookingDetail->date_from = $objCartBookingData->date_from;
$objBookingDetail->date_to = $objCartBookingData->date_to;
$objBookingDetail->adults = $objCartBookingData->adults;
@@ -2135,7 +2081,8 @@ class HotelBookingDetail extends ObjectModel
$objBookingDetail->check_out_time = $objHotelBranch->check_out;
}
if ($objBookingDetail->save()) {
if ($result &= $objBookingDetail->save()) {
$reallocatedBookingId = $objBookingDetail->id;
// Get Booking Demands of the old booking to add in the new booking creation
$objBookingDemand = new HotelBookingDemands();
if ($oldBookingDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
@@ -2167,10 +2114,12 @@ class HotelBookingDetail extends ObjectModel
}
}
}
} else {
return false;
}
// delete cart feature prices after room addition success
HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id);
// HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id);
// ===============================================================
// END: Add Process of the old booking
@@ -2184,58 +2133,94 @@ class HotelBookingDetail extends ObjectModel
$deleteQty = true;
} else {
// Calculate differences of price (Before / After)
$objOldOrderDetail->total_price_tax_incl -= $totalRoomPriceTaxIncl;
$objOldOrderDetail->total_price_tax_excl -= $totalRoomPriceTaxExcl;
$objOldOrderDetail->total_price_tax_incl -= Tools::processPriceRounding(
($objOldOrderDetail->total_price_tax_incl - $totalRoomPriceTaxIncl),
1,
$objOrder->round_type,
$objOrder->round_mode
);
$objOldOrderDetail->total_price_tax_excl -= Tools::processPriceRounding(
($objOldOrderDetail->total_price_tax_excl - $totalRoomPriceTaxExcl),
1,
$objOrder->round_type,
$objOrder->round_mode
);
$old_quantity = $objOldOrderDetail->product_quantity;
$objOldOrderDetail->product_quantity = $old_quantity - $product_quantity;
$objOldOrderDetail->product_quantity = $old_quantity - $productQty;
$objOldOrderDetail->reduction_percent = 0;
// update taxes
$res &= $objOldOrderDetail->updateTaxAmount($objOrder);
$result &= $objOldOrderDetail->updateTaxAmount($objOrder);
// Save order detail
$res &= $objOldOrderDetail->update();
$result &= $objOldOrderDetail->update();
}
// Update OrderInvoice of this OrderDetail
if ($objOldOrderDetail->id_order_invoice != 0) {
// values changes as values are calculated accoding to the quantity of the product by webkul
$objOrderInvoice = new OrderInvoice($objOldOrderDetail->id_order_invoice);
$objOrderInvoice->total_paid_tax_excl -= $totalRoomPriceTaxExcl;
$objOrderInvoice->total_paid_tax_excl = Tools::ps_round(
($objOrderInvoice->total_paid_tax_excl - $totalRoomPriceTaxExcl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrderInvoice->total_paid_tax_excl = $objOrderInvoice->total_paid_tax_excl > 0 ? $objOrderInvoice->total_paid_tax_excl : 0;
$objOrderInvoice->total_paid_tax_incl -= $totalRoomPriceTaxIncl;
$objOrderInvoice->total_paid_tax_incl = Tools::ps_round(
($objOrderInvoice->total_paid_tax_incl - $totalRoomPriceTaxIncl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrderInvoice->total_paid_tax_incl = $objOrderInvoice->total_paid_tax_incl > 0 ? $objOrderInvoice->total_paid_tax_incl : 0;
$objOrderInvoice->total_products -= $totalRoomPriceTaxExcl;
$objOrderInvoice->total_products = Tools::ps_round(
($objOrderInvoice->total_products - $totalRoomPriceTaxExcl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrderInvoice->total_products = $objOrderInvoice->total_products > 0 ? $objOrderInvoice->total_products : 0;
$objOrderInvoice->total_products_wt -= $totalRoomPriceTaxIncl;
$objOrderInvoice->total_products_wt = Tools::ps_round(
($objOrderInvoice->total_products_wt - $totalRoomPriceTaxIncl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrderInvoice->total_products_wt = $objOrderInvoice->total_products_wt > 0 ? $objOrderInvoice->total_products_wt : 0;
$res &= $objOrderInvoice->update();
$result &= $objOrderInvoice->update();
}
// values changes as values are calculated accoding to the quantity of the product by webkul
$objOrder->total_paid -= $totalRoomPriceTaxIncl;
$objOrder->total_paid = Tools::ps_round(
($objOrder->total_paid_tax_incl - $totalRoomPriceTaxIncl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid = $objOrder->total_paid > 0 ? $objOrder->total_paid : 0;
$objOrder->total_paid_tax_incl -= $totalRoomPriceTaxIncl;
$objOrder->total_paid_tax_incl = Tools::ps_round(
($objOrder->total_paid_tax_incl - $totalRoomPriceTaxIncl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid_tax_incl = $objOrder->total_paid_tax_incl > 0 ? $objOrder->total_paid_tax_incl : 0;
$objOrder->total_paid_tax_excl -= $totalRoomPriceTaxExcl;
$objOrder->total_paid_tax_excl = Tools::ps_round(
($objOrder->total_paid_tax_excl - $totalRoomPriceTaxExcl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid_tax_excl = $objOrder->total_paid_tax_excl > 0 ? $objOrder->total_paid_tax_excl : 0;
$objOrder->total_products -= $totalRoomPriceTaxExcl;
$objOrder->total_products = Tools::ps_round(
($objOrder->total_products - $totalRoomPriceTaxExcl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_products = $objOrder->total_products > 0 ? $objOrder->total_products : 0;
$objOrder->total_products_wt -= $totalRoomPriceTaxIncl;
$objOrder->total_products_wt = Tools::ps_round(
($objOrder->total_products_wt - $totalRoomPriceTaxIncl),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_products_wt = $objOrder->total_products_wt > 0 ? $objOrder->total_products_wt : 0;
$objOrder->update();
$result &= $objOrder->update();
// Reinject quantity in stock
$objOldOrderDetail->reinjectQuantity($objOldOrderDetail, $objOldOrderDetail->product_quantity, $deleteQty);
@@ -2276,16 +2261,22 @@ class HotelBookingDetail extends ObjectModel
$objOldHotelBooking->is_back_order = 0;
$result &= $objOldHotelBooking->save();
$reallocatedBookingId = $objOldHotelBooking->id;
}
if ($result) {
if ($result && $reallocatedBookingId) {
Hook::exec(
'actionRoomReallocateAfter',
array(
'id_htl_booking' => $idHotelBooking,
'id_room' => $idRoom
'id_htl_booking_from' => $idHotelBooking,
'id_htl_booking_to' => $reallocatedBookingId,
)
);
return $reallocatedBookingId;
} else {
$result = false;
}
} else {
$result = false;
@@ -2519,7 +2510,7 @@ class HotelBookingDetail extends ObjectModel
$newDateFrom,
$newDateTo,
$occupancy,
$newTotalPrice = null,
$newTotalPrice,
$idHotelBookingDetail
) {
$objHotelBookingDetail = new self((int) $idHotelBookingDetail);
@@ -2535,19 +2526,7 @@ class HotelBookingDetail extends ObjectModel
$objHotelCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
if (Validate::isLoadedObject($objHotelCartBookingData)) {
// calculate new prices
$newTotalPriceTE = '';
$newTotalPriceTI = '';
$newNumDays = $this->getNumberOfDays($newDateFrom, $newDateTo);
if ($newTotalPrice) {
$newTotalPriceTE = $newTotalPrice['tax_excl'];
$newTotalPriceTI = $newTotalPrice['tax_incl'];
} else {
$oldNumDays = $this->getNumberOfDays($oldDateFrom, $oldDateTo);
$unitRoomPriceTE = $objHotelBookingDetail->total_price_tax_excl / $oldNumDays;
$unitRoomPriceTI = $objHotelBookingDetail->total_price_tax_incl / $oldNumDays;
$newTotalPriceTE = $unitRoomPriceTE * $newNumDays;
$newTotalPriceTI = $unitRoomPriceTI * $newNumDays;
}
// update $objHotelCartBookingData
$objHotelCartBookingData->date_from = $newDateFrom;
@@ -2560,8 +2539,8 @@ class HotelBookingDetail extends ObjectModel
// update $objHotelBookingDetail
$objHotelBookingDetail->date_from = $newDateFrom;
$objHotelBookingDetail->date_to = $newDateTo;
$objHotelBookingDetail->total_price_tax_excl = Tools::ps_round($newTotalPriceTE, 6);
$objHotelBookingDetail->total_price_tax_incl = Tools::ps_round($newTotalPriceTI, 6);
$objHotelBookingDetail->total_price_tax_excl = $newTotalPrice['tax_excl'];
$objHotelBookingDetail->total_price_tax_incl = $newTotalPrice['tax_incl'];
$objHotelBookingDetail->adults = $occupancy['adults'];
$objHotelBookingDetail->children = $occupancy['children'];
$objHotelBookingDetail->child_ages = json_encode($occupancy['child_ages']);
@@ -3324,10 +3303,10 @@ class HotelBookingDetail extends ObjectModel
$objHotelBookingDemands = new HotelBookingDemands();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$reduction_amount['total_price_tax_excl'] = Tools::ps_round((float) $this->total_price_tax_excl, 6);
$reduction_amount['total_products_tax_excl'] = Tools::ps_round((float) $this->total_price_tax_excl, 6);
$reduction_amount['total_price_tax_incl'] = Tools::ps_round((float) $this->total_price_tax_incl, 6);
$reduction_amount['total_products_tax_incl'] = Tools::ps_round((float) $this->total_price_tax_incl, 6);
$reduction_amount['total_price_tax_excl'] = (float) $this->total_price_tax_excl;
$reduction_amount['total_products_tax_excl'] = (float) $this->total_price_tax_excl;
$reduction_amount['total_price_tax_incl'] = (float) $this->total_price_tax_incl;
$reduction_amount['total_products_tax_incl'] = (float) $this->total_price_tax_incl;
// reduce facilities amount from order and services_detail
if ($roomDemands = $objHotelBookingDemands->getRoomTypeBookingExtraDemands(
@@ -3343,8 +3322,8 @@ class HotelBookingDetail extends ObjectModel
)) {
foreach ($roomDemands as $roomDemand) {
$objHotelBookingDemands = new HotelBookingDemands($roomDemand['id_booking_demand']);
$reduction_amount['total_price_tax_excl'] += Tools::ps_round((float) $objHotelBookingDemands->total_price_tax_excl, 6);
$reduction_amount['total_price_tax_incl'] += Tools::ps_round((float) $objHotelBookingDemands->total_price_tax_incl, 6);
$reduction_amount['total_price_tax_excl'] += (float) $objHotelBookingDemands->total_price_tax_excl;
$reduction_amount['total_price_tax_incl'] += (float) $objHotelBookingDemands->total_price_tax_incl;
$objHotelBookingDemands->total_price_tax_excl = 0;
$objHotelBookingDemands->total_price_tax_incl = 0;
$objHotelBookingDemands->save();
@@ -3359,10 +3338,10 @@ class HotelBookingDetail extends ObjectModel
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(
$roomService['id_room_type_service_product_order_detail']
);
$reduction_amount['total_price_tax_excl'] += Tools::ps_round((float) $objRoomTypeServiceProductOrderDetail->total_price_tax_excl, 6);
$reduction_amount['total_products_tax_excl'] += Tools::ps_round((float) $objRoomTypeServiceProductOrderDetail->total_price_tax_excl, 6);
$reduction_amount['total_price_tax_incl'] += Tools::ps_round((float) $objRoomTypeServiceProductOrderDetail->total_price_tax_incl, 6);
$reduction_amount['total_products_tax_incl'] += Tools::ps_round((float) $objRoomTypeServiceProductOrderDetail->total_price_tax_incl, 6);
$reduction_amount['total_price_tax_excl'] += (float) $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$reduction_amount['total_products_tax_excl'] += (float) $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$reduction_amount['total_price_tax_incl'] += (float) $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$reduction_amount['total_products_tax_incl'] += (float) $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
if (Validate::isLoadedObject($objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail))) {
$objOrderDetail->product_quantity_refunded += $objRoomTypeServiceProductOrderDetail->quantity;
@@ -3370,13 +3349,17 @@ class HotelBookingDetail extends ObjectModel
$objOrderDetail->product_quantity_refunded = $objOrderDetail->product_quantity;
}
$objOrderDetail->total_price_tax_excl = Tools::ps_round(
($objOrderDetail->total_price_tax_excl - $objRoomTypeServiceProductOrderDetail->total_price_tax_excl),
6
$objOrderDetail->total_price_tax_excl -= Tools::processPriceRounding(
$objOrderDetail->total_price_tax_excl,
1,
$objOrder->round_type,
$objOrder->round_mode
);
$objOrderDetail->total_price_tax_incl = Tools::ps_round(
($objOrderDetail->total_price_tax_incl - $objRoomTypeServiceProductOrderDetail->total_price_tax_incl),
6
$objOrderDetail->total_price_tax_incl -= Tools::processPriceRounding(
$objOrderDetail->total_price_tax_incl,
1,
$objOrder->round_type,
$objOrder->round_mode
);
$objOrderDetail->save();
@@ -3404,42 +3387,44 @@ class HotelBookingDetail extends ObjectModel
if (!$hasOrderDiscountOrPayment) {
// reduce room amount from order and order detail
$objOrderDetail->total_price_tax_incl = Tools::ps_round(
($objOrderDetail->total_price_tax_incl - $this->total_price_tax_incl),
6
$objOrderDetail->total_price_tax_incl -= Tools::processPriceRounding(
$this->total_price_tax_incl,
1,
$objOrder->round_type,
$objOrder->round_mode
);
$objOrderDetail->total_price_tax_excl = Tools::ps_round(
($objOrderDetail->total_price_tax_excl - $this->total_price_tax_excl),
6
$objOrderDetail->total_price_tax_excl -= Tools::processPriceRounding(
$this->total_price_tax_excl,
1,
$objOrder->round_type,
$objOrder->round_mode
);
if (Validate::isLoadedObject($objOrder = new Order($this->id_order))) {
$objOrder->total_paid = Tools::ps_round(
($objOrder->total_paid - $reduction_amount['total_price_tax_incl']),
6
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid = $objOrder->total_paid > 0 ? $objOrder->total_paid : 0;
$objOrder->total_paid_tax_excl = Tools::ps_round(
($objOrder->total_paid_tax_excl - $reduction_amount['total_price_tax_excl']),
6
$objOrder->total_paid_tax_excl = Tools::ps_round(($objOrder->total_paid_tax_excl - $reduction_amount['total_price_tax_excl']),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid_tax_excl = $objOrder->total_paid_tax_excl > 0 ? $objOrder->total_paid_tax_excl : 0;
$objOrder->total_paid_tax_incl = Tools::ps_round(
($objOrder->total_paid_tax_incl - $reduction_amount['total_price_tax_incl']),
6
$objOrder->total_paid_tax_incl = Tools::ps_round(($objOrder->total_paid_tax_incl - $reduction_amount['total_price_tax_incl']),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_paid_tax_incl = $objOrder->total_paid_tax_incl > 0 ? $objOrder->total_paid_tax_incl : 0;
$objOrder->total_products = Tools::ps_round(
($objOrder->total_products - $reduction_amount['total_products_tax_excl']),
6
$objOrder->total_products = Tools::ps_round(($objOrder->total_products - $reduction_amount['total_products_tax_excl']),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_products = $objOrder->total_products > 0 ? $objOrder->total_products : 0;
$objOrder->total_products_wt = Tools::ps_round(
($objOrder->total_products_wt - $reduction_amount['total_products_tax_incl']),
6
$objOrder->total_products_wt = Tools::ps_round(($objOrder->total_products_wt - $reduction_amount['total_products_tax_incl']),
_PS_PRICE_COMPUTE_PRECISION_
);
$objOrder->total_products_wt = $objOrder->total_products_wt > 0 ? $objOrder->total_products_wt : 0;

View File

@@ -955,14 +955,20 @@ class HotelCartBookingData extends ObjectModel
$errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate');
}
// validate service products if not active not then remove from cart
if ($cartProducts = $context->cart->getProducts()) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
foreach ($cartProducts as $product) {
if (!$product['active'] && !$product['booking_product']) {
$serviceProducts = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart($context->cart->id, $product['id_product']);
foreach ($serviceProducts as $serviceProduct) {
$objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($serviceProduct['htl_cart_booking_id']);
// validate service products if not active, deleted or not associated to a specific room type then remove from cart
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if ($serviceProducts = $objRoomTypeServiceProductCartDetail->getAllServiceProduct($context->cart->id)) {
foreach ($serviceProducts as $service) {
if (!Validate::isLoadedObject($product = new Product($service['id_product']))) {
$objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($service['htl_cart_booking_id'], $service['id_product']);
} else {
if (!$product->active) {
$objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($service['htl_cart_booking_id'], $service['id_product']);
} else {
if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($service['id_product_room_type'], $service['id_product'])) {
$objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($service['htl_cart_booking_id'], $service['id_product']);
}
}
}
}
@@ -987,87 +993,89 @@ class HotelCartBookingData extends ObjectModel
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($cartProducts as $product) {
if ($product['active']) {
if ($cartBookingData = $objHotelCartBookingData->getOnlyCartBookingData(
$context->cart->id,
$context->cart->id_guest,
$product['id_product']
)) {
$cartData = array();
foreach ($cartBookingData as $bookingData) {
$dateJoin = strtotime($bookingData['date_from']).strtotime($bookingData['date_to']);
$cartData[$dateJoin]['date_from'] = $bookingData['date_from'];
$cartData[$dateJoin]['date_to'] = $bookingData['date_to'];
$cartData[$dateJoin]['id_hotel'] = $bookingData['id_hotel'];
$cartData[$dateJoin]['id_rms'][] = $bookingData['id_room'];
}
if ($product['booking_product']) {
if ($product['active']) {
if ($cartBookingData = $objHotelCartBookingData->getOnlyCartBookingData(
$context->cart->id,
$context->cart->id_guest,
$product['id_product']
)) {
$cartData = array();
foreach ($cartBookingData as $bookingData) {
$dateJoin = strtotime($bookingData['date_from']).strtotime($bookingData['date_to']);
$cartData[$dateJoin]['date_from'] = $bookingData['date_from'];
$cartData[$dateJoin]['date_to'] = $bookingData['date_to'];
$cartData[$dateJoin]['id_hotel'] = $bookingData['id_hotel'];
$cartData[$dateJoin]['id_rms'][] = $bookingData['id_room'];
}
foreach ($cartData as $roomData) {
if (!$forAdminCart) {
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
) {
$objHotelBranchInformation = new HotelBranchInformation(
$roomData['id_hotel'],
$context->language->id
);
$errors[] = sprintf(
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
$objHotelBranchInformation->hotel_name,
Tools::displayDate($maxOrderDate),
Tools::displayDate($roomData['date_from']),
Tools::displayDate($roomData['date_to'])
);
foreach ($cartData as $roomData) {
if (!$forAdminCart) {
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
) {
$objHotelBranchInformation = new HotelBranchInformation(
$roomData['id_hotel'],
$context->language->id
);
$errors[] = sprintf(
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
$objHotelBranchInformation->hotel_name,
Tools::displayDate($maxOrderDate),
Tools::displayDate($roomData['date_from']),
Tools::displayDate($roomData['date_to'])
);
}
}
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
if ($preparationTime !== false) {
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
) {
$objHotelBranchInformation = new HotelBranchInformation(
$roomData['id_hotel'],
$context->language->id
);
$errors[] = sprintf(
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
$objHotelBranchInformation->hotel_name,
Tools::displayDate($minOrderDate),
Tools::displayDate($roomData['date_from']),
Tools::displayDate($roomData['date_to'])
);
}
}
}
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
if ($preparationTime !== false) {
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
) {
$objHotelBranchInformation = new HotelBranchInformation(
$roomData['id_hotel'],
$context->language->id
);
$errors[] = sprintf(
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
$objHotelBranchInformation->hotel_name,
Tools::displayDate($minOrderDate),
Tools::displayDate($roomData['date_from']),
Tools::displayDate($roomData['date_to'])
);
$bookingParams = array(
'date_from' => $roomData['date_from'],
'date_to' => $roomData['date_to'],
'hotel_id' => $roomData['id_hotel'],
'id_room_type' => $product['id_product'],
'only_search_data' => 1,
);
$bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams);
$isRoomBooked = 0;
if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) {
foreach ($roomData['id_rms'] as $searchRoomData) {
if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
break;
}
}
if ($isRoomBooked) {
$errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
} else {
$errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
}
}
}
$bookingParams = array(
'date_from' => $roomData['date_from'],
'date_to' => $roomData['date_to'],
'hotel_id' => $roomData['id_hotel'],
'id_room_type' => $product['id_product'],
'only_search_data' => 1,
);
$bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams);
$isRoomBooked = 0;
if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) {
foreach ($roomData['id_rms'] as $searchRoomData) {
if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
break;
}
}
if ($isRoomBooked) {
$errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
} else {
$errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
}
}
}
} else {
$errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate');
}
} else {
$errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate');
}
}
}
@@ -1176,7 +1184,7 @@ class HotelCartBookingData extends ObjectModel
null,
null
);
$cart_detail_data[$key]['additional_service_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
$cart_detail_data[$key]['additional_service_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
0,
0,
@@ -1184,9 +1192,10 @@ class HotelCartBookingData extends ObjectModel
$value['date_from'],
$value['date_to'],
$value['id'],
1,
false
);
$cart_detail_data[$key]['additional_services_auto_add_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
$cart_detail_data[$key]['additional_services_auto_add_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
0,
0,
@@ -1194,10 +1203,11 @@ class HotelCartBookingData extends ObjectModel
$value['date_from'],
$value['date_to'],
$value['id'],
1,
false,
1
);
$cart_detail_data[$key]['additional_services_auto_add_with_room_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
$cart_detail_data[$key]['additional_services_auto_add_with_room_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
0,
0,
@@ -1205,12 +1215,13 @@ class HotelCartBookingData extends ObjectModel
$value['date_from'],
$value['date_to'],
$value['id'],
1,
false,
1,
null,
Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
$cart_detail_data[$key]['additional_services_auto_add_independent_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
$cart_detail_data[$key]['additional_services_auto_add_independent_price'] = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
0,
0,
@@ -1218,6 +1229,7 @@ class HotelCartBookingData extends ObjectModel
$value['date_from'],
$value['date_to'],
$value['id'],
1,
false,
1,
null,
@@ -1534,14 +1546,15 @@ class HotelCartBookingData extends ObjectModel
$data_v['date_to'],
1
);
$serviceProductPrice = $objRoomTypeServiceProductCartDetail->getServiceProductsTotalInCart(
$serviceProductPrice = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$context->cart->id,
0,
$data_v['id_hotel'],
$data_v['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$data_v['id']
$data_v['id'],
1
);
$totalAdditionalServicePrice = $demandPrice + $serviceProductPrice;
@@ -1598,9 +1611,9 @@ class HotelCartBookingData extends ObjectModel
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl'];
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
}
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount * $varQty;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount * $varQty;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd * $varQty;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] += $amount;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] += $totalPriceWithoutDiscount;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] += $amountWithoutAutoAdd;
} else {
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] = $totalAdditionalServicePrice;
$numDays = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
@@ -1698,6 +1711,7 @@ class HotelCartBookingData extends ObjectModel
}
}
}
return $cartHotelData;
}

View File

@@ -45,7 +45,21 @@ class HotelRoomDisableDates extends ObjectModel
public function getRoomDisableDates($id_room)
{
return Db::getInstance()->executeS('SELECT `date_from`, `date_to`, `reason` FROM `'._DB_PREFIX_.'htl_room_disable_dates` WHERE `id_room`='.(int)$id_room);
$objModule = Module::getInstanceByName('hotelreservationsystem');
$disabledDates = Db::getInstance()->executeS('SELECT `id`, `date_from`, `date_to`, `reason`, `date_add`,
NULL AS `id_event`, NULL AS `event_url`, "'.$objModule->l('Disabled', 'HotelRoomDisableDates').'" AS `event_title`,
1 AS `is_editable`, 1 AS `is_deletable`
FROM `'._DB_PREFIX_.'htl_room_disable_dates` WHERE `id_room`='.(int) $id_room
);
Hook::exec('actionRoomDisabledDatesModifier',
array(
'disable_dates' => &$disabledDates,
'id_room' => $id_room
)
);
return $disabledDates;
}
public function checkIfRoomAlreadyDisabled($params)

View File

@@ -281,12 +281,18 @@ class HotelRoomType extends ObjectModel
/**
* @param [int] $roomTypesList: string of idRoomTypes seperated by ","
*/
public function getRoomTypeDetailByRoomTypeIds($roomTypesList, $position = true)
public function getRoomTypeDetailByRoomTypeIds($roomTypesList, $position = true, $fullDetail = false, $idLang = false)
{
$sql = 'SELECT COUNT(hri.`id`) AS `numberOfRooms`, hrt.`id_product`, `adults`, `children`, `max_adults`, `max_children`, `max_guests`'.
($position ? ', cp.`position`' : '').'
if (!$idLang) {
$idLang = Context::getContext()->language->id;
}
$sql = 'SELECT pl.`name`, COUNT(hri.`id`) AS `numberOfRooms`, hrt.`id_product`, `adults`, `children`, `max_adults`, `max_children`, `max_guests`
'.($position ? ', cp.`position`' : '').'
'.($fullDetail ? ', pl.`link_rewrite`, pl.`description_short`' : '').'
FROM `'._DB_PREFIX_.'htl_room_type` AS `hrt`
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS `hri` ON (hri.`id_product` = hrt.`id_product`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (hrt.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$idLang.')';
if ($position) {
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id` = hrt.`id_hotel`)

View File

@@ -95,9 +95,12 @@ class HotelRoomTypeDemandPrice extends ObjectModel
}
}
}
$totalDemandsPrice += $price;
// Rounding as per configurations
$totalDemandsPrice += Tools::processPriceRounding($price);
}
}
return $totalDemandsPrice;
}

View File

@@ -718,39 +718,64 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
}
}
if ($with_auto_room_services) {
if ($servicesWithTax = RoomTypeServiceProduct::getAutoAddServices(
$id_product,
$date_from,
$date_to,
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
true,
$id_cart,
$id_guest,
$use_reduc
)) {
foreach($servicesWithTax as $service) {
$totalPrice['total_price_tax_incl'] += $service['price'];
if ($id_cart && $id_room) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($roomServicesServices = $objRoomTypeServiceProductCartDetail->getServiceProductsInCart(
$id_cart,
0,
0,
$id_product,
$date_from,
$date_to,
0,
0,
null,
null,
null,
null,
$id_room
)) {
$selectedServices = array_shift($roomServicesServices);
}
}
if ($servicesWithoutTax = RoomTypeServiceProduct::getAutoAddServices(
$id_product,
$date_from,
$date_to,
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
false,
$id_cart,
$id_guest,
$use_reduc
)) {
foreach($servicesWithoutTax as $service) {
$totalPrice['total_price_tax_excl'] += $service['price'];
if (isset($selectedServices)) {
$totalPrice['total_price_tax_incl'] += $selectedServices['total_price_tax_incl'];
$totalPrice['total_price_tax_excl'] += $selectedServices['total_price_tax_excl'];
} else {
if ($servicesWithTax = RoomTypeServiceProduct::getAutoAddServices(
$id_product,
$date_from,
$date_to,
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
true,
$use_reduc
)) {
foreach($servicesWithTax as $service) {
$totalPrice['total_price_tax_incl'] += Tools::processPriceRounding($service['price']);
}
}
if ($servicesWithoutTax = RoomTypeServiceProduct::getAutoAddServices(
$id_product,
$date_from,
$date_to,
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
false,
$use_reduc
)) {
foreach($servicesWithoutTax as $service) {
$totalPrice['total_price_tax_excl'] += Tools::processPriceRounding($service['price']);
}
}
}
}
if ($quantity) {
$totalPrice['total_price_tax_incl'] = $totalPrice['total_price_tax_incl'] * $quantity;
$totalPrice['total_price_tax_excl'] = $totalPrice['total_price_tax_excl'] * $quantity;
if (!$quantity) {
$quantity = 1;
}
$totalPrice['total_price_tax_incl'] = Tools::processPriceRounding($totalPrice['total_price_tax_incl'], $quantity);
$totalPrice['total_price_tax_excl'] = Tools::processPriceRounding($totalPrice['total_price_tax_excl'], $quantity);
return $totalPrice;
}

View File

@@ -135,16 +135,12 @@ class RoomTypeServiceProduct extends ObjectModel
return Db::getInstance()->getValue($sql);
}
public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $idCart = 0, $idGuest = 0, $use_reduc = 1)
public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $use_reduc = 1)
{
if (Product::isBookingProduct($idProduct)) {
$sql = 'SELECT p.`id_product` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
INNER JOIN `'._DB_PREFIX_.'product` p ON (rsp.`id_product` = p.`id_product` AND p.`auto_add_to_cart` = 1)';
if ($idCart) {
$sql .= ' INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` spcd
ON (rsp.`id_product` = spcd.`id_product` AND spcd.`id_cart` = '.(int)$idCart.')';
}
$sql .= ' WHERE p.`active` = 1 AND `id_element` = '.(int)$idProduct.' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE;
INNER JOIN `'._DB_PREFIX_.'product` p ON (rsp.`id_product` = p.`id_product` AND p.`auto_add_to_cart` = 1)
WHERE p.`active` = 1 AND `id_element` = '.(int)$idProduct.' AND `element_type` = '.self::WK_ELEMENT_TYPE_ROOM_TYPE;
if (!is_null($priceAdditionType)) {
$sql .= ' AND p.`price_addition_type` = '.$priceAdditionType;
}
@@ -163,6 +159,7 @@ class RoomTypeServiceProduct extends ObjectModel
$use_reduc
);
}
return $services;
}
}

View File

@@ -82,11 +82,12 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
return false;
}
public function removeServiceProductByIdHtlCartBooking($htlCartBookingId)
public function removeServiceProductByIdHtlCartBooking($htlCartBookingId, $idService = 0)
{
if ($stadardProductsData = Db::getInstance()->executeS(
'SELECT * FROM `' . _DB_PREFIX_ . 'htl_room_type_service_product_cart_detail`
WHERE `htl_cart_booking_id` = ' . (int)$htlCartBookingId
WHERE `htl_cart_booking_id` = ' . (int)$htlCartBookingId.
($idService? ' AND `id_product` = '.(int)$idService : '')
)) {
foreach ($stadardProductsData as $product) {
if (Validate::isLoadedObject(
@@ -132,6 +133,9 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
return true;
}
/**
* @deprecated since 1.6.1 use getServiceProductsInCart() instead
*/
public function getServiceProductsTotalInCart(
$idCart,
$idProduct = 0,
@@ -145,59 +149,20 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$id_address = null,
$priceAdditionType = null
) {
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
$sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_product` as `room_type_id_product`, cbd.`date_from`, cbd.`date_to`
FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd ON(rscd.`htl_cart_booking_id` = cbd.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rscd.`id_product`)
WHERE 1';
if (!is_null($autoAddToCart)) {
$sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart;
if ($autoAddToCart == 1 && !is_null($priceAdditionType)) {
$sql .= ' AND p.`price_addition_type` = '.$priceAdditionType;
}
}
if ($idCart) {
$sql .= ' AND cbd.`id_cart`='.(int) $idCart;
}
if ($idProduct) {
$sql .= ' AND rscd.`id_product`='.(int) $idProduct;
}
if ($idHotel) {
$sql .= ' AND cbd.`id_hotel`='.(int) $idHotel;
}
if ($roomTypeIdProduct) {
$sql .= ' AND cbd.`id_product`='.(int) $roomTypeIdProduct;
}
if ($dateFrom && $dateTo) {
$sql .= ' AND cbd.`date_from` = \''.pSQL($dateFrom).'\' AND cbd.`date_to` = \''.pSQL($dateTo).'\'';
}
if ($htlCartBookingId) {
$sql .= ' AND cbd.`id`='.(int) $htlCartBookingId;
}
$sql .= ' ORDER BY cbd.`id`';
$totalPrice = 0;
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
if ($serviceProducts = Db::getInstance()->executeS($sql)) {
foreach ($serviceProducts as $product) {
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
$totalPrice += $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
}
}
return $totalPrice;
return $this->getServiceProductsInCart(
$idCart,
$idProduct,
$idHotel,
$roomTypeIdProduct,
$dateFrom,
$dateTo,
$htlCartBookingId,
1,
$useTax,
$autoAddToCart,
$id_address,
$priceAdditionType
);
}
public function getRoomServiceProducts(
@@ -208,129 +173,28 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$id_address = null,
$priceAdditionType = null
) {
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($htlCartBookingId))) {
$selectedServiceProducts = $this->getServiceProductsInCart(
$objHotelCartBookingData->id_cart,
0,
0,
0,
0,
0,
$htlCartBookingId,
0,
$useTax,
$autoAddToCart,
$id_address,
$priceAdditionType
);
if (!$idLang) {
$idLang = Context::getContext()->language->id;
}
$sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_cart`, p.`auto_add_to_cart`, p.`allow_multiple_quantity`, cbd.`id` as `htl_cart_booking_id`,
p.`price_addition_type`, cbd.`id_product` as `room_type_id_product`, pl.`name`, cbd.`date_from`, cbd.`date_to`
FROM `'._DB_PREFIX_.'htl_cart_booking_data` cbd
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail` rscd ON(rscd.`htl_cart_booking_id` = cbd.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rscd.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$idLang.')
WHERE 1';
if (!is_null($autoAddToCart)) {
$sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart;
if ($autoAddToCart == 1 && !is_null($priceAdditionType)) {
$sql .= ' AND p.`price_addition_type` = '.$priceAdditionType;
if (isset($selectedServiceProducts[$htlCartBookingId]['selected_products_info'])) {
return $selectedServiceProducts[$htlCartBookingId]['selected_products_info'];
}
}
if ($htlCartBookingId) {
$sql .= ' AND cbd.`id`='.(int) $htlCartBookingId;
}
$sql .= ' ORDER BY cbd.`id`';
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
$selectedServiceProducts = array();
if ($serviceProducts = Db::getInstance()->executeS($sql)) {
foreach ($serviceProducts as $product) {
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
if (isset($selectedServiceProducts[$product['id_product']])) {
$selectedServiceProducts[$product['id_product']]['quantity'] += $product['quantity'];
$selectedServiceProducts[$product['id_product']]['total_price'] += $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['total_price_tax_excl'] += $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['total_price_tax_incl'] += $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
} else {
$selectedServiceProducts[$product['id_product']] = $product;
$selectedServiceProducts[$product['id_product']]['unit_price_tax_excl'] = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
null,
null,
false,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['unit_price_tax_incl'] = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
1,
null,
null,
true,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['total_price'] = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['total_price_tax_excl'] = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$selectedServiceProducts[$product['id_product']]['total_price_tax_incl'] = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
}
}
}
return $selectedServiceProducts;
return array();
}
public function getServiceProductsInCart(
@@ -345,7 +209,8 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$useTax = null,
$autoAddToCart = 0,
$id_address = null,
$priceAdditionType = null
$priceAdditionType = null,
$idRoom = 0
) {
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
@@ -390,6 +255,9 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
if ($dateFrom && $dateTo) {
$sql .= ' AND cbd.`date_from` = \''.pSQL($dateFrom).'\' AND cbd.`date_to` = \''.pSQL($dateTo).'\'';
}
if ($idRoom) {
$sql .= ' AND cbd.`id_room`='.(int) $idRoom;
}
if ($htlCartBookingId) {
$sql .= ' AND cbd.`id`='.(int) $htlCartBookingId;
}
@@ -404,12 +272,12 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
if ($serviceProducts = Db::getInstance()->executeS($sql)) {
foreach ($serviceProducts as $product) {
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
if ($getTotalPrice) {
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
$totalPrice += $objRoomTypeServiceProductPrice->getServicePrice(
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
$useTax,
@@ -417,8 +285,8 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$id_address
);
$totalPrice += Tools::processPriceRounding($servicePrice, $qty);
} else {
$qty = $product['quantity'] ? (int)$product['quantity'] : 1;
if (isset($selectedServiceProducts[$product['htl_cart_booking_id']])) {
if ($idProduct) {
$selectedServiceProducts[$product['htl_cart_booking_id']]['quantity'] += $product['quantity'];
@@ -452,36 +320,43 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
),
);
}
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] += $objRoomTypeServiceProductPrice->getServicePrice(
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] += $objRoomTypeServiceProductPrice->getServicePrice(
$servicePriceTE = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] += $objRoomTypeServiceProductPrice->getServicePrice(
$servicePriceTI = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] += Tools::processPriceRounding($servicePrice, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] += Tools::processPriceRounding($servicePriceTE, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] += Tools::processPriceRounding($servicePriceTI, $qty);
} else {
$selectedServiceProducts[$product['htl_cart_booking_id']]['htl_cart_booking_id'] = $product['htl_cart_booking_id'];
$selectedServiceProducts[$product['htl_cart_booking_id']]['id_cart'] = $product['id_cart'];
@@ -553,40 +428,45 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
);
}
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = $objRoomTypeServiceProductPrice->getServicePrice(
$servicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
$useTax,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] = $objRoomTypeServiceProductPrice->getServicePrice(
$servicePriceTE = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
false,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] = $objRoomTypeServiceProductPrice->getServicePrice(
$servicePriceTI = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
(int)$product['room_type_id_product'],
$qty,
1,
$product['date_from'],
$product['date_to'],
true,
false,
$id_address
);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = Tools::processPriceRounding($servicePrice, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_excl'] = Tools::processPriceRounding($servicePriceTE, $qty);
$selectedServiceProducts[$product['htl_cart_booking_id']]['total_price_tax_incl'] = Tools::processPriceRounding($servicePriceTI, $qty);
}
}
}
}
if ($getTotalPrice) {
@@ -626,6 +506,16 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
return false;
}
public function getAllServiceProduct($idCart)
{
return Db::getInstance()->executeS(
'SELECT spcd.*, cbd.`id_product` as `id_product_room_type`, cbd.`id_room`, cbd.`id_hotel`, cbd.`date_from`, cbd.`date_to` FROM `' . _DB_PREFIX_ . 'htl_room_type_service_product_cart_detail` spcd
INNER JOIN `'._DB_PREFIX_.'htl_cart_booking_data` cbd
ON(spcd.`htl_cart_booking_id` = cbd.`id`)
WHERE spcd.`id_cart` = ' . (int)$idCart
);
}
public static function validateServiceProductsInCart()
{
$context = Context::getContext();
@@ -641,4 +531,4 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
}
}
}
}
}

View File

@@ -78,7 +78,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
$sql = 'SELECT rsod.*';
if (!$getTotalPrice) {
$sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, hbd.`id_room`, hbd.`adults`, hbd.`children`';
$sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)';
@@ -152,6 +152,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'product_tax' => $product_tax,
'product_tax_label' => $product_tax_label,
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'price_calculation_method' => $product['product_price_calculation_method'],
'total_price_tax_excl' => $product['total_price_tax_excl'],
'total_price_tax_incl' => $product['total_price_tax_incl'],
);
@@ -175,6 +176,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'name' => $product['name'],
'quantity' => $product['quantity'],
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'price_calculation_method' => $product['product_price_calculation_method'],
'product_tax' => $product_tax,
'product_tax_label' => $product_tax_label,
'total_price_tax_excl' => $product['total_price_tax_excl'],
@@ -213,7 +215,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = rsod.`id_order_detail`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)';
$sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail;

View File

@@ -101,7 +101,7 @@ class RoomTypeServiceProductPrice extends ObjectModel
);
}
public function getServicePrice($idProduct, $idProductRoomType, $quantity, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $use_reduc= 1)
public function getServicePrice($idProduct, $idProductRoomType, $quantity = 1, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $use_reduc= 1)
{
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;

View File

@@ -226,50 +226,209 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser
}
// now call the function
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$objBookingDtl = new HotelBookingDetail();
$searchAriData = [];
// If api is called for getting ari info for all the dates in the provided date range
if (isset($ariParams['date_wise_breakdown']) && $ariParams['date_wise_breakdown'] && $bookingParams['search_available']) {
if (isset($ariParams['date_wise_breakdown']) && $ariParams['date_wise_breakdown']) {
$dateWiseBreakdown = 1;
$datesAriInfo = [];
/**
* To generate data for each day, we will need to get data for booked and unavailable dates, s
* so saving the booking_params for generating the response later
*/
$getavail = $bookingParams['search_available'];
$getBooked = $bookingParams['search_booked'];
$getUnavai = $bookingParams['search_unavai'];
$bookingParams['search_available'] = 1;
$bookingParams['search_booked'] = 1;
$bookingParams['search_unavai'] = 1;
$bookingData = $objBookingDtl->getBookingData($bookingParams);
$dateFrom = $bookingParams['date_from'];
$dateTo = $bookingParams['date_to'];
// saving date wise booked and unavailable rooms to manage available rooms calculation .
$bookedDates = array();
$unavailableDates = array();
if (isset($bookingData['rm_data']) && $bookingData['rm_data']) {
foreach ($bookingData['rm_data'] as $key => $roomType) {
if ($rooms = HotelRoomInformation::getHotelRoomsInfo($ariParams['id_hotel'], $roomType['id_product'])) {
foreach ($rooms as $room) {
$bookingData['rm_data'][$key]['all_rooms'][$room['id']] = array('id_room' => $room['id'], 'room_num' => $room['room_num']);
}
if (count($roomType['data']['booked'])) {
foreach ($roomType['data']['booked'] as $bookedRoom) {
foreach ($bookedRoom['detail'] as $bookDetail) {
for ($currentDate = date('Y-m-d', strtotime($bookDetail['date_from']));
$currentDate < date('Y-m-d', strtotime($bookDetail['date_to']));
$currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))
) {
$bookedDates[$currentDate][$roomType['id_product']][$bookedRoom['id_room']] = $bookedRoom['id_room'];
}
}
}
}
if (count($roomType['data']['unavailable'])) {
foreach ($roomType['data']['unavailable'] as $unavailableRooms) {
foreach ($unavailableRooms['detail'] as $unavailableDetail) {
for ($currentDate = date('Y-m-d', strtotime($unavailableDetail['date_from']));
$currentDate < date('Y-m-d', strtotime($unavailableDetail['date_to']));
$currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))
) {
$unavailableDates[$currentDate][$roomType['id_product']][$bookedRoom['id_room']] = $bookedRoom['id_room'];
}
}
}
}
}
}
}
// Lets get data date by date (Every date in the date range)
$dateBookingParams = $bookingParams;
// for a single date there is no use of partial available rooms
$dateBookingParams['search_partial'] = 0;
for ($currentDate = $dateFrom; $currentDate < $dateTo; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) {
$dateBookingParams['date_from'] = $currentDate;
$dateBookingParams['date_to'] = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
// get inventories for every date
$ariInfo = $objBookingDtl->getBookingData($dateBookingParams);
// creating ari details for every date
for ($currentDate = $bookingParams['date_from']; $currentDate < $bookingParams['date_to']; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) {
$nextDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
// append request fields also. will be attached in the response xml
$ariInfo['id_hotel'] = $ariParams['id_hotel'];
$ariInfo['date_from'] = $dateBookingParams['date_from'];
$ariInfo['date_to'] = $dateBookingParams['date_to'];
$ariInfo['num_rooms'] = $totalRooms;
$ariDateInfo['id_hotel'] = $ariParams['id_hotel'];
$ariDateInfo['date_from'] = $currentDate;
$ariDateInfo['date_to'] = $nextDate;
$ariDateInfo['currency'] = $objCurrency->iso_code;
if (isset($bookingData['rm_data']) && $bookingData['rm_data']) {
$ariDateInfo['total_rooms'] = 0;
$ariDateInfo['room_types'] = array();
if ($getavail) {
$ariDateInfo['total_available_rooms'] = 0;
}
if ($getUnavai) {
$ariDateInfo['total_unavailable_rooms'] = 0;
}
if ($getBooked) {
$ariDateInfo['total_booked_rooms'] = 0;
}
foreach ($bookingData['rm_data'] as $roomType)
{
if (count($roomType['all_rooms'])) {
$ariDateInfo['total_rooms'] += count($roomType['all_rooms']);
$roomDetail = array();
$searchAriData[] = $ariInfo;
$roomDetail['available'] = $roomType['all_rooms'];
if (isset($bookedDates[$currentDate][$roomType['id_product']])) {
$roomDetail['available'] = array_diff_key($roomDetail['available'], $bookedDates[$currentDate][$roomType['id_product']]);
$roomDetail['booked'] = array_intersect_key($roomType['all_rooms'], $bookedDates[$currentDate][$roomType['id_product']]);
} else {
$roomDetail['booked'] = array();
}
if (isset($unavailableDates[$currentDate][$roomType['id_product']])) {
$roomDetail['available'] = array_diff_key($roomDetail['available'], $unavailableDates[$currentDate][$roomType['id_product']]);
$roomDetail['unavailable'] = array_intersect_key($roomType['all_rooms'], $unavailableDates[$currentDate][$roomType['id_product']]);
} else {
$roomDetail['unavailable'] = array();
}
if ($getavail) {
$ariDateInfo['total_available_rooms'] += count($roomDetail['available']);
} else {
unset($roomDetail['available']);
}
if ($getUnavai) {
$ariDateInfo['total_unavailable_rooms'] += count($roomDetail['available']);
} else {
unset($roomDetail['unavailable']);
}
if ($getBooked) {
$ariDateInfo['total_booked_rooms'] += count($roomDetail['available']);
} else {
unset($roomDetail['booked']);
}
}
$roomTypePriceTE = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomType['id_product'],
$currentDate,
date('Y-m-d H:i:s', strtotime('+1 day', strtotime($currentDate))),
0
);
$roomTypePriceTI = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomType['id_product'],
$currentDate,
date('Y-m-d H:i:s', strtotime('+1 day', strtotime($currentDate))),
1
);
$totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$roomType['id_product'],
$currentDate,
date('Y-m-d H:i:s', strtotime('+1 day', strtotime($currentDate))),
$totalRooms
);
$ariDateInfo['room_types'][] = array(
'id_room_type' => $roomType['id_product'],
'base_price' => $roomTypePriceTE,
'base_price_with_tax' => $roomTypePriceTI,
'total_price' => $totalBookingPrice['total_price_tax_excl'],
'total_price_with_tax' => $totalBookingPrice['total_price_tax_incl'],
'name' => $roomType['name'],
'rooms' => $roomDetail
);
}
}
$searchAriData[] = $ariDateInfo;
}
} else { // If api is called for getting ari info for a particular date range
$dateWiseBreakdown = 0;
// If api is called for getting ari info for a particular date range
$ariInfo = $objBookingDtl->getBookingData($bookingParams);
$bookingData = $objBookingDtl->getBookingData($bookingParams);
// append request fields also. will be attached in the response xml
$ariInfo = array();
$ariInfo['id_hotel'] = $ariParams['id_hotel'];
$ariInfo['date_from'] = $bookingParams['date_from'];
$ariInfo['date_to'] = $bookingParams['date_to'];
$ariInfo['num_rooms'] = $totalRooms;
$ariInfo['currency'] = $objCurrency->iso_code;
if (isset($bookingData['rm_data']) && $bookingData['rm_data']) {
if (isset($bookingData['stats']['total_rooms'])) {
$ariInfo['total_rooms'] = $bookingData['stats']['total_rooms'];
}
if (isset($bookingData['stats']['num_avail'])) {
$ariInfo['total_available_rooms'] = $bookingData['stats']['num_avail'];
}
if (isset($bookingData['stats']['num_unavail'])) {
$ariInfo['total_unavailable_rooms'] = $bookingData['stats']['num_unavail'];
}
if (isset($bookingData['stats']['num_part_avai'])) {
$ariInfo['total_partial_available_rooms'] = $bookingData['stats']['num_part_avai'];
}
if (isset($bookingData['stats']['num_booked'])) {
$ariInfo['total_booked_rooms'] = $bookingData['stats']['num_booked'];
}
$ariInfo['room_types'] = array();
foreach ($bookingData['rm_data'] as $roomType) {
$roomTypePriceTE = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomType['id_product'],
$bookingParams['date_from'],
$bookingParams['date_to'],
0
);
$roomTypePriceTI = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomType['id_product'],
$bookingParams['date_from'],
$bookingParams['date_to'],
1
);
$totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$roomType['id_product'],
$bookingParams['date_from'],
$bookingParams['date_to'],
$totalRooms
);
$ariInfo['room_types'][] = array(
'id_room_type' => $roomType['id_product'],
'base_price' => $roomTypePriceTE,
'base_price_with_tax' => $roomTypePriceTI,
'total_price' => $totalBookingPrice['total_price_tax_excl'],
'total_price_with_tax' => $totalBookingPrice['total_price_tax_incl'],
'name' => $roomType['name'],
'rooms' => $roomType['data']
);
}
}
$searchAriData[] = $ariInfo;
}
@@ -450,92 +609,67 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser
$field = array('sqlId' => 'date_to', 'value' => $ariInfo['date_to']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$field = array('sqlId' => 'currency', 'value' => $objCurrency->iso_code);
$field = array('sqlId' => 'currency', 'value' => $ariInfo['currency']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
// check if availability stats are available then only process further
if (isset($ariInfo['stats']) && $ariInfo['stats']) {
$field = array('sqlId' => 'total_rooms', 'value' => $ariInfo['stats']['total_rooms']);
if (isset($ariInfo['total_rooms'])) {
$field = array('sqlId' => 'total_rooms', 'value' => $ariInfo['total_rooms']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['stats']['num_avail'])) {
$field = array('sqlId' => 'total_available_rooms', 'value' => $ariInfo['stats']['num_avail']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['total_available_rooms'])) {
$field = array('sqlId' => 'total_available_rooms', 'value' => $ariInfo['total_available_rooms']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['stats']['num_unavail'])) {
$field = array('sqlId' => 'total_unavailable_rooms', 'value' => $ariInfo['stats']['num_unavail']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['total_unavailable_rooms'])) {
$field = array('sqlId' => 'total_unavailable_rooms', 'value' => $ariInfo['total_unavailable_rooms']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['stats']['num_part_avai'])) {
$field = array('sqlId' => 'total_partial_available_rooms', 'value' => $ariInfo['stats']['num_part_avai']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['total_partial_available_rooms'])) {
$field = array('sqlId' => 'total_partial_available_rooms', 'value' => $ariInfo['total_partial_available_rooms']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['stats']['num_booked'])) {
$field = array('sqlId' => 'total_booked_rooms', 'value' => $ariInfo['stats']['num_booked']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
if (isset($ariInfo['total_booked_rooms'])) {
$field = array('sqlId' => 'total_booked_rooms', 'value' => $ariInfo['total_booked_rooms']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
}
// check if room type data is available then only process further
if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) {
if (isset($ariInfo['room_types']) && $ariInfo['room_types']) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array());
foreach ($ariInfo['rm_data'] as $roomTypeInfo) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array(), array('id' => $roomTypeInfo['id_product'], 'xlink_resource' => $this->wsObject->wsUrl.'room_types'.'/'.$roomTypeInfo['id_product']));
foreach ($ariInfo['room_types'] as $roomTypeInfo) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array(), array(
'id' => $roomTypeInfo['id_room_type'],
'xlink_resource' => $this->wsObject->wsUrl.'room_types'.'/'.$roomTypeInfo['id_room_type']
));
$field = array('sqlId' => 'id_room_type', 'value' => $roomTypeInfo['id_product'], 'xlink_resource' => 'room_types');
$field = array('sqlId' => 'id_room_type', 'value' => $roomTypeInfo['id_room_type'], 'xlink_resource' => 'room_types');
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
// get feature price of room type
$roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
0
);
$field = array('sqlId' => 'base_price', 'value' => $roomTypePrice);
$field = array('sqlId' => 'base_price', 'value' => $roomTypeInfo['base_price']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
// get feature price of room type
$roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
1
);
$field = array('sqlId' => 'base_price_with_tax', 'value' => $roomTypePrice);
$field = array('sqlId' => 'base_price_with_tax', 'value' => $roomTypeInfo['base_price_with_tax']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
$totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
$ariInfo['num_rooms']
);
$field = array('sqlId' => 'total_price', 'value' => $totalBookingPrice['total_price_tax_excl']);
$field = array('sqlId' => 'total_price', 'value' => $roomTypeInfo['total_price']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
$totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
$ariInfo['num_rooms']
);
$field = array('sqlId' => 'total_price_with_tax', 'value' => $totalBookingPrice['total_price_tax_incl']);
$field = array('sqlId' => 'total_price_with_tax', 'value' => $roomTypeInfo['total_price_with_tax']);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
$objRoomType = new Product($roomTypeInfo['id_product']);
$objRoomType = new Product($roomTypeInfo['id_room_type']);
$field = array('sqlId' => 'name', 'value' => $objRoomType->name, 'i18n' => true);
$this->output .= $this->objOutput->getObjectRender()->renderField($field);
// rooms info of the room type
if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) {
if (isset($roomTypeInfo['rooms']) && $roomTypeInfo['rooms']) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array());
foreach ($roomTypeInfo['data'] as $key => $roomsInfo) {
foreach ($roomTypeInfo['rooms'] as $key => $roomsInfo) {
if ($key == 'available') {
$nodeRoomAvailability = 'available';
} elseif ($key == 'unavailable') {
@@ -614,141 +748,12 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser
// create json for the response of the ari request
private function getResponseJson($ariInfoArray, $dateWiseBreakdown = 0)
{
$ariFormatted = array();
if ($ariInfoArray) {
foreach ($ariInfoArray as $ariInfo) {
$dateAriInfo = array();
$dateAriInfo = array();
$dateAriInfo['id_hotel'] = $ariInfo['id_hotel'];
$dateAriInfo['date_from'] = $ariInfo['date_from'];
$dateAriInfo['date_to'] = $ariInfo['date_to'];
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$dateAriInfo['currency'] = $objCurrency->iso_code;
// check if availability stats are available then only process further
if (isset($ariInfo['stats']) && $ariInfo['stats']) {
$dateAriInfo['total_rooms'] = $ariInfo['stats']['total_rooms'];
if (isset($ariInfo['stats']['num_avail'])) {
$dateAriInfo['total_available_rooms'] = $ariInfo['stats']['num_avail'];
}
if (isset($ariInfo['stats']['num_unavail'])) {
$dateAriInfo['total_unavailable_rooms'] = $ariInfo['stats']['num_unavail'];
}
if (isset($ariInfo['stats']['num_part_avai'])) {
$dateAriInfo['total_partial_available_rooms'] = $ariInfo['stats']['num_part_avai'];
}
if (isset($ariInfo['stats']['num_booked'])) {
$dateAriInfo['total_booked_rooms'] = $ariInfo['stats']['num_booked'];
}
}
// check if room type data is available then only process further
if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) {
$dateAriInfo['room_types'] = array();
foreach ($ariInfo['rm_data'] as $roomTypeIndex => $roomTypeInfo) {
// get feature price of room type
$roomTypePriceTE = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
0
);
$roomTypePriceTI = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
1
);
$totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$roomTypeInfo['id_product'],
$ariInfo['date_from'],
$ariInfo['date_to'],
$ariInfo['num_rooms']
);
$dateAriInfo['room_types'][$roomTypeIndex] = array(
'id_room_type' => $roomTypeInfo['id_product'],
'base_price' => $roomTypePriceTE,
'base_price_with_tax' => $roomTypePriceTI,
'total_price' => $totalBookingPrice['total_price_tax_excl'],
'total_price_with_tax' => $totalBookingPrice['total_price_tax_incl']
);
$objRoomType = new Product($roomTypeInfo['id_product']);
$dateAriInfo['room_types'][$roomTypeIndex]['name'] = array();
foreach ($this->objOutput->getObjectRender()->languages as $idLang) {
$dateAriInfo['room_types'][$roomTypeIndex]['name'][] = array(
'id' => $idLang,
'value' => $objRoomType->name[$idLang]
);
}
// if only one lang than do not set name as array and set only value of the room
if (count($dateAriInfo['room_types'][$roomTypeIndex]['name']) == 1) {
$dateAriInfo['room_types'][$roomTypeIndex]['name'] = $dateAriInfo['room_types'][$roomTypeIndex]['name'][0]['value'];
}
// rooms info of the room type
if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) {
$dateAriInfo['room_types'][$roomTypeIndex]['rooms'] = array();
foreach ($roomTypeInfo['data'] as $key => $roomsInfo) {
$roomsAriInfo = array();
if ($key == 'available') {
$keyRoomAvailability = 'available';
} elseif ($key == 'unavailable') {
$keyRoomAvailability = 'unavailable';
} elseif ($key == 'booked') {
$keyRoomAvailability = 'booked';
} elseif ($key == 'partially_available') {
$keyRoomAvailability = 'partially_available';
}
if ($roomsInfo) {
if ($key == 'partially_available') {
foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) {
if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) {
$roomsAriInfo[$dateIndex]['date_from'] = $partialRoomsInfo['date_from'];
$roomsAriInfo[$dateIndex]['date_to'] = $partialRoomsInfo['date_to'];
$roomsAriInfo[$dateIndex]['rooms'] = array();
foreach ($partialRoomsInfo['rooms'] as $roomInfo) {
$roomDetail = array();
$roomDetail['id_room'] = $roomInfo['id_room'];
$roomDetail['room_number'] = $roomInfo['room_num'];
$roomsAriInfo[$dateIndex]['rooms'][] = $roomDetail;
}
}
}
} else {
foreach ($roomsInfo as $roomIndex => $roomInfo) {
$roomsAriInfo[$roomIndex]['id_room'] = $roomInfo['id_room'];
$roomsAriInfo[$roomIndex]['room_number'] = $roomInfo['room_num'];
}
}
}
$dateAriInfo['room_types'][$roomTypeIndex]['rooms'][$keyRoomAvailability] = array_values($roomsAriInfo);
}
}
$dateAriInfo['room_types'] = array_values($dateAriInfo['room_types']);
}
}
$ariFormatted[] = $dateAriInfo;
}
}
// change the content to the json form for api response
$ariReponse = [];
if ($dateWiseBreakdown) {
// if date wise breakup is requested the parent node will be 'hotel_aris' as per other APIs in QloApps (orders > order)
$ariReponse['hotel_aris'] = array_values($ariFormatted);
$ariReponse['hotel_aris'] = array_values($ariInfoArray);
} else {
$ariReponse['hotel_ari'] = $ariFormatted[0];
$ariReponse['hotel_ari'] = $ariInfoArray[0];
}
$this->output .= json_encode($ariReponse);

View File

@@ -149,11 +149,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$occupancy = array();
}
// $booking_product = 1;
// if (Tools::getisset('booking_product')) {
// $booking_product = Tools::getValue('booking_product');
// }
$this->id_cart = (int) $this->context->cart->id;
$this->id_guest = (int) $this->context->cookie->id_guest;
$this->id_hotel = $id_hotel;
@@ -177,7 +172,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking').'&'.http_build_query($urlData));
}
// Process reallocation of rooms
// Process reallocation of rooms
if (Tools::isSubmit('realloc_allocated_rooms')) {
if ($this->tabAccess['edit'] === '1') {
@@ -204,7 +198,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$this->errors[] = $this->l('Selected room is not available for reallocation.');
} elseif (!in_array($idRoomToReallocate, array_column($availableRooms, 'id_room'))) {
$this->errors[] = $this->l('Selected room is not available for reallocation.');
} elseif (!Validate::isFloat($priceDiff)) {
} elseif (!Validate::isPrice($priceDiff)) {
$this->errors[] = $this->l('Invalid price difference of the room types.');
}
} else {
@@ -379,7 +373,8 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
'link' => $this->context->link
'link' => $this->context->link,
'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL,
));
if (Configuration::get('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {

View File

@@ -121,7 +121,7 @@ $(document).ready(function() {
$('#generateCreditSlip, #generateDiscount').prop('checked', false);
$(this).prop('checked', true);
}
$('#generateCreditSlip').change();
$('#generateCreditSlip, #generateDiscount').change();
});
$(document).on('keyup', '#order_return_form .table input[name^="refund_amounts"]', function() {

View File

@@ -224,7 +224,7 @@
</td>
<td>
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}
<button type="button" class="btn btn-primary room_reallocate_swap" id="reallocate_room_{$rm_dtl_v['id_htl_booking']}" data-room_type_name="{$rm_dtl_v['room_type_name']}" data-id_htl_booking="{$rm_dtl_v['id_htl_booking']}" data-id_order="{$rm_dtl_v['id_order']}" data-room_num='{$booked_v['room_num']}' data-currency_sign='{$rm_dtl_v['currency_sign']}' data-id_room_type='{$booked_v['id_product']}' data-cust_name='{$rm_dtl_v['alloted_cust_name']}' data-cust_email='{$rm_dtl_v['alloted_cust_email']}' data-avail_rm_swap='{$rm_dtl_v['avail_rooms_to_swap']|@json_encode}' data-avail_realloc_room_types='{$rm_dtl_v['avail_room_types_to_realloc']|@json_encode}' data-allotment_type_label='{if $rm_dtl_v['booking_type'] == $ALLOTMENT_MANUAL}{l s='Manual'}{else}{l s='Auto'}{/if}' data-comment='{$rm_dtl_v.comment}'>
<button type="button" class="btn btn-primary room_reallocate_swap" id="reallocate_room_{$rm_dtl_v.id_htl_booking}" data-room_type_name="{$rm_dtl_v.room_type_name}" data-id_htl_booking="{$rm_dtl_v.id_htl_booking}" data-id_order="{$rm_dtl_v.id_order}" data-room_num="{$booked_v.room_num}" data-currency_sign="{$rm_dtl_v.currency_sign}" data-id_room_type="{$booked_v.id_product}" data-cust_name="{$rm_dtl_v.alloted_cust_name}" data-cust_email="{$rm_dtl_v.alloted_cust_email}" data-avail_rm_swap='{$rm_dtl_v.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$rm_dtl_v.avail_room_types_to_realloc|@json_encode}' data-allotment_type_label="{if $rm_dtl_v.booking_type == $ALLOTMENT_MANUAL}{l s='Manual'}{else}{l s='Auto'}{/if}" data-comment="{$rm_dtl_v.comment}">
{l s='Reallocate Room' mod='hotelreservationsystem'}
</button>
{else}

View File

@@ -87,8 +87,8 @@ $(document).ready(function()
values: [min_price, max_price],
slide: function(event, ui)
{
$("#filter_price_from").html(ui.values[0]);
$("#filter_price_to").html(ui.values[1]);
$("#filter_price_from").html(formatCurrency(ui.values[0], currencyFormat, currencySign, currencyBlank));
$("#filter_price_to").html(formatCurrency(ui.values[1], currencyFormat, currencySign, currencyBlank));
},
change: function(event, ui)
{

View File

@@ -54,8 +54,8 @@
</div>
<div class="col-sm-12 lf_sub_cont">
<div class="row margin-lr-0 price_filter_subcont">
<span class="pull-left">{$currency->prefix} <span id="filter_price_from">{$min_price}</span> {$currency->suffix}</span>
<span class="pull-right">{$currency->prefix} <span id="filter_price_to">{$max_price}</span> {$currency->suffix}</span>
<span class="pull-left"><span id="filter_price_from">{displayPrice price=$min_price}</span></span>
<span class="pull-right"><span id="filter_price_to">{displayPrice price=$max_price}</span></span>
</div>
<div id="filter_price_silder"></div>
</div>

View File

@@ -199,7 +199,7 @@ class wkhotelfilterblock extends Module
$prod_price = array();
if ($room_types) {
foreach ($room_types as $key => $value) {
$prod_price[] = Product::getPriceStatic($value['id_product'], HotelBookingDetail::useTax());
$prod_price[] = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, HotelBookingDetail::useTax());
}
}

View File

@@ -27,11 +27,11 @@
<thead>
<tr>
<th class="product header small" width="30%">{l s='Room Type / Reference' pdf='true'}</th>
<th class="product header small" width="30%">{l s='Duration' pdf='true'}</th>
<th class="product header small" width="35%">{l s='Room Type / Reference' pdf='true'}</th>
<th class="product header small" width="35%">{l s='Duration' pdf='true'}</th>
<th class="product header small" width="10%">{l s='Num rooms' pdf='true'}</th>
<th class="product header-right small" width="15%">{l s='Unit price' pdf='true'}<br />{if $tax_excluded_display}{l s='(Tax Excl.)' pdf='true'}{else}{l s='(Tax Incl.)' pdf='true'}{/if}</th>
<th class="product header-right small" width="15%">{l s='Price' pdf='true'}<br />{if $tax_excluded_display}{l s='(Tax Excl.)' pdf='true'}{else}{l s='(Tax Incl.)' pdf='true'}{/if}</th>
{* <th class="product header-right small" width="15%">{l s='Unit price' pdf='true'}<br />{if $tax_excluded_display}{l s='(Tax Excl.)' pdf='true'}{else}{l s='(Tax Incl.)' pdf='true'}{/if}</th> *}
<th class="product header-right small" width="20%">{l s='Total Price' pdf='true'}<br />{if $tax_excluded_display}{l s='(Tax Excl.)' pdf='true'}{else}{l s='(Tax Incl.)' pdf='true'}{/if}</th>
</tr>
</thead>
@@ -55,13 +55,13 @@
<td class="product center">
{$order_detail.num_rooms}
</td>
<td class="product right">
{* <td class="product right">
{if $tax_excluded_display}
- {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
{else}
- {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_incl}
{/if}
</td>
</td> *}
<td class="product right">
{if $tax_excluded_display}
- {displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl}

View File

@@ -18,87 +18,89 @@
*}
{hook h='displayRoomTypeListBefore'}
{if isset($booking_data['rm_data']) && $booking_data['rm_data']}
{if isset($booking_data['stats']) && $booking_data['stats']['num_avail']}
{foreach from=$booking_data['rm_data'] key=room_k item=room_v}
<div class="col-sm-12 room_cont" data-id-product="{$room_v['id_product']|escape:'htmlall':'UTF-8'}">
<div class="row">
<div class="col-sm-4">
<a href="{$room_v['product_link']|escape:'htmlall':'UTF-8'}">
<img src="{$room_v['image']|escape:'htmlall':'UTF-8'}" class="img-responsive room-type-image">
{hook h='displayRoomTypeListImageAfter' product=$room_v}
</a>
</div>
<div class="col-sm-8 room_info_cont">
<div class="row">
<p class="rm_heading col-sm-12 col-md-7">{$room_v['name']|escape:'htmlall':'UTF-8'}</p>
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
<p class="rm_left col-sm-12 col-md-5" {if $room_v['room_left']>$warning_num} style="display:none"{/if}>
{l s='Hurry!'} <span class="remain_rm_qty">{$room_v['room_left']|escape:'htmlall':'UTF-8'}</span> {l s='rooms left'}
</p>
{/if}
{if $room_v['data']['available']|count}
<div class="col-sm-12 room_cont" data-id-product="{$room_v['id_product']|escape:'htmlall':'UTF-8'}">
<div class="row">
<div class="col-sm-4">
<a href="{$room_v['product_link']|escape:'htmlall':'UTF-8'}">
<img src="{$room_v['image']|escape:'htmlall':'UTF-8'}" class="img-responsive room-type-image">
{hook h='displayRoomTypeListImageAfter' product=$room_v}
</a>
</div>
<div class="rm_desc">{$room_v['description']|truncate:190:"":true}&nbsp;<a class="view_more" href="{$room_v['product_link']|escape:'htmlall':'UTF-8'}">{l s='View More'}....</a></div>
<div class="room_features_cont">
<div class="col-sm-8 room_info_cont">
<div class="row">
<div class="col-sm-12 col-md-5 col-lg-6">
{if !empty($room_v['feature'])}
<p class="rm_amenities_cont">
{foreach from=$room_v['feature'] key=feat_k item=feat_v}
<img title="{$feat_v.name|escape:'htmlall':'UTF-8'}" src="{$link->getMediaLink("`$feat_img_dir`{$feat_v.value}")|escape:'htmlall':'UTF-8'}" class="rm_amen">
{/foreach}
</p>
{/if}
</div>
<div class="col-sm-12 hidden-md hidden-lg">
<p class="capa_txt"><span>{$room_v['max_guests']|escape:'htmlall':'UTF-8'} {l s='Max guests:'}</span><span class="capa_data"> {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {if $room_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}</span></p>
</div>
<div class="col-sm-12 col-md-7 col-lg-6">
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
<p class="rm_price_cont">
{if $room_v['feature_price_diff'] >= 0}
<span class="rm_price_val {if $room_v['feature_price_diff']>0}room_type_old_price{/if}">
{displayPrice price = $room_v['price_without_reduction_with_auto_add']|round:2|floatVal}
</span>
{/if}
{if $room_v['feature_price_diff']}
<span class="rm_price_val">
{displayPrice price = $room_v['feature_price']|round:2|floatVal}
</span>
{/if}
<span class="rm_price_txt">/{l s='Per Night'}</span>
</p>
{/if}
</div>
<p class="rm_heading col-sm-12 col-md-7">{$room_v['name']|escape:'htmlall':'UTF-8'}</p>
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
<p class="rm_left col-sm-12 col-md-5" {if $room_v['room_left'] > $warning_num} style="display:none"{/if}>
{l s='Hurry!'} <span class="remain_rm_qty">{$room_v['room_left']|escape:'htmlall':'UTF-8'}</span> {l s='rooms left'}
</p>
{/if}
</div>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4 visible-md visible-lg">
<div class="capa_txt"><span>{$room_v['max_guests']|escape:'htmlall':'UTF-8'} {l s='Max guests:'}</span><br><span class="capa_data"> {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {if $room_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}</span></div>
</div>
<div class="col-sm-12 col-md-6 col-lg-8">
<div class="booking_room_fields">
<div class="rm_desc">{$room_v['description_short']|truncate:190:"":true}&nbsp;<a class="view_more" href="{$room_v['product_link']|escape:'htmlall':'UTF-8'}">{l s='View More'}....</a></div>
<div class="room_features_cont">
<div class="row">
<div class="col-sm-12 col-md-5 col-lg-6">
{if !empty($room_v['feature'])}
<p class="rm_amenities_cont">
{foreach from=$room_v['feature'] key=feat_k item=feat_v}
<img title="{$feat_v.name|escape:'htmlall':'UTF-8'}" src="{$link->getMediaLink("`$feat_img_dir`{$feat_v.value}")|escape:'htmlall':'UTF-8'}" class="rm_amen">
{/foreach}
</p>
{/if}
</div>
<div class="col-sm-12 hidden-md hidden-lg">
<p class="capa_txt"><span>{$room_v['max_guests']|escape:'htmlall':'UTF-8'} {l s='Max guests:'}</span><span class="capa_data"> {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {if $room_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}</span></p>
</div>
<div class="col-sm-12 col-md-7 col-lg-6">
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
{if isset($occupancy_required_for_booking) && $occupancy_required_for_booking}
<div class="booking_guest_occupancy_conatiner">
{include file="./occupancy_field.tpl" room_type_info=$room_v total_available_rooms=$room_v['room_left']}
</div>
{else}
<p class="rm_price_cont">
{if $room_v['feature_price_diff'] >= 0}
<span class="rm_price_val {if $room_v['feature_price_diff']>0}room_type_old_price{/if}">
{displayPrice price = $room_v['price_without_reduction']|round:2|floatVal}
</span>
{/if}
{if $room_v['feature_price_diff']}
<span class="rm_price_val">
{displayPrice price = $room_v['feature_price']|round:2|floatVal}
</span>
{/if}
<span class="rm_price_txt">/{l s='Per Night'}</span>
</p>
{/if}
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4 visible-md visible-lg">
<div class="capa_txt"><span>{$room_v['max_guests']|escape:'htmlall':'UTF-8'} {l s='Max guests:'}</span><br><span class="capa_data"> {$room_v['max_adults']|escape:'htmlall':'UTF-8'} {l s='Adults'}, {$room_v['max_children']|escape:'htmlall':'UTF-8'} {if $room_v['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}</span></div>
</div>
<div class="col-sm-12 col-md-6 col-lg-8">
<div class="booking_room_fields">
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
{if isset($occupancy_required_for_booking) && $occupancy_required_for_booking}
<div class="booking_guest_occupancy_conatiner">
{include file="./occupancy_field.tpl" room_type_info=$room_v total_available_rooms=$room_v['room_left']}
</div>
{else}
<div>
<label>{l s='Qty:'}</label>
{include file="./quantity_field.tpl" total_available_rooms=$room_v['room_left']}
</div>
{/if}
<div>
<label>{l s='Qty:'}</label>
{include file="./quantity_field.tpl" total_available_rooms=$room_v['room_left']}
<a cat_rm_check_in="{$booking_date_from|escape:'htmlall':'UTF-8'}" cat_rm_check_out="{$booking_date_to|escape:'htmlall':'UTF-8'}" href="" rm_product_id="{$room_v['id_product']}" cat_rm_book_nm_days="{$num_days|escape:'htmlall':'UTF-8'}" data-id-product-attribute="0" data-id-product="{$room_v['id_product']|intval}" class="btn btn-default button button-medium ajax_add_to_cart_button"><span>{l s='Book Now'}</span></a>
</div>
{/if}
<div>
<a cat_rm_check_in="{$booking_date_from|escape:'htmlall':'UTF-8'}" cat_rm_check_out="{$booking_date_to|escape:'htmlall':'UTF-8'}" href="" rm_product_id="{$room_v['id_product']}" cat_rm_book_nm_days="{$num_days|escape:'htmlall':'UTF-8'}" data-id-product-attribute="0" data-id-product="{$room_v['id_product']|intval}" class="btn btn-default button button-medium ajax_add_to_cart_button"><span>{l s='Book Now'}</span></a>
</div>
{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/if}
{/foreach}
{else}
<div class="noRoomsAvailAlert">

View File

@@ -438,6 +438,12 @@
margin-top: 10px;
margin-bottom: 10px;
}
#order-opc .cart_total_detail_block hr {
margin: 9px 0;
}
#order-opc .cart_total_detail_block .strong {
font-weight: 600;
}
#order-opc .cart_total_detail_block .cart_total_values {
float: right;
}
@@ -445,6 +451,7 @@
color: #459C3D;
}
#order-opc .cart_total_detail_block .cart_final_total_block {
margin-bottom: 0;
line-height: 40px;
}
#order-opc .cart_total_detail_block .cart_final_total_block > .cart_total_values {

View File

@@ -356,7 +356,16 @@
</div> -->
{if isset($total_convenience_fee)}
<div class="layer_cart_row">
<strong class="dark">{l s='Convenience Fees' mod='blockcart'}</strong>
<strong class="dark">
{l s='Convenience Fees' mod='blockcart'}
{if $display_tax_label}
{if $priceDisplay == 1}
{l s='(tax excl.)' mod='blockcart'}
{else}
{l s='(tax incl.)' mod='blockcart'}
{/if}
{/if}
</strong>
<span class="price ajax_cart_convenience_fee pull-right">{convertPrice price=$total_convenience_fee}</span>
</div>
{/if}

View File

@@ -211,18 +211,6 @@
<div class="col-md-4">
{* Total cart details, tax details, advance payment details and voucher details *}
<div class="col-sm-12 card cart_total_detail_block">
{* {if $total_rooms}
<p>
<span>{l s='Total rooms cost'}{if $display_tax_label}{l s=' (tax excl.)'}{/if}</span>
<span class="cart_total_values">{displayPrice price=$total_rooms}</span>
</p>
{/if}
{if (isset($total_extra_demands) && $total_extra_demands) || (isset($total_additional_services) && $total_additional_services)}
<p>
<span>{l s='Total extra services'}{if $display_tax_label}{l s=' (tax excl.)'}{/if}</span>
<span class="cart_total_values">{displayPrice price=($total_extra_demands + $total_additional_services)}</span>
</p>
{/if} *}
{* {if $total_service_products}
<p>
<span>{l s='Total service products cost'}{if $display_tax_label}{l s=' (tax excl.)'}{/if}</span>
@@ -249,6 +237,33 @@
{displayPrice price=$total_rooms_cost}
</span>
</p>
{if $convenience_fee_wt}
<p>
<span>
{l s='Convenience Fees'}
{if $display_tax_label}
{if $use_taxes && $priceDisplay == 0}
{l s='(tax incl)'}
{else}
{l s='(tax excl)'}
{/if}
{/if}
</span>
<span class="cart_total_values">
{if $use_taxes && $priceDisplay == 0}
{displayPrice price=$convenience_fee_wt}
{else}
{displayPrice price=$convenience_fee}
{/if}
</span>
</p>
{/if}
{if $show_taxes}
<p class="cart_total_tax">
<span>{l s='Total tax'}</span>
<span class="cart_total_values">{displayPrice price=($total_tax)}</span>
</p>
{/if}
<p class="total_discount_block {if $total_discounts == 0}unvisible{/if}">
<span>
{if $display_tax_label}
@@ -270,112 +285,30 @@
{displayPrice price=$total_discounts_negative}
</span>
</p>
{* {if $priceDisplay != 0} *}
<p class="cart_total_price {if $total_discounts == 0}unvisible{/if}" >
<span>
{l s='Total'}
{if $display_tax_label}
{if $use_taxes && $priceDisplay == 0}
{l s='(tax incl)'}
{else}
{l s='(tax excl)'}
{/if}
{/if}
</span>
<span class="cart_total_values">
{if $use_taxes && $priceDisplay == 0}
{displayPrice price=$total_price - $convenience_fee_wt}
{else}
{displayPrice price=$total_price_without_tax - $convenience_fee}
{/if}
</span>
</p>
{* {/if} *}
{* {if $total_rooms_wt != 0}
<p class="cart_total_tax">
<span>{l s='Tax on rooms'}</span>
<span class="cart_total_values">{displayPrice price=($total_rooms_wt - $total_rooms)}</span>
</p>
{/if} *}
{if $convenience_fee_wt}
<p>
<span>{l s='Convenience Fees'}</span>
<span class="cart_total_values">
{if $use_taxes && $priceDisplay == 0}
{displayPrice price=$convenience_fee_wt}
{else}
{displayPrice price=$convenience_fee}
{/if}
</span>
</p>
{/if}
{hook h="displayCartTotalPriceLabel" type='before_tax'}
<p class="cart_total_tax">
<span>{l s='Total tax'}</span>
<span class="cart_total_values">{displayPrice price=($total_tax)}</span>
</p>
{* {if $use_taxes && $show_taxes && ($total_extra_demands_wt + $total_additional_services_wt)!= 0 }
<p class="cart_total_tax">
<span>{l s='Tax on services'}</span>
<span class="cart_total_values">{displayPrice price=(($total_extra_demands_wt - $total_extra_demands) + ($total_additional_services_wt - $total_additional_services))}</span>
</p>
{/if} *}
{* {if $use_taxes && $show_taxes && $total_service_products_wt != 0 }
<p class="cart_total_tax">
<span>{l s='Tax on service products'}</span>
<span class="cart_total_values">{displayPrice price=($total_service_products_wt - $total_service_products)}</span>
</p>
{/if} *}
<p {if $total_wrapping == 0}class="unvisible"{/if}>
<span>
<hr>
<p {if !isset($is_advance_payment) || !$is_advance_payment}class="cart_final_total_block"{/if}>
<span class="strong">{l s='Total'}</span>
{hook h="displayCartTotalPriceLabel" type='total'}
<span class="cart_total_values{if isset($is_advance_payment) && $is_advance_payment} strong{/if}">
{if $use_taxes}
{if $display_tax_label}{l s='Total gift wrapping (tax incl.)'}{else}{l s='Total gift-wrapping cost'}{/if}
{displayPrice price=$total_price}
{else}
{l s='Total gift-wrapping cost'}
{/if}
</span>
<span class="cart_total_values">
{if $use_taxes}
{if $priceDisplay}
{displayPrice price=$total_wrapping_tax_exc}
{else}
{displayPrice price=$total_wrapping}
{/if}
{else}
{displayPrice price=$total_wrapping_tax_exc}
{displayPrice price=$total_price_without_tax}
{/if}
</span>
</p>
{if isset($is_advance_payment) && $is_advance_payment}
<p>
<span>{l s='Advance Payment Amount'}</span>
<span class="cart_total_values">{displayPrice price=$advPaymentAmount}</span>
</p>
<hr>
<p>
<span>{l s='Due Amount'}</span>
<span class="cart_total_values">{displayPrice price=$dueAmount}</span>
</p>
{/if}
<p class="cart_final_total_block">
<span>{l s='Final Total'}</span>
{if isset($is_advance_payment) && $is_advance_payment}
<p class="cart_final_total_block">
<span class="strong">{l s='Partially Payable Total'}</span>
{hook h="displayCartTotalPriceLabel" type='partial'}
<span class="cart_total_values">{displayPrice price=$advPaymentAmount}</span>
{else}
<span class="cart_total_values">
{if $use_taxes}
{displayPrice price=$total_price}
{else}
{displayPrice price=$total_price_without_tax}
{/if}
</span>
<div class="hookDisplayProductPriceBlock-price">
{hook h="displayCartTotalPriceLabel"}
</div>
{/if}
</p>
</p>
{/if}
</div>
{* Check if voucher feature is enabled currently *}
{if $voucherAllowed}