Merge branch 'develop' into gli-1471

This commit is contained in:
Abhishek Kumar
2024-03-18 15:01:03 +05:30
93 changed files with 3362 additions and 693 deletions

View File

@@ -42,6 +42,12 @@
right: 0
margin: 0 auto
#customer_cart_details .overbooked_room
background-color: #FF69B4
color: #FFF
padding: 2px 5px
border-radius: 2px
font-weight: 600
.room_status_info_form
.room_status

View File

@@ -11,7 +11,7 @@ $contrasted-lightness-threshold: 10%
$bg-page-head-color : $secondary-color
$bg-panel-heading-color: hsl(hue($secondary-color), 10, 90)
$badge-notif-color: $greenPrestashop
$badge-notif-color: #D27C82
$brand-addons: $pinkPrestashop
$font-family-mono: 'Droid Sans Mono', Helvetica, Arial, sans-serif

View File

@@ -109,7 +109,11 @@ body
.dropdown-menu
line-height: normal
.panel-danger .panel-heading
background-color: $badge-notif-color!important
background-color: #DC143C
color: #FFF
margin: -20px -20px 15px -20px
padding: 0px 10px 0px 10px
form .alert
clear: both
@media (max-width: $screen-phone)

View File

@@ -1,14 +1,90 @@
$kpi-rows-gap: 8px
$kpi-gap: 10px
.kpi-container
padding-bottom: 10px !important
.kpi-refresh
position: absolute
z-index: 1
right: 20px
display: flex
justify-content: space-between
padding: 12px !important
.kpis-wrap
width: 100%
white-space: nowrap
overflow-x: auto
font-size: 0
margin-bottom: -$kpi-rows-gap
display: flex
flex-wrap: wrap
margin-left: -($kpi-gap / 2)
margin-right: -($kpi-gap / 2)
.kpi-wrap
display: inline-block
width: 20%
margin-bottom: $kpi-rows-gap
padding-left: $kpi-gap / 2
padding-right: $kpi-gap / 2
.actions-wrap
width: 16px
margin-left: 16px
button
padding: 0
border: none
opacity: 0.2
display: block
width: 100%
&:not(:first-of-type)
margin-top: 4px
&:hover
opacity: 0.5
background-color: #fff
&:focus,
&:active
outline: none !important
i
color: #000 !important
font-size: 16px
&.icon-ellipsis-vertical
position: relative
top: 3px
.dropdown-menu
top: 25px
right: 0
left: unset
min-width: 200px
font-size: 13px
padding: 8px 12px
label
font-weight: normal
&.no-wrapping
.kpis-wrap
white-space: normal
flex-wrap: nowrap
.kpi-wrap
@media (min-width: $screen-lg)
min-width: 20%
@media (max-width: $screen-lg)
min-width: 20%
@media (max-width: $screen-sm)
min-width: 33.33%
@media (max-width: $screen-xs)
min-width: 50%
@media (max-width: $screen-desktop)
&.no-wrapping
.kpis-wrap
flex-wrap: nowrap !important
@media (max-width: $screen-lg)
.kpi-container .kpis-wrap .kpi-wrap
width: 20%
@media (max-width: $screen-sm)
.kpi-container .kpis-wrap .kpi-wrap
width: 33.33%
@media (max-width: $screen-xs)
.kpi-container .kpis-wrap .kpi-wrap
width: 50%
.box-stats
display: block
height: 64px
margin-bottom: 10px
height: 100%
.boxchart-overlay
@include padding(10px, 10px, 5px, 10px)
@include margin-right(10px)
@@ -16,58 +92,86 @@
@include border-radius(3px)
.kpi-content
width: 100%
height: 100%
position: relative
@include padding-left(40px)
@include float(left)
i
border: 1px solid #e7edfa
border-left-width: 3px
border-radius: 6px
padding: 4px 8px 8px 42px
display: flex
flex-direction: column
justify-content: space-between
white-space: normal
.title-subtitle
display: flex
justify-content: space-between
.title
display: block
color: #666
font-size: 13px
i
position: absolute
top: 5px
font-size: 15px
text-align: center
color: white
line-height: 26px
background: #eee
width: 28px
height: 28px
@include left(5px)
@include border-radius(6px)
&::before
position: absolute
top: 1px
left: 8px
.subtitle
display: block
text-transform: capitalize
color: #aaa
font-size: 10px
position: relative
top: 3px
text-align: right
.value-container
.value
display: block
clear: both
font-size: 14px
font-weight: bold
color: #666
min-height: 22px
&.loading
height: 22px
min-width: 40px
.arrow
position: absolute
top: 0
font-size: 26px
text-align: center
color: white
line-height: 26px
@include left(0)
@include border-radius(3px)
.title
display: block
color: #666
.subtitle
display: block
text-transform: uppercase
color: #aaa
.value
display: block
clear: both
font-size: 1.5em
white-space: nowrap
text-overflow: ellipsis
overflow: hidden
&.loading
height: 1.2em
width: 200px
bottom: 7px
right: 9px
i
color: #828282 !important
&:hover
text-decoration: none
.color1
.kpi-content
border-left-color: #2BA8E3
i, .boxchart-overlay
color: #2BA8E3 !important
.value
color: #2BA8E3
.color2
.kpi-content
border-left-color: #FF5450
i, .boxchart-overlay
color: #FF5450 !important
.value
color: #FF5450
.color3
.kpi-content
border-left-color: #9E5BA1
i, .boxchart-overlay
color: #9E5BA1 !important
.value
color: #9E5BA1
.color4
.kpi-content
border-left-color: #95CC6B
i, .boxchart-overlay
color: #95CC6B !important
.value
color: #95CC6B
.data_chart
rect
@@ -80,4 +184,4 @@
stroke: black
.area
fill: rgba(white,0.30)
stroke-width: 0
stroke-width: 0

View File

@@ -54,7 +54,7 @@
{/if}
<span class="message-date">&nbsp;<i class="icon-calendar"></i> - {dateFormat date=$message.date_add full=0} - <i class="icon-time"></i> {$message.date_add|substr:11:5}</span>
{if isset($message.file_name)} <span class="message-product">&nbsp;<i class="icon-link"></i> <a href="{$message.file_name|escape:'html':'UTF-8'}" class="_blank">{l s="Attachment"}</a></span>{/if}
{if isset($message.product_name)} <span class="message-attachment">&nbsp;<i class="icon-book"></i> <a href="{$message.product_link|escape:'html':'UTF-8'}" class="_blank">{l s="Product:"} {$message.product_name|escape:'html':'UTF-8'} </a></span>{/if}
{if isset($message.product_name)} <span class="message-attachment">&nbsp;<i class="icon-book"></i> <a href="{$message.product_link|escape:'html':'UTF-8'}" class="_blank">{l s="Room type:"} {$message.product_name|escape:'html':'UTF-8'} </a></span>{/if}
<p class="message-item-text">{$message.message|escape:'html':'UTF-8'|nl2br}</p>
</div>
</div>

View File

@@ -64,7 +64,7 @@
<li>
<a id="desc-module-catalog" class="toolbar_btn anchor" href="{$link->getAdminLink('AdminModulesCatalog')}" title="{l s='Recommended Modules and Services'}">
<i class="process-icon-modules-list"></i>
<span>{l s='Recommended Modules and Services'}</span>
<span>{l s='Recommendations'}</span>
</a>
</li>
{if $add_permission eq '1'}

View File

@@ -109,7 +109,7 @@
</div>
</div>
<div class="panel explore-panel text-center">
{l s='Explore all themes of Qloapps'}&nbsp;
{l s='Explore all themes of QloApps'}&nbsp;
<a href="https://store.webkul.com/Qloapps/responsive.html" class="btn btn-primary btn-lg">{l s='QloApps Themes'}</a>
</div>
{/if}

View File

@@ -116,20 +116,20 @@ $(document).ready(function () {
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}</span></div>
<label class="control-label col-lg-2" for="wholesale_price">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The price is the price you paid for the product. Do not include the tax.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Wholesale price'}{else}{l s='Pre-tax wholesale price'}{/if}</span>
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The price is the price you paid for the service. Do not include the tax.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Rack rate'}{else}{l s='Pre-tax rack rate'}{/if}</span>
</label>
<div class="col-lg-2">
<div class="input-group">
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
<input maxlength="27" name="wholesale_price" id="wholesale_price" type="text" value="{{toolsConvertPrice price=$product->wholesale_price}|string_format:$priceDisplayPrecisionFormat}" onchange="this.value = this.value.replace(/,/g, '.');" />
</div>
{if isset($pack) && $pack->isPack($product->id)}<p class="help-block">{l s='The sum of wholesale prices of the product in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackWholesalePrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}</p>{/if}
{if isset($pack) && $pack->isPack($product->id)}<p class="help-block">{l s='The sum of rack rates of the service in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackWholesalePrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}</p>{/if}
</div>
</div>
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="price" type="price"}</span></div>
<label class="control-label col-lg-2" for="priceTE">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The pre-tax retail price is the price for which you intend sell this product to your customers. It should be higher than the pre-tax wholesale price: the difference between the two will be your margin.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Retail price'}{else}{l s='Pre-tax retail price'}{/if}</span>
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The pre-tax retail price is the price for which you intend sell this service to your customers. It should be higher than the pre-tax rack rate: the difference between the two will be your margin.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Retail price'}{else}{l s='Pre-tax retail price'}{/if}</span>
</label>
<div class="col-lg-2">
<div class="input-group">

View File

@@ -24,4 +24,9 @@
*}
{extends file="helpers/options/options.tpl"}
{block name="after"}<script type="text/javascript">changeCMSActivationAuthorization();</script>{/block}
{block name="after"}
<script type="text/javascript">
changeCMSActivationAuthorization();
changeOverbookingOrderAction();
</script>
{/block}

View File

@@ -0,0 +1,93 @@
{*
* 2010-2023 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright 2010-2023 Webkul IN
* @license https://store.webkul.com/license.html
*}
{if isset($orderOverBookings) && $orderOverBookings}
<div class="panel panel-danger">
<div class="panel-heading">
<i class="icon-warning"></i> {l s='Overbookings found in this order !!'}
</div>
<div class="panel-content">
<div class="table-responsive form-group">
<table class="table table-striped">
<tr>
<th>{l s='Room No.'}</th>
<th>{l s='Room type.'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Occupancy'}</th>
<th>{l s='Confirmed booking order'}</th>
<th>{l s='Reallocate/Swap'}</th>
<th>{l s='Resolve'}</th>
</tr>
{foreach from=$orderOverBookings item=data}
{if !$data.is_refunded}
<tr>
<td>{$data['room_num']}</td>
<td>{$data['room_type_name']}</td>
<td>{dateFormat date=$data['date_from']} {l s='To'} {dateFormat date=$data['date_to']}</td>
<td>
{if $order->with_occupancy && $data['children']}
<div class="dropdown booking_occupancy_show">
<button class="btn btn-default btn-left btn-block" data-toggle="dropdown" type="button">
<span>{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}</span>
</button>
<div class="dropdown-menu well well-sm">
<label>{l s='Children Ages'}</label>
{if isset($data['child_ages']) && $data['child_ages']}
{foreach $data['child_ages'] as $childAge}
<p class="">
{l s='Child %s : %s years' sprintf=[$childAge@iteration, $childAge]}
</p>
{/foreach}
{/if}
</div>
</div>
{else}
<span class="booking_occupancy_show">{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}</span>
{/if}
</td>
<td>
{if isset($data['booked_room_info']['id_order']) && $data['booked_room_info']['id_order']}
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$data['booked_room_info']['id_order']}">#{$data['booked_room_info']['id_order']}</a>
{else}
{l s='N/A'}
{/if}
</td>
<td>
<a href="#" class="btn btn-default reallocate_overbooking" id_htl_booking="{$data['id']}"><i class="icon-refresh"></i> {l s='Reallocate/Swap Room'}</a>
</td>
<td>
{if isset($data['booked_room_info']) && $data['booked_room_info']}
<span class="badge badge-information">{l s='Already booked'}</span>
{else}
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$data['id_order']}&amp;resolve_overbooking={$data['id']}" class="btn btn-default resolve_overbooking" id_htl_booking="{$data['id']}"><i class="icon-refresh"></i> {l s='Resolve'}</a>
{/if}
</td>
</tr>
{/if}
{/foreach}
</table>
</div>
<div class="help-block">
<p>- {l s='You can resolve room overbooking with \'Resolve\' column only when the overbooked room is now free for booked duration.'}</p>
<p>- {l s='You can also reallocate an overbooked room with an available room to resolve room\'s overbooking.'}</p>
</div>
</div>
</div>
{/if}

View File

@@ -30,7 +30,10 @@
</td>
{/if}
<td class="text-center">
{$data.room_num}
<p>{$data.room_num}</p>
{if $data.is_back_order}
<span class="overbooked_room">{l s='overbooked'}</span>
{/if}
</td>
<td class="text-center">
<img src="{$data.image_link}" title="Room image" />

View File

@@ -0,0 +1,77 @@
{*
* 2010-2023 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright 2010-2023 Webkul IN
* @license https://store.webkul.com/license.html
*}
{if isset($resolvableOverBookings) && $resolvableOverBookings}
<div class="panel">
<div class="panel-heading">
<i class="icon-refresh"></i> {l s='Resolvable Overbookings'}
</div>
<div class="panel-content">
{if isset($smarty.get.resolvable_overbooked_orders) && $smarty.get.resolvable_overbooked_orders}
<div class="alert alert-warning">
<b>{l s='Orders with resolvable overbookings are filtered.'} <a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}" class="btn btn-warning"><i class="icon-refresh"></i> {l s='See all orders'}</a></b>
</div>
{/if}
<div class="alert alert-info">
<p>{l s='Some overbookings are now available to be resolved. You can directly resolve overbookings from below list as per your choice.'}</p>
{if !isset($smarty.get.resolvable_overbooked_orders) || !$smarty.get.resolvable_overbooked_orders}
<br>
<p>{l s='You can also filter orders which overbookings are now available to be resolved.'} <a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;resolvable_overbooked_orders=1" class="btn btn-default"><i class="icon-search"></i> {l s='Filter orders with resolvable overbookings'}</a></p>
{/if}
</div>
<div class="table-responsive form-group">
<table class="table table-striped">
<tr>
<th>{l s='Room No.'}</th>
<th>{l s='Room type'}</th>
<th>{l s='Hotel'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Order'}</th>
<th>{l s='Resolve'}</th>
</tr>
{foreach from=$resolvableOverBookings item=data}
{if !$data.is_refunded}
<tr>
<td>{$data['room_num']}</td>
<td>
<a href="{$link->getAdminLink('AdminProducts')}&amp;id_product={$data['id_product']|escape:'html':'UTF-8'}&amp;updateproduct">{$data['room_type_name']|escape:'html':'UTF-8'}</a>
</td>
<td>
<a href="{$link->getAdminLink('AdminAddHotel')}&amp;id={$data['id_hotel']|escape:'html':'UTF-8'}&amp;updatehtl_branch_info" target="_blank"><span>{$data['hotel_name']}</span></a>
</td>
<td>{dateFormat date=$data['date_from']|escape:'html':'UTF-8'} {l s='To'} {dateFormat date=$data['date_to']|escape:'html':'UTF-8'}</td>
<td>
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$data['id_order']|escape:'html':'UTF-8'}">#{$data['id_order']|escape:'html':'UTF-8'}</a>
</td>
<td>
{if isset($data['booked_room_info']) && $data['booked_room_info']}
<span class="badge badge-information">{l s='Already booked'}</span>
{else}
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;resolve_overbooking={$data['id']|escape:'html':'UTF-8'}" class="btn btn-default resolve_overbooking" id_htl_booking="{$data['id']|escape:'html':'UTF-8'}"><i class="icon-refresh"></i> {l s='Resolve'}</a>
{/if}
</td>
</tr>
{/if}
{/foreach}
</table>
</div>
</div>
</div>
{/if}

View File

@@ -40,13 +40,16 @@
{if isset($extraDemands) && $extraDemands}
{foreach $extraDemands as $roomDemand}
{foreach $roomDemand['extra_demands'] as $demand}
<tr>
<tr data-id_booking_demand="{$demand['id_booking_demand']}">
<td>{$demand['name']}</td>
<td>
{displayPrice price=$demand['unit_price_tax_excl'] currency=$orderCurrency}
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
{l s='/ night'}
{/if}
<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)}">
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
</div>
</td>
<td>{displayPrice price=$demand['total_price_tax_excl'] currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del-order-room-demand" href="#" id_booking_demand="{$demand['id_booking_demand']}"><i class="icon-trash"></i></a></td>
@@ -74,7 +77,7 @@
<th></th>
<th>{l s='Name'}</th>
<th>{l s='Option'}</th>
<th class="text-right">{l s='Price'}</th>
<th class="text-right">{l s='Unit Price'}</th>
</tr>
</thead>
<tbody>
@@ -103,12 +106,21 @@
{/if}
</td>
<td class="text-right">
<span class="extra_demand_option_price">
{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price_tax_excl'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price_tax_excl']|escape:'html':'UTF-8'}{else if isset($demand['adv_option']) && $demand['adv_option']}{convertPrice price = $demand['adv_option'][$demand['adv_option']|@key]['price_tax_excl']}{else}{convertPrice price = $demand['price_tax_excl']|escape:'html':'UTF-8'}{/if}
</span>
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
{l s='/ night'}
{/if}
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price_tax_excl'])}
{assign var=demand_price value=$demand['adv_option'][$selected_adv_option]['price_tax_excl']}
{else if isset($demand['adv_option']) && $demand['adv_option']}
{assign var=demand_price value=$demand['adv_option'][$demand['adv_option']|@key]['price_tax_excl']}
{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']}">
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
</div>
</td>
</tr>
{/foreach}

View File

@@ -31,8 +31,8 @@
<thead>
<tr>
<th>{l s='Name'}</th>
<th></th>
<th class="fixed-width-md">{l s='Quantity'}</th>
<th class="fixed-width-sm"></th>
<th class="fixed-width-sm">{l s='Quantity'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Total Price'}</th>
<th class="text-right">{l s='Action'}</th>
@@ -41,7 +41,7 @@
<tbody>
{if isset($additionalServices) && $additionalServices}
{foreach $additionalServices['additional_services'] as $service}
<tr class="room_demand_block">
<tr class="room_demand_block" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}">
<td>
<div>{$service['name']|escape:'html':'UTF-8'}</div>
</td>
@@ -53,10 +53,10 @@
<span class="badge badge-info label">{l s='Convenience fee'}</span>
{/if}
</td>
<td class="col-sm-4">
<td>
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" data-max-quantity="{$service['max_quantity']}" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
<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>
@@ -66,10 +66,16 @@
{/if}
</td>
<td>
{displayPrice price=$service['unit_price_tax_excl'] currency=$orderCurrency}
{if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY}
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
<input type="text" class="form-control unit_price" value="{Tools::ps_round($service['unit_price_tax_excl'], 2)}" data-id-product="{$product['id_product']}">
{if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.product_price_calculation_method}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
</div>
{* {if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY}
{l s='/ night'}
{/if}
{/if} *}
</td>
<td>{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}</td>
<td><a class="btn btn-danger pull-right del_room_additional_service" data-id_room_type_service_product_order_detail="{$service['id_room_type_service_product_order_detail']}" href="#"><i class="icon-trash"></i></a></td>
@@ -93,9 +99,9 @@
<tr>
<th></th>
<th>{l s='Name'}</th>
<th></th>
<th class="fixed-width-md">{l s='Quantity'}</th>
<th class="text-right">{l s='Price'}</th>
<th class="fixed-width-sm"> </th>
<th class="fixed-width-sm">{l s='Quantity'}</th>
<th>{l s='Unit Price'}</th>
</tr>
</thead>
<tbody>
@@ -125,10 +131,13 @@
{/if}
</td>
<td class="text-right">
{convertPrice price=$product['price_tax_exc']}
{if $product['price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY}
{l s='/ night'}
{/if}
<div class="input-group">
<span class="input-group-addon">{$currencySign}</span>
<input type="text" class="form-control unit_price" name="service_price[{$product['id_product']|escape:'html':'UTF-8'}]" value="{$product['price_tax_exc']}" data-id-product="{$product.id_product}">
{if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']}
<span class="input-group-addon">{l s='/ night'}</span>
{/if}
</div>
</td>
</tr>
{/foreach}

View File

@@ -68,43 +68,9 @@
<div>{$hook_invoice}</div>
{/if}
<div class="panel kpi-container">
<div class="row">
<div class="col-xs-6 col-sm-3 box-stats color3" >
<div class="kpi-content">
<i class="icon-calendar-empty"></i>
<span class="title">{l s='Date'}</span>
<span class="value">{dateFormat date=$order->date_add full=false}</span>
</div>
</div>
<div class="col-xs-6 col-sm-3 box-stats color4" >
<div class="kpi-content">
<i class="icon-money"></i>
<span class="title">{l s='Total'}</span>
<span class="value">{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}</span>
</div>
</div>
<div class="col-xs-6 col-sm-3 box-stats color2" >
<div class="kpi-content">
<i class="icon-comments"></i>
<span class="title">{l s='Messages'}</span>
<span class="value"><a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&amp;id_order={$order->id|intval}">{sizeof($customer_thread_message)}</a></span>
</div>
</div>
<div class="col-xs-6 col-sm-3 box-stats color1" >
<a href="#start_products">
<div class="kpi-content">
<i class="icon icon-home"></i>
<!-- Original -->
<!-- <span class="title">{l s='Total'}</span>
<span class="value">{sizeof($products)}</span> -->
<span class="title">{l s='Total Rooms'}</span>
<span class="value">{$order_detail_data|@count}</span>
</div>
</a>
</div>
</div>
</div>
{* Overbookings information of the order *}
{include file='controllers/orders/_overbookings.tpl'}
<div class="row">
<div class="col-lg-7">
<div class="panel">
@@ -1830,11 +1796,11 @@
});
$(document).on('focusout', '#rooms_type_extra_demands .room_ordered_services .qty', function(e) {
var qty_wntd = $(this).val();
if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) {
$(this).val(1);
}
updateAdditionalServices($(this));
updateAdditionalServices($(this).closest('tr'));
});
$(document).on('focusout', '#rooms_type_extra_demands .room_ordered_services .unit_price', function(e) {
updateAdditionalServices($(this).closest('tr'));
});
$(document).on('focusout', '#rooms_type_extra_demands #add_room_services_form .qty', function(e) {
@@ -1844,6 +1810,52 @@
}
});
function updateAdditionalServices(element)
{
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');
if ($(element).find('.qty').length) {
var qty = $(element).find('.qty').val();
if (qty == '' || !$.isNumeric(qty) || qty < 1) {
$(element).find('.qty').val(1);
qty = 1;
}
} else {
var qty = 1;
}
var unit_price = $(element).find('.unit_price').val();
if ($.isNumeric(qty)) {
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: {
id_room_type_service_product_order_detail: id_room_type_service_product_order_detail,
qty: qty,
unit_price: unit_price,
action: 'updateRoomAdditionalServices',
ajax: true
},
success: function(jsonData) {
if (!jsonData.hasError) {
if (jsonData.service_panel) {
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
}
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
}
}
$(document).on('submit', '#add_room_services_form', function(e) {
e.preventDefault();
var form_data = new FormData(this);
@@ -1885,7 +1897,8 @@
$(this).closest('#room_extra_demand_content').find('input:checkbox.id_room_type_demand:checked').each(function () {
roomDemands.push({
'id_global_demand':$(this).val(),
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
'id_option': $(this).closest('.room_demand_block').find('.id_option').val(),
'unit_price': $(this).closest('.room_demand_block').find('.unit_price').val()
});
});
@@ -1901,15 +1914,17 @@
data: {
id_htl_booking: idHtlBooking,
room_demands: JSON.stringify(roomDemands),
action: 'EditRoomExtraDemands',
action: 'addRoomExtraDemands',
ajax: true
},
success: function(jsonData) {
if (jsonData.success) {
if (!jsonData.hasError) {
showSuccessMessage(txtExtraDemandSucc);
if (jsonData.facilities_panel) {
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
}
} else if (jsonData.errors) {
showErrorMessage(jsonData.errors);
} else {
showErrorMessage(txtSomeErr);
}
@@ -1921,6 +1936,44 @@
}
});
{* edit room extra demand*}
$(document).on('focusout', '#rooms_type_extra_demands .room_ordered_demands .unit_price', function(e) {
updateRoomDemand($(this).closest('tr'));
});
function updateRoomDemand(element)
{
var id_booking_demand = $(element).data('id_booking_demand');
var unit_price = $(element).find('.unit_price').val();
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
dataType: 'JSON',
cache: false,
data: {
id_booking_demand: id_booking_demand,
unit_price: unit_price,
action: 'updateRoomExtraDemands',
ajax: true
},
success: function(jsonData) {
if (!jsonData.hasError) {
if (jsonData.facilities_panel) {
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
}
showSuccessMessage(txtExtraDemandSucc);
} else {
showErrorMessage(jsonData.errors);
}
}
});
}
{* Delete ordered room booking demand *}
$(document).on('click', '.del-order-room-demand', function(e) {
e.preventDefault();
@@ -2001,8 +2054,8 @@
var option_selected = $(this).find('option:selected');
var extra_demand_price = option_selected.attr("optionPrice")
extra_demand_price = parseFloat(extra_demand_price);
extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
$(this).closest('.room_demand_block').find('.extra_demand_option_price').text(extra_demand_price);
// extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
$(this).closest('.room_demand_block').find('.unit_price').val(extra_demand_price);
});
$('#mySwappigModal').on('hidden.bs.modal', function (e)

View File

@@ -24,7 +24,7 @@
<i class="icon-user"></i> {l s='Room Type Additional Facilities'}
</div>
<div class="alert alert-info">
{l s='To create new Additional facilities'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='click here.'}</a>
{l s='To create new additional facilities please visit'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities'}</a> {l s='page.'}
</div>
{if isset($allDemands) && $allDemands}
@@ -148,10 +148,6 @@
{l s='Save and stay'}
</button>
</div>
{else}
<div class="alert alert-warning">
{l s='No additional facilities created yet. To create please visit'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities'}</a> {l s='page'}.
</div>
{/if}
</div>
{/if}

View File

@@ -23,23 +23,39 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<{if isset($href) && $href}a style="display:block" href="{$href|escape:'html':'UTF-8'}"{else}div{/if} id="{$id|escape:'html':'UTF-8'}" data-toggle="tooltip" class="box-stats label-tooltip {$color|escape}" data-original-title="{$tooltip|escape}">
<{if isset($href) && $href}a style="display:block" href="{$href|escape:'html':'UTF-8'}"{else}div{/if} id="{$id|escape:'html':'UTF-8'}" data-toggle="tooltip" class="box-stats label-tooltip {$color|escape}" data-original-title="{$tooltip|escape}" {if $target}target="_blank"{/if}>
<div class="kpi-content">
{if isset($icon) && $icon}
<i class="{$icon|escape}"></i>
{/if}
<span class="title">{$title|escape}</span>
<span cLass="subtitle">{$subtitle|escape}</span>
<div class="title-subtitle">
<div class="title-container">
<span class="title">
{if isset($icon) && $icon}<i class="{$icon|escape}"></i>{/if}
{$title|escape}
</span>
</div>
{if $subtitle}
<div class="subtitle-container">
<span class="subtitle">
{$subtitle|escape}
</span>
</div>
{/if}
</div>
{if isset($chart) && $chart}
<div class="boxchart-overlay">
<div class="boxchart">
</div>
</div>
{/if}
{if isset($source) && $source}
<span class="value skeleton-loading-wave loading-container-bar loading"></span>
{elseif isset($value) && $value != ''}
<span class="value">{$value|escape:'html':'UTF-8'}</span>
<div class="value-container">
{if isset($source) && $source}
<span class="value skeleton-loading-wave loading-container-bar loading"></span>
{elseif isset($value) && $value !== ''}
<span class="value">{$value|escape:'html':'UTF-8'}</span>
{/if}
</div>
{if isset($href) && $href}
<span class="arrow"><i class="icon-angle-right"></i></span>
{/if}
</div>
</{if isset($href) && $href}a{else}div{/if}>

View File

@@ -22,20 +22,42 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="panel kpi-container">
{if $refresh}
<div class="kpi-refresh"><button class="close refresh" type="button" onclick="refresh_kpis();"><i class="process-icon-refresh" style="font-size:1em"></i></button></div>
{/if}
{if ($kpis|count) > 0}
<div class="row">
{assign var='col' value=(int)(12 / $kpis|count)}
{foreach from=$kpis item=i name=kpi}
{if $smarty.foreach.kpi.iteration > $col+1}
</div>
<div class="row">
{/if}
<div class="col-sm-6 col-lg-{$col}">{$i}</div>
<div class="panel kpi-container{if isset($no_wrapping) && $no_wrapping} no-wrapping{/if}">
<div class="kpis-wrap">
{foreach from=$kpis item=kpi}
<div class="kpi-wrap"{if isset($kpi->visible) && !$kpi->visible}style="display: none;"{/if}>
{$kpi->generate()}
</div>
{/foreach}
</div>
{/if}
<div class="actions-wrap">
{if $refresh}
<button class="btn btn-default" type="button" onclick="refresh_kpis();" title="{l s='Refresh'}">
<i class="icon-refresh"></i>
</button>
{/if}
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" title="{l s='Select KPIs'}">
<i class="icon-ellipsis-vertical"></i>
</button>
<ul class="dropdown-menu">
{foreach from=$kpis item=kpi}
<li>
<label>
<input type="checkbox" class="kpi-display-toggle" data-kpi-id="{$kpi->id}" {if $kpi->visible}checked {if $count_visible == 1}disabled{/if}{/if}>
{$kpi->title}
</label>
</li>
{/foreach}
</ul>
</div>
<button class="btn btn-default" type="button" onclick="toggleKpiView();" title="{l s='Toggle View'}">
<i class="icon-retweet"></i>
</button>
</div>
</div>

View File

@@ -54,7 +54,7 @@
<div class="alert alert-warning">
{if $controller_name == 'AdminPayment'}
{l s='It seems there are no recommended payment solutions for your country.'}<br />
<a class="_blank" href="https://www.prestashop.com/en/contact-us">{l s='Do you think there should be one? Let us know!'}</a>
<a class="_blank" href="https://qloapps.com/contact/">{l s='Do you think there should be one? Let us know!'}</a>
{else}{l s='No modules available in this section.'}{/if}</div>
</td>
</tr>

View File

@@ -761,15 +761,16 @@ abstract class PaymentModuleCore extends Module
// update order in htl tables
$objRoomType = new HotelRoomType();
$objAdvancedPayment = new HotelAdvancedPayment();
$objCartBookingData = new HotelCartBookingData();
$objBookingDetail = new HotelBookingDetail();
$vatAddress = new Address((int)$order->id_address_tax);
$idLang = (int)$this->context->cart->id_lang;
$normalProducts = array();
// variable to check max overbookings are created in the room in any date of the booking duration
$maxOverbookingCount = 0;
foreach ($order->product_list as $product) {
$objCartBookingData = new HotelCartBookingData();
$idProduct = $product['id_product'];
$cartBookingData = $objCartBookingData->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $idProduct);
if ($cartBookingData) {
@@ -777,8 +778,67 @@ abstract class PaymentModuleCore extends Module
$objCartBookingData = new HotelCartBookingData($bookingInfo['id']);
$objCartBookingData->id_order = $order->id;
$objCartBookingData->id_customer = $this->context->customer->id;
// check if still room available for this booking or not
$isRoomOverBooked = 1;
// get all the available rooms right now
$bookingParams = array(
'date_from' => $objCartBookingData->date_from,
'date_to' => $objCartBookingData->date_to,
'hotel_id' => $objCartBookingData->id_hotel,
'id_room_type' => $idProduct,
'only_search_data' => 1
);
if ($searchRoomsInfo = $objBookingDetail->getBookingData($bookingParams)) {
if (isset($searchRoomsInfo['rm_data'][$idProduct]['data']['available'])
&& $searchRoomsInfo['rm_data'][$idProduct]['data']['available']
) {
$availableRoomsInfo = $searchRoomsInfo['rm_data'][$idProduct]['data']['available'];
if ($roomIdsAvailable = array_column($availableRoomsInfo, 'id_room')) {
// If room is still there in the available rooms list then it is not in back order
if (in_array($objCartBookingData->id_room, $roomIdsAvailable)) {
$isRoomOverBooked = 0;
} else {
$isRoomOverBooked = 1;
foreach ($roomIdsAvailable as $idRoom) {
if ($idRoom != $objCartBookingData->id_room) {
$objCartBookingData->id_room = $idRoom;
$isRoomOverBooked = 0;
break;
}
}
}
}
}
}
// if room is not available right now the set it to back order
if ($isRoomOverBooked) {
$objCartBookingData->is_back_order = 1;
// max overbookings in a room datewise breakup. So that we can know no. of overbookings in every date
if ($roomOverBookings = $objBookingDetail->getOverbookedRooms(
0,
$objCartBookingData->id_hotel,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
0,
1
)) {
// check in the bokking duration what is the max overbookings in ay date in the date range
// replace $maxOverbookingCount with $maxOverbookingsInDate if it is greater
if ($maxOverbookingCount < $roomOverBookings) {
$maxOverbookingCount = $roomOverBookings;
}
}
} else {
$objCartBookingData->is_back_order = 0;
}
$objCartBookingData->save();
// Lets set data to the hotel booking detail table
$objBookingDetail = new HotelBookingDetail();
$id_order_detail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id);
$objBookingDetail->id_product = $idProduct;
@@ -790,12 +850,9 @@ abstract class PaymentModuleCore extends Module
$objBookingDetail->id_customer = $this->context->customer->id;
$objBookingDetail->booking_type = $objCartBookingData->booking_type;
$objBookingDetail->id_status = 1;
$objBookingDetail->is_back_order = $objCartBookingData->is_back_order;
$objBookingDetail->comment = $objCartBookingData->comment;
// For Back Order(Because of cart lock)
if ($objCartBookingData->is_back_order) {
$objBookingDetail->is_back_order = 1;
}
$total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idProduct,
$objCartBookingData->date_from,
@@ -999,10 +1056,39 @@ abstract class PaymentModuleCore extends Module
$new_history->addWithemail(true, $extra_vars);
// Switch to back order if needed
if (Configuration::get('PS_STOCK_MANAGEMENT') && ($order_detail->getStockState() || $order_detail->product_quantity_in_stock <= 0)) {
$objHotelBookingDetail = new HotelBookingDetail();
if ($objHotelBookingDetail->getOverbookedRooms($order->id)) {
$cancelOrder = 0;
// Take overbooking action as per order->overbooking Preferences else set order for cancellation
if (Configuration::get('PS_OVERBOOKING_ORDER_ACTION') == Order::OVERBOOKING_ORDER_CANCEL_ACTION) {
$cancelOrder = 1;
} else {
// check conditions for maximun overbookings allowed for the hotel else set order for cancellation
$maxAllowedOverbookings = Configuration::get('PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY');
// >= condition applied because equal case means already overbooked rooms limit exceeded before this booking
if ($maxAllowedOverbookings && ($maxOverbookingCount >= $maxAllowedOverbookings)) {
$cancelOrder = 1;
}
}
// set order status after all conditions checks
if ($cancelOrder) {
$id_order_state = Configuration::get('PS_OS_CANCELED');
} else {
if ($order->valid) {
if ($order->is_advance_payment && $order->advance_paid_amount < $order->total_paid_tax_incl) {
$id_order_state = Configuration::get('PS_OS_OVERBOOKING_PARTIAL_PAID');
} else {
$id_order_state = Configuration::get('PS_OS_OVERBOOKING_PAID');
}
} else {
$id_order_state = Configuration::get('PS_OS_OVERBOOKING_UNPAID');
}
}
$history = new OrderHistory();
$history->id_order = (int)$order->id;
$history->changeIdOrderState(Configuration::get($order->valid ? 'PS_OS_OUTOFSTOCK_PAID' : 'PS_OS_OUTOFSTOCK_UNPAID'), $order, true);
$history->changeIdOrderState($id_order_state, $order, true);
$history->addWithemail();
}
@@ -1148,8 +1234,21 @@ abstract class PaymentModuleCore extends Module
PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int)$id_cart, true);
}
// Send order confirmation mails to the reciepients according to the order mail configuration
$orderStatusObj = new OrderState((int)$id_order_state, (int)$this->context->language->id);
$data['{order_status}'] = $orderStatusObj->name;
$data['{order_status_color}'] = $orderStatusObj->color;
// Send order confirmation/overbooking mails to the reciepients according to the order mail configuration
$overBookingStates = OrderState::getOverBookingStates();
$isOverBookingStatus = in_array($id_order_state, $overBookingStates);
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_CUSTOMER')){
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
$subject = Mail::l('Order Not Confirmed', (int)$order->id_lang);
$template = 'overbooking';
} else {
$subject = Mail::l('Order confirmation', (int)$order->id_lang);
$template = 'order_conf';
}
if (Validate::isEmail($this->context->customer->email)) {
// send customer information
$data['{firstname}'] = $this->context->customer->firstname;
@@ -1157,8 +1256,8 @@ abstract class PaymentModuleCore extends Module
$data['{email}'] = $this->context->customer->email;
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$template,
$subject,
$data,
$this->context->customer->email,
$this->context->customer->firstname.' '.$this->context->customer->lastname,
@@ -1179,8 +1278,8 @@ abstract class PaymentModuleCore extends Module
$data['{email}'] = $objOrderCustomerGuestDetail->email;
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$template,
$subject,
$data,
$objOrderCustomerGuestDetail->email,
$objOrderCustomerGuestDetail->firstname.' '.$objOrderCustomerGuestDetail->lastname,
@@ -1194,8 +1293,17 @@ abstract class PaymentModuleCore extends Module
}
}
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_SUPERADMIN')){
// send superadmin information
// get superadmin employees
if ($superAdminEmployees = Employee::getEmployeesByProfile(_PS_ADMIN_PROFILE_, true)) {
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
$subject = Mail::l('Order Not Confirmed', (int)$order->id_lang);
$template = 'overbooking_admin';
} else {
$subject = Mail::l('Order confirmation', (int)$order->id_lang);
$template = 'order_conf_admin';
}
foreach ($superAdminEmployees as $superAdminEmployee) {
if (Validate::isEmail($superAdminEmployee['email'])) {
$data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname;
@@ -1205,8 +1313,8 @@ abstract class PaymentModuleCore extends Module
$data['{email}'] = $superAdminEmployee['email'];
Mail::Send(
(int)$order->id_lang,
'order_conf_admin',
Mail::l('Order confirmation', (int)$order->id_lang),
$template,
$subject,
$data,
$superAdminEmployee['email'],
$superAdminEmployee['firstname'].' '.$superAdminEmployee['lastname'],
@@ -1223,6 +1331,14 @@ abstract class PaymentModuleCore extends Module
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
) {
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_HOTEL_MANAGER')){
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
$subject = Mail::l('Order Not Confirmed', (int)$order->id_lang);
$template = 'overbooking_admin';
} else {
$subject = Mail::l('Order confirmation', (int)$order->id_lang);
$template = 'order_conf_admin';
}
// send hotel information
$data['{firstname}'] = '';
$data['{lastname}'] = '';
@@ -1232,8 +1348,8 @@ abstract class PaymentModuleCore extends Module
if (Validate::isEmail($objHotel->email)) {
Mail::Send(
(int)$order->id_lang,
'order_conf_admin',
Mail::l('Order confirmation', (int)$order->id_lang),
$template,
$subject,
$data,
$objHotel->email,
null,
@@ -1248,6 +1364,16 @@ abstract class PaymentModuleCore extends Module
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
$data['{customer_name}'] = $this->context->customer->firstname.' '.$this->context->customer->lastname;
$data['{customer_email}'] = $this->context->customer->email;
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
if ($isOverBookingStatus) {
$subject = Mail::l('Order Not Confirmed', (int)$order->id_lang);
$template = 'overbooking_admin';
} else {
$subject = Mail::l('Order confirmation', (int)$order->id_lang);
$template = 'order_conf_admin';
}
foreach ($htlAccesses as $access) {
if ($access['access'] && $access['id_profile'] != _PS_ADMIN_PROFILE_) {
if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) {
@@ -1259,8 +1385,8 @@ abstract class PaymentModuleCore extends Module
$data['{email}'] = $empl['email'];
Mail::Send(
(int)$order->id_lang,
'order_conf_admin',
Mail::l('Order confirmation', (int)$order->id_lang),
$template,
$subject,
$data,
$empl['email'],
$empl['firstname'].' '.$empl['lastname'],
@@ -1278,7 +1404,6 @@ abstract class PaymentModuleCore extends Module
}
}
}
// updates stock in shops
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
$product_list = $order->getProducts();

View File

@@ -760,7 +760,7 @@ class AdminControllerCore extends Controller
}
if (count($filters)) {
return sprintf($this->l('filter by %s'), implode(', ', $filters));
return sprintf($this->l('Filter by %s'), implode(', ', $filters));
}
}
}
@@ -990,6 +990,18 @@ class AdminControllerCore extends Controller
return true;
}
protected function ajaxProcessChangeKpiVisibility()
{
$cookieKey = 'kpi_visibility_'.$this->context->controller->className.'_'.Tools::getValue('kpi_id');
$this->context->cookie->$cookieKey = (int) Tools::getValue('is_visible');
}
protected function ajaxProcessSaveKpiView()
{
$cookieKey = 'kpi_wrapping_'.$this->context->controller->className;
$this->context->cookie->$cookieKey = (int) Tools::getValue('no_wrapping');
}
/**
* @TODO uses redirectAdmin only if !$this->ajax
* @return bool
@@ -2232,7 +2244,7 @@ class AdminControllerCore extends Controller
) {
$this->page_header_toolbar_btn['modules-list'] = array(
'href' => '#',
'desc' => $this->l('Recommended Modules and Services')
'desc' => $this->l('Recommendations')
);
}
}

View File

@@ -1135,9 +1135,7 @@ class FrontControllerCore extends Controller
*/
public function initHeader()
{
/** @see P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies) */
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header('Powered-By: PrestaShop');
header('Powered-By: QloApps');
// Hooks are voluntary out the initialize array (need those variables already assigned)
$this->context->smarty->assign(array(

View File

@@ -39,7 +39,9 @@ class HelperKpiCore extends Helper
public $data;
public $source;
public $href;
public $target;
public $tooltip;
public $visible;
public function generate()
{
@@ -56,7 +58,9 @@ class HelperKpiCore extends Helper
'data' => $this->data,
'source' => $this->source,
'href' => $this->href,
'tooltip' => $this->tooltip
'target' => $this->target,
'tooltip' => $this->tooltip,
'visible' => $this->visible,
));
return $this->tpl->fetch();

View File

@@ -36,8 +36,26 @@ class HelperKpiRowCore extends Helper
{
$this->tpl = $this->createTemplate($this->base_tpl);
// set visiblity for each KPI
$countVisible = 0;
$cookieKeyPrefix = 'kpi_visibility_'.$this->context->controller->className.'_';
foreach ($this->kpis as &$kpi) {
$cookieKey = $cookieKeyPrefix.$kpi->id;
if (isset($this->context->cookie->$cookieKey)) {
$kpi->visible = (bool) $this->context->cookie->$cookieKey;
} else {
$kpi->visible = true;
}
$countVisible = $kpi->visible ? ++$countVisible : $countVisible;
}
$cookieKeyView = 'kpi_wrapping_'.$this->context->controller->className;
$this->tpl->assign('kpis', $this->kpis);
$this->tpl->assign('refresh', $this->refresh);
$this->tpl->assign('no_wrapping', (int) $this->context->cookie->$cookieKeyView);
$this->tpl->assign('count_visible', $countVisible);
return $this->tpl->fetch();
}

View File

@@ -34,6 +34,10 @@ class OrderCore extends ObjectModel
const ORDER_PAYMENT_TYPE_FULL = 1;
const ORDER_PAYMENT_TYPE_ADVANCE = 2;
// actions when overbooking will be created
const OVERBOOKING_ORDER_CANCEL_ACTION = 1;
const OVERBOOKING_ORDER_NO_ACTION = 2;
//Consts for: In the order list in which currency prices should be displayed
const ORDER_LIST_PRICE_DISPLAY_IN_PAYMENT_CURRENCY = 1;
const ORDER_LIST_PRICE_DISPLAY_IN_DEFAULT_CURRENCY = 2;

View File

@@ -155,4 +155,13 @@ class OrderStateCore extends ObjectModel
{
return !($this->unremovable);
}
public static function getOverBookingStates()
{
return array(
Configuration::get('PS_OS_OVERBOOKING_PARTIAL_PAID'),
Configuration::get('PS_OS_OVERBOOKING_PAID'),
Configuration::get('PS_OS_OVERBOOKING_UNPAID'),
);
}
}

View File

@@ -172,7 +172,7 @@ class AdminCartsControllerCore extends AdminController
$helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-carts';
@@ -184,7 +184,7 @@ class AdminCartsControllerCore extends AdminController
$helper->subtitle = sprintf($this->l('From %s to %s', null, null, false), $date_from, $date_to);
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-average-order';
@@ -193,7 +193,7 @@ class AdminCartsControllerCore extends AdminController
$helper->title = $this->l('Average Order Value', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-net-profit-visitor';
@@ -202,7 +202,11 @@ class AdminCartsControllerCore extends AdminController
$helper->title = $this->l('Net Profit per Visitor', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visit';
$kpis[] = $helper->generate();
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;

View File

@@ -90,7 +90,8 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval',
'size' => 5,
'type' => 'text',
'suffix' => $this->l('minutes')
'suffix' => $this->l('minutes'),
'class' => 'fixed-width-xl',
),
'PS_B2B_ENABLE' => array(
'title' => $this->l('Enable B2B mode'),
@@ -120,6 +121,48 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
'PS_CUSTOMER_ADDRESS_CREATION' => array(
'title' => $this->l('Address creation during checkout'),
'hint' => $this->l('If disabled, Address form will not appear to user during checkout process. So by default hotel address, which rooms guest has in his cart will be considered as user address. Else user has to fill adress details.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS' => array(
'title' => $this->l('Number of orders to use to calculate frequent customers'),
'hint' => $this->l('Set the number of orders to use to calculate frequent customers.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'class' => 'fixed-width-xxl',
),
'PS_KPI_REVPAC_NB_DAYS' => array(
'title' => $this->l('Number of days to use to calculate RevPAC'),
'hint' => $this->l('Set the number of days to use to calculate Revenue Per Available Customer.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('days'),
'class' => 'fixed-width-xl',
),
'PS_KPI_CONVERSION_RATE_NB_DAYS' => array(
'title' => $this->l('Number of days to use to calculate Conversion Rate'),
'hint' => $this->l('Set the number of days to use to calculate Conversion Rate.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('days'),
'class' => 'fixed-width-xl',
),
'PS_KPI_NEW_CUSTOMERS_NB_DAYS' => array(
'title' => $this->l('Number of days for which a customer is considered \'new\''),
'hint' => $this->l('Set the number of days for which a customer is considered \'new\' after creation date.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('days'),
'class' => 'fixed-width-xl',
),
),
'submit' => array('title' => $this->l('Save')),
),

View File

@@ -524,7 +524,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->color = 'color1';
$helper->title = $this->l('Pending Discussion Threads', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=pending_messages';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-age';
@@ -533,7 +533,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->title = $this->l('Average Response Time', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_msg_response_time';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-messages-per-thread';
@@ -542,7 +542,11 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->title = $this->l('Messages per Thread', null, null, false);
$helper->subtitle = $this->l('30 day', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=messages_per_thread';
$kpis[] = $helper->generate();
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
@@ -721,7 +725,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$content .= $this->l('Message to: ').' <span class="badge">'.(!$message['id_employee'] ? $message['subject'] : $message['customer_name']).'</span><br/>';
}
if (Validate::isLoadedObject($product)) {
$content .= '<br/>'.$this->l('Product: ').'<span class="label label-info">'.$product->name.'</span><br/><br/>';
$content .= '<br/>'.$this->l('Room type: ').'<span class="label label-info">'.$product->name.'</span><br/><br/>';
}
$content .= Tools::safeOutput($message['message']);

View File

@@ -650,41 +650,92 @@ class AdminCustomersControllerCore extends AdminController
$time = time();
$kpis = array();
$helper = new HelperKpi();
$helper->id = 'box-gender';
$helper->icon = 'icon-male';
$helper->color = 'color1';
$helper->title = $this->l('Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=customer_main_gender';
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-age';
$helper->icon = 'icon-calendar';
$helper->color = 'color2';
$helper->title = $this->l('Average Age', 'AdminTab', null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_customer_age';
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-orders';
$helper->icon = 'icon-retweet';
$helper->color = 'color3';
$helper->icon = 'icon-shopping-cart';
$helper->color = 'color1';
$helper->title = $this->l('Orders per Customer', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=orders_per_customer';
$kpis[] = $helper->generate();
$helper->tooltip = $this->l('The average number of orders placed per customer in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-newsletter';
$helper->id = 'box-total-frequent-customers';
$helper->icon = 'icon-star';
$helper->color = 'color2';
$helper->title = $this->l('Total Frequent Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_frequent_customers';
$helper->tooltip = $this->l('The total number of frequent customers in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-revenue-per-available-customer';
$helper->icon = 'icon-dollar';
$helper->color = 'color3';
$helper->title = $this->l('RevPAC', null, null, false);
$nbDaysRevPac = Validate::isUnsignedInt(Configuration::get('PS_KPI_REVPAC_NB_DAYS')) ? Configuration::get('PS_KPI_REVPAC_NB_DAYS') : 30;
$helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysRevPac);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=revenue_per_available_customer';
$helper->tooltip = $this->l('Revenue per Available Customer (RevPAC) in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-total-newsletter-registrations';
$helper->icon = 'icon-envelope';
$helper->color = 'color4';
$helper->title = $this->l('Newsletter Registrations', null, null, false);
$helper->title = $this->l('Total Newsletter Registrations', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=newsletter_registrations';
$kpis[] = $helper->generate();
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_newsletter_registrations';
$helper->tooltip = $this->l('The total number of newsletter registrations in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-conversion-rate';
$helper->icon = 'icon-refresh';
$helper->color = 'color1';
$helper->title = $this->l('Conversion Rate', null, null, false);
$nbDaysConversionRate = Validate::isUnsignedInt(Configuration::get('PS_KPI_CONVERSION_RATE_NB_DAYS')) ? Configuration::get('PS_KPI_CONVERSION_RATE_NB_DAYS') : 30;
$helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysConversionRate);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
$helper->tooltip = $this->l('The percentage of visitors who created a booking in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-total-new-customers';
$helper->icon = 'icon-plus-circle';
$helper->color = 'color4';
$helper->title = $this->l('New Customers', null, null, false);
$nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30;
$helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers';
$helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-total-banned-customers';
$helper->icon = 'icon-ban';
$helper->color = 'color2';
$helper->title = $this->l('Banned Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_banned_customers';
$helper->tooltip = $this->l('The total number of banned customers.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-gender';
$helper->icon = 'icon-male';
$helper->color = 'color3';
$helper->title = $this->l('Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=customer_main_gender';
$helper->tooltip = $this->l('The main gender from all the customers.', null, null, false);
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;

View File

@@ -477,7 +477,7 @@ class AdminMetaControllerCore extends AdminController
));
// PS Comments
fwrite($write_fd, "# robots.txt automaticaly generated by qloapps e-commerce open-source solution\n");
fwrite($write_fd, "# robots.txt automaticaly generated by QloApps - open-source hotel management solution.\n");
fwrite($write_fd, "# https://www.qloapps.com - https://forums.qloapps.com/\n");
fwrite($write_fd, "# This file is to prevent the crawling and indexing of certain parts\n");
fwrite($write_fd, "# of your site by web crawlers and spiders run by sites like Yahoo!\n");

View File

@@ -1333,7 +1333,7 @@ class AdminModulesControllerCore extends AdminController
$helper->color = 'color1';
$helper->title = $this->l('Installed Modules', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=installed_modules';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-disabled-modules';
@@ -1341,7 +1341,7 @@ class AdminModulesControllerCore extends AdminController
$helper->color = 'color2';
$helper->title = $this->l('Disabled Modules', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_modules';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-update-modules';
@@ -1349,7 +1349,11 @@ class AdminModulesControllerCore extends AdminController
$helper->color = 'color3';
$helper->title = $this->l('Modules to Update', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=update_modules';
$kpis[] = $helper->generate();
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;

View File

@@ -58,6 +58,18 @@ class AdminOrderPreferencesControllerCore extends AdminController
)
);
// actions when overbooking will be created
$overbookingAction = array(
array(
'value' => Order::OVERBOOKING_ORDER_CANCEL_ACTION,
'name' => $this->l('Cancel the booking')
),
array(
'value' => Order::OVERBOOKING_ORDER_NO_ACTION,
'name' => $this->l('Take the overbooking')
)
);
// Options to display currency in order list
$displayCurrencyOptions = array(
array(
@@ -76,8 +88,8 @@ class AdminOrderPreferencesControllerCore extends AdminController
'icon' => 'icon-cogs',
'fields' => array(
'MAX_GLOBAL_BOOKING_DATE' => array(
'title' => $this->l('Maximum Global Date to book a room'),
'hint' => $this->l('Maximum date by which rooms of your hotels can be booked.'),
'title' => $this->l('Maximum Global Check-out Date to book a room'),
'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'),
'type' => 'text',
'id' => 'max_global_book_date',
'class' => 'fixed-width-xxl readonly',
@@ -176,8 +188,8 @@ class AdminOrderPreferencesControllerCore extends AdminController
),
'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => array(
'title' => $this->l('Show room price breakdown'),
'hint' => $this->l('Show a summary for prices of the auto added service add with room on shopping cart list.'),
'desc' => $this->l('This breakdown is always visible on room that have cart rule applied for that specific room.'),
'hint' => $this->l('Show price breakdown for rooms with auto added services on checkout page.'),
'desc' => $this->l('This room price breakdown will be shown if cart rule for specific room type is applied on that room.'),
'cast' => 'intval',
'type' => 'bool'
),
@@ -195,33 +207,83 @@ class AdminOrderPreferencesControllerCore extends AdminController
'submit' => array('title' => $this->l('Save'))
),
'email' => array(
'title' => $this->l('Email'),
'title' => $this->l('Order Confirmation / Overbooking Email'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_ORDER_CONF_MAIL_TO_CUSTOMER' => array(
'title' => $this->l('Order confirmation mail to customer'),
'hint' => $this->l('Enable, if you want to send order confirmation email to the customer.'),
'title' => $this->l('Send email to customer'),
'hint' => $this->l('Enable, if you want to send order confirmation or overbooking or overbooking email to the customer.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_ORDER_CONF_MAIL_TO_SUPERADMIN' => array(
'title' => $this->l('Order confirmation mail to super admin'),
'hint' => $this->l('Enable, if you want to send order confirmation email to the super admin.'),
'title' => $this->l('Send email to super admin'),
'hint' => $this->l('Enable, if you want to send order confirmation or overbooking email to the super admin.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_ORDER_CONF_MAIL_TO_HOTEL_MANAGER' => array(
'title' => $this->l('Order confirmation mail to hotelier'),
'hint' => $this->l('Enable, if you want to send order confirmation email to the hotelier. Mail will be sent to the email saved while creating the hotel.'),
'title' => $this->l('Send email to hotelier'),
'hint' => $this->l('Enable, if you want to send order confirmation or overbooking email to the hotelier. Mail will be sent to the email saved while creating the hotel.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_ORDER_CONF_MAIL_TO_EMPLOYEE' => array(
'title' => $this->l('Order confirmation mail to employees'),
'hint' => $this->l('Enable, if you want to send order confirmation email to employees having permission to manage the hotel.'),
'title' => $this->l('Send email to employees'),
'hint' => $this->l('Enable, if you want to send order confirmation or overbooking email to employees having permission to manage the hotel.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
),
'submit' => array('title' => $this->l('Save'))
),
'overbooking' => array(
'title' => $this->l('Overbooking'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_OVERBOOKING_ORDER_ACTION' => array(
'title' => $this->l('Overbooking order action'),
'hint' => $this->l('Please choose the action to take when overbooking is created in any order.'),
'validation' => 'isInt',
'type' => 'select',
'cast' => 'intval',
'validation' => 'isInt',
'list' => $overbookingAction,
'identifier' => 'value',
'js' => "changeOverbookingOrderAction()"
),
'PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY' => array(
'title' => $this->l('Maximun hotel overbookings per date'),
'hint' => $this->l('Enter the maximum number of the overbookings on any date can be created for a hotel.(Set 0 for no limit)'),
'desc' => $this->l('When maximun number of the overbookings on any date in the booking duration is reached, then the new overbooking order will be cancelled.(Set 0 for no limit)'),
'validation' => 'isInt',
'type' => 'text',
'class' => 'fixed-width-xxl',
'validation' => 'isInt',
'id' => 'PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY',
),
'OVERBOOKING_ORDER_CANCEL_ACTION' => array(
'title' => $this->l('Overbooking order cancel action value'),
'type' => 'hidden',
'value' => Order::OVERBOOKING_ORDER_CANCEL_ACTION,
'auto_value' => false,
),
'OVERBOOKING_ORDER_NO_ACTION' => array(
'title' => $this->l('Overbooking order no action value'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'hidden',
'value' => Order::OVERBOOKING_ORDER_NO_ACTION,
'auto_value' => false
),
'PS_OVERBOOKING_AUTO_RESOLVE' => array(
'title' => $this->l('Resolve overbooking automatically'),
'hint' => $this->l('Enable, if you want to resolve overbooking automatically when rooms are available to be replaced with overbooked rooms.'),
'desc' => $this->l('If enabled, the overbookings in the order will be resolved automatically when rooms are available to be replaced with all overbooked rooms in the order.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
@@ -256,11 +318,11 @@ class AdminOrderPreferencesControllerCore extends AdminController
$maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate));
if ($maxGlobalBookingDate == '') {
$this->errors[] = Tools::displayError('Field \'Maximum Global Date to book a room\' can not be empty.');
$this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' can not be empty.');
} elseif (!Validate::isDate($maxGlobalBookingDateFormatted)) {
$this->errors[] = Tools::displayError('Field \'Maximum Global Date to book a room\' is invalid.');
$this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' is invalid.');
} elseif (strtotime($maxGlobalBookingDateFormatted) < strtotime(date('Y-m-d'))) {
$this->errors[] = Tools::displayError('Field \'Maximum Global Date to book a room\' can not be a past date. Please use a future date.');
$this->errors[] = Tools::displayError('Field \'Maximum Global Check-out Date to book a room\' can not be a past date. Please use a future date.');
}
if ($globalPreparationTime === '') {

View File

@@ -96,6 +96,22 @@ class AdminOrdersControllerCore extends AdminController
$this->_group = ' GROUP BY hbd.`id_order`';
// if request for resolvable overbooked orders filter comes the set condition for this
if (Tools::getIsset('resolvable_overbooked_orders') && Tools::getValue('resolvable_overbooked_orders')) {
$objHotelBookingDetail = new HotelBookingDetail();
$resolvableOrders = array();
// Overbookings information of the order
if ($orderOverBookings = $objHotelBookingDetail->getOverbookedRooms()) {
foreach ($orderOverBookings as $overBookedRoom) {
if (!in_array($overBookedRoom['id_order'], $resolvableOrders)) {
$resolvableOrders[$overBookedRoom['id_order']] = $overBookedRoom['id_order'];
}
}
}
$this->_where = ' AND a.`id_order` IN ('.implode(',', $resolvableOrders).')';
}
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
foreach ($statuses as $status) {
$this->statuses_array[$status['id_order_state']] = $status['name'];
@@ -326,6 +342,8 @@ class AdminOrdersControllerCore extends AdminController
parent::__construct();
// overbooking success status
$this->_conf[51] = $this->l('Overbooking is successfully resolved');
$this->_conf[52] = $this->l('Room in the booking is successfully reallocated');
$this->_conf[53] = $this->l('Room in the booking is successfully swapped');
}
@@ -623,6 +641,13 @@ class AdminOrdersControllerCore extends AdminController
public function renderList()
{
// Show all resolvable overbookings if available
$objHotelBookingDetail = new HotelBookingDetail();
if ($resolvableOverBookings = $objHotelBookingDetail->getOverbookedRooms(0, 0, '', '', 0, 0, 2)) {
$this->context->smarty->assign('resolvableOverBookings', $resolvableOverBookings);
$this->content .= $this->context->smarty->fetch('controllers/orders/_resolvable_overbookings.tpl');
}
if (Tools::isSubmit('submitBulkupdateOrderStatus'.$this->table)) {
if (Tools::getIsset('cancel')) {
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
@@ -1819,10 +1844,24 @@ class AdminOrdersControllerCore extends AdminController
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif(Tools::getIsset('resolve_overbooking') && Tools::getValue('resolve_overbooking')) {
$objHotelBookingDetail = new HotelBookingDetail();
// resolve an overbooking manually
if ($objHotelBookingDetail->resolveOverbookings(Tools::getValue('resolve_overbooking'))) {
if (Tools::getValue('id_order')) {
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=51&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=51&token='.$this->token);
}
} else {
$this->errors = Tools::displayError('An error occurred while resolving overbooking.');
}
}
parent::postProcess();
}
// KPIs on listing page
// public function renderKpis()
// {
// $time = time();
@@ -1874,6 +1913,60 @@ class AdminOrdersControllerCore extends AdminController
// return $helper->generate();
// }
// KPIs on view page
public function renderKpis()
{
$objOrder = new Order(Tools::getValue('id_order'));
if (Validate::isLoadedObject($objOrder)) {
$kpis = array();
$helper = new HelperKpi();
$helper->id = 'box-order-date';
$helper->icon = 'icon-calendar';
$helper->color = 'color3';
$helper->title = $this->l('Order Date');
$helper->value = Tools::displayDate($objOrder->date_add);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-order-total';
$helper->icon = 'icon-money';
$helper->color = 'color4';
$helper->title = $this->l('Total');
$helper->value = Tools::displayPrice($objOrder->total_paid_tax_incl, new Currency($objOrder->id_currency));
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-messages';
$helper->icon = 'icon-comments';
$helper->color = 'color2';
$helper->title = $this->l('Messages');
$helper->href = $this->context->link->getAdminLink('AdminCustomerThreads').'&id_order='.$objOrder->id;
$helper->value = count(CustomerThread::getCustomerMessages($objOrder->id_customer, null, $objOrder->id));
$kpis[] = $helper;
$objHotelBookingDetail = new HotelBookingDetail();
$numRooms = count($objHotelBookingDetail->getBookingDataByOrderId($objOrder->id));
$helper = new HelperKpi();
$helper->id = 'box-total-rooms';
$helper->icon = 'icon-home';
$helper->color = 'color1';
$helper->title = $this->l('Total Rooms');
$helper->href = '#start_products';
$helper->value = $numRooms;
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
}
public function renderView()
{
$order = new Order(Tools::getValue('id_order'));
@@ -1881,6 +1974,8 @@ class AdminOrdersControllerCore extends AdminController
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
$this->content .= $this->renderKpis();
$customer = new Customer($order->id_customer);
$carrier = new Carrier($order->id_carrier);
$products = $this->getProducts($order);
@@ -2229,8 +2324,12 @@ class AdminOrdersControllerCore extends AdminController
// applicable refund policies
$applicableRefundPolicies = HotelOrderRefundRules::getApplicableRefundRules($order->id);
// Overbookings information of the order
$orderOverBookings = $objHotelBookingDetail->getOverbookedRooms($order->id, 0, '', '', 0, 0, 1);
$this->tpl_view_vars = array(
// refund info
'orderOverBookings' => $orderOverBookings,
'refund_allowed' => (int) $order->isReturnable(),
'applicable_refund_policies' => $applicableRefundPolicies,
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
@@ -3357,6 +3456,37 @@ class AdminOrdersControllerCore extends AdminController
$this->context->cart = $cart;
$this->context->customer = new Customer($order->id_customer);
// always add taxes even if not displayed to the customer
$use_taxes = true;
$this->context->currency = new Currency($order->id_currency);
$initial_product_price_tax_incl = Product::getPriceStatic(
$product->id,
$use_taxes,
isset($combination) ? $combination->id : null,
2,
null,
false,
true,
1,
false,
$order->id_customer,
$cart->id,
$order->id_address_tax
);
// create feature price if needed
$createFeaturePrice = $product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl;
$featurePriceParams = array();
if ($createFeaturePrice) {
$featurePriceParams = array(
'id_cart' => $this->context->cart->id,
'id_guest' => $this->context->cookie->id_guest,
'price' => $product_informations['product_price_tax_excl'],
'id_product' => $product->id,
);
}
/*By Webkul to make entries in HotelCartBookingData */
$hotel_room_info_arr = $hotel_room_data['rm_data'][$idProduct]['data']['available'];
$chkQty = 0;
@@ -3414,49 +3544,6 @@ class AdminOrdersControllerCore extends AdminController
}
}
/*END*/
// always add taxes even if there are not displayed to the customer
$use_taxes = true;
$this->context->currency = new Currency($order->id_currency);
$initial_product_price_tax_incl = Product::getPriceStatic(
$product->id,
$use_taxes,
isset($combination) ? $combination->id : null,
2,
null,
false,
true,
1,
false,
$order->id_customer,
$cart->id,
$order->id_address_tax
);
// Creating specific price if needed
if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl) {
$specific_price = new SpecificPrice();
$specific_price->id_shop = 0;
$specific_price->id_shop_group = 0;
$specific_price->id_currency = $order->id_currency;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->id_customer = $order->id_customer;
$specific_price->id_product = $product->id;
if (isset($combination)) {
$specific_price->id_product_attribute = $combination->id;
} else {
$specific_price->id_product_attribute = 0;
}
$specific_price->price = $product_informations['product_price_tax_excl'];
$specific_price->from_quantity = 1;
$specific_price->reduction = 0;
$specific_price->reduction_type = 'amount';
$specific_price->reduction_tax = 0;
$specific_price->from = '0000-00-00 00:00:00';
$specific_price->to = '0000-00-00 00:00:00';
$specific_price->add();
}
// Add product to cart
$update_quantity = $cart->updateQty(
@@ -3827,7 +3914,8 @@ class AdminOrdersControllerCore extends AdminController
}
// delete cart feature prices after room addition success
HotelRoomTypeFeaturePricing::deleteByIdCart($cart->id);
HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id);
die(json_encode(array(
'result' => true,
//'view' => $this->createTemplate('_product_line.tpl')->fetch(),
@@ -5433,7 +5521,9 @@ class AdminOrdersControllerCore extends AdminController
) {
$smartyVars = array();
$objOrder = new Order($idOrder);
$objCurrency = new Currency($objOrder->id_currency);
$smartyVars['orderCurrency'] = $objOrder->id_currency;
$smartyVars['currencySign'] = $objCurrency->sign;
$smartyVars['link'] = $this->context->link;
$objBookingDemand = new HotelBookingDetail();
@@ -5450,7 +5540,7 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDemand = new HotelBookingDemands();
// set context currency So that we can get prices in the order currency
$this->context->currency = new Currency($objOrder->id_currency);
$this->context->currency = $objCurrency;
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
$idOrder,
@@ -5514,6 +5604,12 @@ class AdminOrdersControllerCore extends AdminController
public function processRenderServicesPanel($idOrder, $idProduct, $dateFrom, $dateTo, $idRoom, $orderEdit)
{
$smartyVars = array();
$objOrder = new Order($idOrder);
$objCurrency = new Currency($objOrder->id_currency);
$smartyVars['orderCurrency'] = $objOrder->id_currency;
$smartyVars['currencySign'] = $objCurrency->sign;
$smartyVars['link'] = $this->context->link;
$objBookingDemand = new HotelBookingDetail();
$htlBookingDetail = $objBookingDemand->getRowByIdOrderIdProductInDateRange(
$idOrder,
@@ -5532,9 +5628,8 @@ class AdminOrdersControllerCore extends AdminController
}
if ($orderEdit) {
$objOrder = new Order($idOrder);
// set context currency So that we can get prices in the order currency
$this->context->currency = new Currency($objOrder->id_currency);
$this->context->currency = $objCurrency;
$smartyVars['orderEdit'] = $orderEdit;
@@ -5562,7 +5657,10 @@ class AdminOrdersControllerCore extends AdminController
{
$smartyVars = array();
$objOrder = new Order($idOrder);
$objCurrency = new Currency($objOrder->id_currency);
$smartyVars['orderCurrency'] = $objOrder->id_currency;
$smartyVars['currencySign'] = $objCurrency->sign;
$smartyVars['link'] = $this->context->link;
$objBookingDemand = new HotelBookingDetail();
$htlBookingDetail = $objBookingDemand->getRowByIdOrderIdProductInDateRange(
@@ -5619,61 +5717,82 @@ class AdminOrdersControllerCore extends AdminController
$response = array('hasError' => false);
$id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail');
$quantity = Tools::getValue('qty');
$unitPrice = Tools::getValue('unit_price');
if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) {
if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail((int) $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail))) {
$numDays = 1;
if (Product::getProductPriceCalculation($objRoomTypeServiceProductOrderDetail->id_product) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
}
$objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail);
if ($objOrderDetail->product_allow_multiple_quantity) {
if (!Validate::isUnsignedInt($quantity)) {
$response['hasError'] = true;
$response['errors'] = $this->l('Invalid quantity provided');
} else {
$oldQuantity = $objRoomTypeServiceProductOrderDetail->quantity;
$objRoomTypeServiceProductOrderDetail->quantity = $quantity;
$oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $quantity * $numDays;
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $quantity * $numDays;
$res = true;
if ($res &= $objRoomTypeServiceProductOrderDetail->save()) {
$order = new Order($objRoomTypeServiceProductOrderDetail->id_order);
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$objOrderDetail->product_quantity += (($quantity - $oldQuantity) * $numDays);
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
$res &= $objOrderDetail->updateTaxAmount($order);
$res &= $objOrderDetail->update();
$order->total_paid_tax_excl += $priceDiffTaxExcl;
$order->total_paid_tax_incl += $priceDiffTaxIncl;
$order->total_paid += $priceDiffTaxIncl;
$res &= $order->update();
}
}
if (!$res) {
$response['hasError'] = true;
$response['errors'] = $this->l('Error while updating service, please try refresing the page');
}
} else {
$response['hasError'] = true;
$response['errors'] = $this->l('cannot order multiple quanitity for this service');
}
} else {
$objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail);
if (!$objOrderDetail->product_allow_multiple_quantity && $quantity > 1) {
$response['hasError'] = true;
$response['errors'] = $this->l('Additional service not found');
$response['errors'] = $this->l('cannot order multiple quanitity for this service');
} else if (!Validate::isUnsignedInt($quantity)) {
$response['hasError'] = true;
$response['errors'] = $this->l('Invalid quantity provided');
}
if (!ValidateCore::isPrice($unitPrice)) {
$response['hasError'] = true;
$response['errors'] = $this->l('Invalid unit price');
}
$objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail);
$res = true;
if (!$response['hasError']) {
$oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl;
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl;
$oldQuantity = $objRoomTypeServiceProductOrderDetail->quantity;
if ($oldPriceTaxExcl > 0) {
$oldTaxMultiplier = $oldPriceTaxIncl / $oldPriceTaxExcl;
} else {
$oldTaxMultiplier = 1;
}
if ($quantity <= 0) {
$quantity = 1;
}
$objRoomTypeServiceProductOrderDetail->quantity = $quantity;
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = Tools::ps_round($unitPrice, 6);
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = Tools::ps_round($unitPrice * $oldTaxMultiplier, 6);
if ($objOrderDetail->product_price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$quantity = $quantity * HotelHelper::getNumberOfDays(
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to
);
}
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::ps_round($objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $quantity, 6);
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::ps_round($objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $quantity, 6);
if ($res &= $objRoomTypeServiceProductOrderDetail->save()) {
$order = new Order($objRoomTypeServiceProductOrderDetail->id_order);
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
$quantityDiff = $objRoomTypeServiceProductOrderDetail->quantity - $oldQuantity;
$objOrderDetail->product_quantity += $quantityDiff;
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
$objOrderDetail->unit_price_tax_excl = ($objOrderDetail->total_price_tax_excl / $objOrderDetail->product_quantity);
$objOrderDetail->unit_price_tax_incl = ($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity);
$res &= $objOrderDetail->updateTaxAmount($order);
$res &= $objOrderDetail->update();
if ($objOrderDetail->id_order_invoice != 0) {
// values changes as values are calculated accoding to the quantity of the product by webkul
$order_invoice = new OrderInvoice($objOrderDetail->id_order_invoice);
$order_invoice->total_paid_tax_excl += $priceDiffTaxExcl;
$order_invoice->total_paid_tax_incl += $priceDiffTaxIncl;
$res &= $order_invoice->update();
}
$order->total_paid_tax_excl += $priceDiffTaxExcl;
$order->total_paid_tax_incl += $priceDiffTaxIncl;
$order->total_paid += $priceDiffTaxIncl;
$res &= $order->update();
}
}
if (!$res) {
$response['hasError'] = true;
$response['errors'] = $this->l('Error while updating service, please try refresing the page');
}
$response['service_panel']= $servicesBlock = $this->processRenderServicesPanel(
$objOrderDetail->id_order,
$objHotelBookingDetail->id_product,
@@ -5755,6 +5874,7 @@ class AdminOrdersControllerCore extends AdminController
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$qty = Tools::getValue('service_qty');
$price = Tools::getValue('service_price');
foreach ($selectedServices as $key => $service) {
if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelBookingDetail->id_product, $service)) {
$objProduct = new Product($service, false, $this->context->language->id);
@@ -5766,9 +5886,14 @@ class AdminOrdersControllerCore extends AdminController
} else {
$qty[$service] = 1;
}
if (!ValidateCore::isPrice($price[$service])) {
$response['hasError'] = true;
$response['errors'][] = sprintf($this->l('Invalid unit price for %s.'), $objProduct->name);
}
$selectedServices[$key] = array(
'id' => $service,
'qty' => $qty[$service],
'price' => $price[$service],
'name' => $objProduct->name,
);
} else {
@@ -5809,6 +5934,37 @@ class AdminOrdersControllerCore extends AdminController
$this->context->cart = $cart;
$this->context->customer = new Customer($order->id_customer);
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
$initialServicePrice = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$service['id'],
$roomHtlCartInfo['id_product'],
1,
null,
null,
false
);
if ($initialServicePrice != $service['price']) {
$specific_price = new SpecificPrice();
$specific_price->id_shop = 0;
$specific_price->id_shop_group = 0;
$specific_price->id_cart = $cart->id;
$specific_price->id_currency = $order->id_currency;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->id_customer = $order->id_customer;
$specific_price->id_product = $service['id'];
$specific_price->id_product_attribute = 0;
$specific_price->price = $service['price'];
$specific_price->from_quantity = 1;
$specific_price->reduction = 0;
$specific_price->reduction_type = 'amount';
$specific_price->reduction_tax = 0;
$specific_price->from = '0000-00-00 00:00:00';
$specific_price->to = '0000-00-00 00:00:00';
$specific_price->add();
}
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
$objRoomTypeServiceProductCartDetail->addServiceProductInCart(
$service['id'],
@@ -5817,7 +5973,6 @@ class AdminOrdersControllerCore extends AdminController
$roomHtlCartInfo['id']
);
$productList = $cart->getProducts();
$objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice();
$objHotelRoomType = new HotelRoomType();
$roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($objHotelBookingDetail->id_product);
$totalPriceChangeTaxExcl = 0;
@@ -5834,20 +5989,23 @@ class AdminOrdersControllerCore extends AdminController
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $id_room_type_service_product_cart_detail);
$totalPriceChangeTaxExcl += $totalPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
$roomInfo['id'],
0,
$objRoomTypeServiceProductCartDetail->quantity,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
false
false,
$cart->id
);
$totalPriceChangeTaxIncl += $totalPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
$roomInfo['id'],
0,
$objRoomTypeServiceProductCartDetail->quantity,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
true
true,
$cart->id
);
$numDays = 1;
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
@@ -5856,19 +6014,21 @@ class AdminOrdersControllerCore extends AdminController
$unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
$roomInfo['id'],
0,
1,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
false
false,
$cart->id
)/ $numDays;
$unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
$roomInfo['id'],
0,
1,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
true
true,
$cart->id
)/ $numDays;
switch (Configuration::get('PS_ROUND_TYPE')) {
case Order::ROUND_TOTAL:
@@ -5926,9 +6086,13 @@ class AdminOrdersControllerCore extends AdminController
$order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
// Save changes of order
$order->update();
if (Validate::isLoadedObject($specific_price)) {
$specific_price->delete();
unset($specific_price);
}
}
}
$response['service_panel'] = $servicesBlock = $this->processRenderServicesPanel(
$response['service_panel'] = $this->processRenderServicesPanel(
$order->id,
$objHotelBookingDetail->id_product,
$objHotelBookingDetail->date_from,
@@ -5963,9 +6127,9 @@ class AdminOrdersControllerCore extends AdminController
}
// Process when admin edit rooms and edit rooms additional facilities
public function ajaxProcessEditRoomExtraDemands()
public function ajaxProcessAddRoomExtraDemands()
{
$response = array('success' => false);
$response = array('success' => false, 'hasError' => false);
if ($idHtlBooking = Tools::getValue('id_htl_booking')) {
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($idHtlBooking))) {
$roomDemands = Tools::getValue('room_demands');
@@ -5980,72 +6144,150 @@ class AdminOrdersControllerCore extends AdminController
$objHtlBkDtl = new HotelBookingDetail();
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
foreach ($roomDemands as $demand) {
$idGlobalDemand = $demand['id_global_demand'];
$idOption = $demand['id_option'];
$objBookingDemand = new HotelBookingDemands();
$objBookingDemand->id_htl_booking = $idHtlBooking;
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $idLang);
if ($idOption) {
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption, $idLang);
$objBookingDemand->name = $objOption->name;
} else {
$idOption = 0;
$objBookingDemand->name = $objGlobalDemand->name;
}
$objBookingDemand->unit_price_tax_excl = HotelRoomTypeDemand::getPriceStatic(
$idProduct,
$idGlobalDemand,
$idOption,
0
);
$objBookingDemand->unit_price_tax_incl = HotelRoomTypeDemand::getPriceStatic(
$idProduct,
$idGlobalDemand,
$idOption,
1
);
$qty = 1;
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$numDays = $objHtlBkDtl->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;
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
// Update OrderInvoice of this OrderDetail
if ($order_detail->id_order_invoice != 0) {
// values changes as values are calculated accoding to the quantity of the product by webkul
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
$order_invoice->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
$order_invoice->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
$res &= $order_invoice->update();
}
// change order total
$order->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
$order->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
$order->total_paid += $objBookingDemand->total_price_tax_incl;
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;
$taxManager = TaxManagerFactory::getManager(
$vatAddress,
$objGlobalDemand->id_tax_rules_group
);
$taxCalc = $taxManager->getTaxCalculator();
$objBookingDemand->tax_computation_method = (int)$taxCalc->computation_method;
if ($objBookingDemand->save()) {
$objBookingDemand->tax_calculator = $taxCalc;
// Now save tax details of the extra demand
$objBookingDemand->setBookingDemandTaxDetails();
if (!ValidateCore::isPrice($demand['unit_price'])) {
$objGlobalDemand = new HotelRoomTypeGlobalDemand($demand['id_global_demand'], $idLang);
$response['hasError'] = true;
$response['errors'][] = sprintf($this->l('Invalid unit price for %s.'), $objGlobalDemand->name);
}
}
if (!$response['hasError']) {
foreach ($roomDemands as $demand) {
$idGlobalDemand = $demand['id_global_demand'];
$idOption = $demand['id_option'];
$objBookingDemand = new HotelBookingDemands();
$objBookingDemand->id_htl_booking = $idHtlBooking;
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $idLang);
if ($idOption) {
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption, $idLang);
$objBookingDemand->name = $objOption->name;
} else {
$idOption = 0;
$objBookingDemand->name = $objGlobalDemand->name;
}
$objBookingDemand->unit_price_tax_excl = $demand['unit_price'];
$objBookingDemand->unit_price_tax_incl = HotelRoomTypeDemand::getPriceStatic(
$idProduct,
$idGlobalDemand,
$idOption,
1,
6,
null,
null,
null,
null,
$demand['unit_price']
);
$qty = 1;
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$numDays = $objHtlBkDtl->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;
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
// Update OrderInvoice of this OrderDetail
if ($order_detail->id_order_invoice != 0) {
// values changes as values are calculated accoding to the quantity of the product by webkul
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
$order_invoice->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
$order_invoice->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
$res &= $order_invoice->update();
}
// change order total
$order->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
$order->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
$order->total_paid += $objBookingDemand->total_price_tax_incl;
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;
$taxManager = TaxManagerFactory::getManager(
$vatAddress,
$objGlobalDemand->id_tax_rules_group
);
$taxCalc = $taxManager->getTaxCalculator();
$objBookingDemand->tax_computation_method = (int)$taxCalc->computation_method;
if ($objBookingDemand->save()) {
$objBookingDemand->tax_calculator = $taxCalc;
// Now save tax details of the extra demand
$objBookingDemand->setBookingDemandTaxDetails();
}
}
if ($order->save()) {
$response['facilities_panel'] = $this->processRenderFacilitiesBlock(
$order->id,
$objBookingDetail->id_product,
$objBookingDetail->date_from,
$objBookingDetail->date_to,
$objBookingDetail->id_room,
true
);
$response['success'] = true;
}
}
}
}
}
die(json_encode($response));
}
public function ajaxProcessUpdateRoomExtraDemands()
{
$response = array('success' => false);
if ($idBookingDemand = Tools::getValue('id_booking_demand')) {
if (Validate::isLoadedObject($objBookingDemand = new HotelBookingDemands($idBookingDemand))) {
$unitPrice = Tools::getValue('unit_price');
if (!$unitPrice || !ValidateCore::isPrice($unitPrice)) {
$response['hasError'] = true;
$response['errors'] = $this->l('Invalid unit price');
}
$oldPriceTaxExcl = $objBookingDemand->unit_price_tax_excl;
$oldPriceTaxIncl = $objBookingDemand->unit_price_tax_incl;
if ($oldPriceTaxExcl > 0) {
$oldTaxMultiplier = $oldPriceTaxIncl / $oldPriceTaxExcl;
} else {
$oldTaxMultiplier = 1;
}
$objBookingDemand->unit_price_tax_excl = $unitPrice;
$objBookingDemand->unit_price_tax_incl = $unitPrice * $oldTaxMultiplier;
$objBookingDetail = new HotelBookingDetail($objBookingDemand->id_htl_booking);
if ($objBookingDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$numDays = $objBookingDetail->getNumberOfDays(
$objBookingDetail->date_from,
$objBookingDetail->date_to
);
$objBookingDemand->total_price_tax_excl = $objBookingDemand->unit_price_tax_excl * $numDays;
$objBookingDemand->total_price_tax_incl = $objBookingDemand->unit_price_tax_incl * $numDays;
} else {
$objBookingDemand->total_price_tax_excl = $objBookingDemand->unit_price_tax_excl;
$objBookingDemand->total_price_tax_incl = $objBookingDemand->unit_price_tax_incl;
}
if ($objBookingDemand->save()) {
$objBookingDemand->setBookingDemandTaxDetails(1);
$priceDiffTaxExcl = $objBookingDemand->total_price_tax_excl - $oldPriceTaxExcl;
$priceDiffTaxIncl = $objBookingDemand->total_price_tax_incl - $oldPriceTaxIncl;
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
// Update OrderInvoice of this OrderDetail
if ($order_detail->id_order_invoice != 0) {
// values changes as values are calculated accoding to the quantity of the product by webkul
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
$order_invoice->total_paid_tax_excl += $priceDiffTaxExcl;
$order_invoice->total_paid_tax_incl += $priceDiffTaxIncl;
$res &= $order_invoice->update();
}
$order = new Order($objBookingDetail->id_order);
$order->total_paid_tax_excl += $priceDiffTaxExcl;
$order->total_paid_tax_incl += $priceDiffTaxIncl;
$order->total_paid += $priceDiffTaxIncl;
if ($order->save()) {
$response['facilities_panel'] = $this->processRenderFacilitiesBlock(
$order->id,

View File

@@ -66,7 +66,8 @@ class AdminPPreferencesControllerCore extends AdminController
'hint' => $this->l('The counting of days starts from room type creation date.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text'
'type' => 'text',
'class' => 'fixed-width-xxl',
),
/*'PS_CART_REDIRECT' => array(
'title' => $this->l('Redirect after adding product to cart'),
@@ -88,6 +89,7 @@ class AdminPPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('characters'),
'class' => 'fixed-width-xl',
),
/*'PS_QTY_DISCOUNT_ON_COMBINATION' => array(
'title' => $this->l('Quantity discounts based on'),
@@ -109,7 +111,16 @@ class AdminPPreferencesControllerCore extends AdminController
'cast' => 'intval',
'required' => false,
'type' => 'bool'
)
),
'PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS' => array(
'title' => $this->l('Number of days to use to calculate best selling room type'),
'hint' => $this->l('Set the number of days to use to calculate best selling room type.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('days'),
'class' => 'fixed-width-xl',
),
),
'submit' => array('title' => $this->l('Save'))
),
@@ -214,7 +225,8 @@ class AdminPPreferencesControllerCore extends AdminController
'hint' => $this->l('Number of room types displayed per page. Default is 10.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text'
'type' => 'text',
'class' => 'fixed-width-xxl',
),
'PS_PRODUCTS_ORDER_BY' => array(
'title' => $this->l('Default order by'),
@@ -309,7 +321,8 @@ class AdminPPreferencesControllerCore extends AdminController
),
'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => array(
'title' => $this->l('Show category filter for service products'),
'title' => $this->l('Display services by category'),
'hint' => $this->l('If enabled, services will be grouped and displayed as per their default category. Else all services will be displayed together.'),
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
@@ -321,7 +334,8 @@ class AdminPPreferencesControllerCore extends AdminController
'hint' => $this->l('Number of hotel images displayed per page. Default is 9.'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text'
'type' => 'text',
'class' => 'fixed-width-xxl',
),
),
'submit' => array('title' => $this->l('Save'))

View File

@@ -95,8 +95,8 @@ class AdminPreferencesControllerCore extends AdminController
$fields = array(
'PS_SSL_ENABLED' => array(
'title' => $this->l('Enable SSL'),
'desc' => $this->l('If you own an SSL certificate for your shop\'s domain name, you can activate SSL encryption (https://) for customer account identification and order processing.'),
'hint' => $this->l('If you want to enable SSL on all the pages of your shop, activate the "Enable on all the pages" option below.'),
'desc' => $this->l('If you own an SSL certificate for your website\'s domain name, you can activate SSL encryption (https://) for customer account identification and order processing.'),
'hint' => $this->l('If you want to enable SSL on all the pages of your website, activate the "Enable on all the pages" option below.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
@@ -106,7 +106,7 @@ class AdminPreferencesControllerCore extends AdminController
$fields['PS_SSL_ENABLED_EVERYWHERE'] = array(
'title' => $this->l('Enable SSL on all pages'),
'desc' => $this->l('When enabled, all the pages of your shop will be SSL-secured.'),
'desc' => $this->l('When enabled, all the pages of your website will be SSL-secured.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
@@ -221,7 +221,7 @@ class AdminPreferencesControllerCore extends AdminController
if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED')) {
$fields['PS_SSL_ENABLED']['type'] = 'disabled';
$fields['PS_SSL_ENABLED']['disabled'] = '<a class="btn btn-link" href="https://'.Tools::getShopDomainSsl().Tools::safeOutput($_SERVER['REQUEST_URI']).'">'.
$this->l('Please click here to check if your shop supports HTTPS.').'</a>';
$this->l('Please click here to check if your website supports HTTPS.').'</a>';
}
$this->fields_options = array(

View File

@@ -2442,61 +2442,104 @@ class AdminProductsControllerCore extends AdminController
$time = time();
$kpis = array();
// if (Configuration::get('PS_STOCK_MANAGEMENT')) {
// $helper = new HelperKpi();
// $helper->id = 'box-products-stock';
// $helper->icon = 'icon-archive';
// $helper->color = 'color1';
// $helper->title = $this->l('Out of stock items', null, null, false);
// if (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK') !== false) {
// $helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK');
// }
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=percent_product_out_of_stock';
// $helper->tooltip = $this->l('X% of your room types for sale are out of stock.', null, null, false);
// $helper->refresh = (bool)(ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK_EXPIRE') < $time);
// $helper->href = Context::getContext()->link->getAdminLink('AdminProducts').'&productFilter_sav!quantity=0&productFilter_active=1&submitFilterproduct=1';
// $kpis[] = $helper->generate();
// }
$helper = new HelperKpi();
$helper->id = 'box-avg-gross-margin';
$helper->icon = 'icon-tags';
$helper->color = 'color2';
$helper->title = $this->l('Average Gross Margin %', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
$helper->tooltip = $this->l('Gross margin expressed in percentage assesses how cost-effectively you sell your room types / products. Out of $100, you will retain $X to cover profit and expenses.', null, null, false);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-8020-sales-catalog';
$helper->icon = 'icon-beaker';
$helper->id = 'box-total-rooms';
$helper->icon = 'icon-bed';
$helper->color = 'color3';
$helper->title = $this->l('Purchased References', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=8020_sales_catalog';
$helper->tooltip = $this->l('X% of your references have been purchased for the past 30 days.', null, null, false);
if (Module::isInstalled('statsbestproducts')) {
$helper->href = Context::getContext()->link->getAdminLink('AdminStats').'&module=statsbestproducts&datepickerFrom='.date('Y-m-d', strtotime('-30 days')).'&datepickerTo='.date('Y-m-d');
}
$kpis[] = $helper->generate();
$helper->title = $this->l('Total Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_rooms';
$helper->tooltip = $this->l('The total number of rooms in all hotels.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-disabled-products';
$helper->icon = 'icon-off';
$helper->id = 'box-occupied-rooms';
$helper->icon = 'icon-user';
$helper->color = 'color1';
$helper->title = $this->l('Occupied Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=occupied_rooms';
$helper->tooltip = $this->l('The current count of rooms that are currently occupied by guests.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-vacant-rooms';
$helper->icon = 'icon-check-empty';
$helper->color = 'color3';
$helper->title = $this->l('Vacant Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=vacant_rooms';
$helper->tooltip = $this->l('The count of rooms that are currently unoccupied and available for booking.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-reserved-rooms';
$helper->icon = 'icon-calendar';
$helper->color = 'color4';
$helper->href = $this->context->link->getAdminLink('AdminProducts');
$helper->title = $this->l('Booked Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=booked_rooms';
$helper->tooltip = $this->l('The number of rooms that are currently booked but not yet occupied.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-disabled-rooms';
$helper->icon = 'icon-ban';
$helper->color = 'color2';
$helper->title = $this->l('Disabled Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_rooms';
$helper->tooltip = $this->l('The number of rooms that are currently disabled.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-online-bookable-rooms';
$helper->icon = 'icon-globe';
$helper->color = 'color4';
$helper->title = $this->l('Online Bookable Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=online_bookable_rooms';
$helper->tooltip = $this->l('The total number of rooms that can be booked only using website.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-offline-bookable-rooms';
$helper->icon = 'icon-building';
$helper->color = 'color1';
$helper->title = $this->l('Offline Bookable Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=offline_bookable_rooms';
$helper->tooltip = $this->l('The number of rooms that can be booked either through website or offline channels (e.g., phone or in-person).', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-best-selling-room-type';
$helper->icon = 'icon-star';
$helper->color = 'color1';
$helper->title = $this->l('Best Selling', null, null, false);
$nbDaysBestSelling = Validate::isUnsignedInt(Configuration::get('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS')) ? Configuration::get('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS') : 30;
$helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysBestSelling);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=best_selling_room_type';
$helper->tooltip = $this->l('Displays the best selling room type based on the last 30 days of sales.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-disbled-room-types';
$helper->icon = 'icon-ban';
$helper->color = 'color2';
$helper->title = $this->l('Disabled Room Types', null, null, false);
if (ConfigurationKPI::get('DISABLED_ROOM_TYPES') !== false) {
$helper->value = ConfigurationKPI::get('DISABLED_ROOM_TYPES');
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_room_types';
$helper->refresh = (bool)(ConfigurationKPI::get('DISABLED_ROOM_TYPES_EXPIRE') < $time);
$helper->tooltip = $this->l('X% of your room types are disabled and not visible to your customers', null, null, false);
$helper->href = Context::getContext()->link->getAdminLink('AdminProducts').'&productFilter_sa!active=0&submitFilterproduct=1';
$kpis[] = $helper->generate();
$helper->tooltip = $this->l('The total number of room types that are currently disabled.', null, null, false);
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}

View File

@@ -176,22 +176,29 @@ class AdminStatsControllerCore extends AdminStatsTabController
'.Shop::addSqlAssociation('category', 'c'));
}
public static function getDisabledRoomTypes()
public static function getDisabledRoomTypes($idHotel = null)
{
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (hrt.`id_product` = p.`id_product`)
'.Shop::addSqlAssociation('product', 'p').'
WHERE product_shop.active = 0 AND p.`booking_product` = 1');
WHERE product_shop.active = 0 AND p.`booking_product` = 1'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : ''));
}
public static function getTotalRoomTypes()
public static function getTotalRoomTypes($idHotel = null)
{
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (hrt.`id_product` = p.`id_product`)
'.Shop::addSqlAssociation('product', 'p').'
WHERE p.`booking_product` = 1');
WHERE p.`booking_product` = 1'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : '')
);
}
public static function getDisabledProducts()
@@ -341,7 +348,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
SELECT SUM(IF(c.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral
FROM `'._DB_PREFIX_.'customer` c
LEFT JOIN `'._DB_PREFIX_.'gender` g ON c.id_gender = g.id_gender
WHERE c.active = 1 '.Shop::addSqlRestriction());
WHERE c.active = 1 AND c.deleted = 0 '.Shop::addSqlRestriction());
if (!$row['total']) {
return false;
@@ -397,16 +404,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $row;
}
public static function getAverageCustomerAge()
{
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT AVG(DATEDIFF("'.date('Y-m-d').' 00:00:00", birthday))
FROM `'._DB_PREFIX_.'customer` c
WHERE active = 1
AND birthday IS NOT NULL AND birthday != "0000-00-00" '.Shop::addSqlRestriction());
return round($value / 365);
}
public static function getPendingMessages()
{
return CustomerThread::getTotalCustomerThreads('status LIKE "%pending%" OR status = "open"'.Shop::addSqlRestriction());
@@ -547,6 +544,28 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $expenses;
}
public static function getBestSellingRoomType($dateFrom, $dateTo, $idHotel = null)
{
$sql = 'SELECT p.`id_product`,
(
SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($dateTo).'"), GREATEST(hbd.`date_from`, "'.pSQL($dateFrom).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * hbd.`total_price_tax_excl`, 2)), 0)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'orders` o
ON (o.`id_order` = hbd.`id_order`)
WHERE hbd.`id_product` = p.`id_product` AND o.`valid` = 1
AND hbd.`date_to` > "'.pSQL($dateFrom).'" AND hbd.`date_from` < "'.pSQL($dateTo).'"
) AS totalRevenue
FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (hrt.`id_product` = p.`id_product`)
WHERE p.`active` = 1 AND p.`booking_product` = 1'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : '').'
HAVING totalRevenue > 0
ORDER BY totalRevenue DESC';
return Db::getInstance()->getValue($sql);
}
public function displayAjaxGetKpi()
{
$value = $this->getLatestKpiValue(Tools::getValue('kpi'));
@@ -566,17 +585,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
$value = false;
switch ($kpi) {
case 'conversion_rate':
$visitors = AdminStatsController::getVisits(true, date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false /*'day'*/);
$orders = AdminStatsController::getOrders(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false /*'day'*/);
$nbDaysConversionRate = Validate::isUnsignedInt(Configuration::get('PS_KPI_CONVERSION_RATE_NB_DAYS')) ? Configuration::get('PS_KPI_CONVERSION_RATE_NB_DAYS') : 30;
// $data = array();
// $from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
// $to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
// for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
// if (isset($visitors[$date]) && $visitors[$date])
// $data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visitors[$date], 2);
// else
// $data[$date] = 0;
$visitors = AdminStatsController::getVisits(
true,
date('Y-m-d', strtotime('-'.($nbDaysConversionRate + 1).' day')),
date('Y-m-d', strtotime('-1 day')),
false /*'day'*/
);
$orders = AdminStatsController::getOrders(
date('Y-m-d', strtotime('-'.($nbDaysConversionRate + 1).' day')),
date('Y-m-d', strtotime('-1 day')),
false /*'day'*/
);
$visits_sum = $visitors; //array_sum($visitors);
$orders_sum = $orders; //array_sum($orders);
@@ -629,11 +651,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
break;
case 'disabled_room_types':
if (AdminStatsController::getTotalRoomTypes()) {
$value = round(100 * AdminStatsController::getDisabledRoomTypes() / AdminStatsController::getTotalRoomTypes(), 2).'%';
} else {
$value = '0%';
}
$value = AdminStatsController::getDisabledRoomTypes(0);
ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES', $value);
ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES_EXPIRE', strtotime('+2 hour'));
break;
@@ -670,10 +688,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
break;
case 'avg_customer_age':
$value = sprintf($this->l('%d years', null, null, false), AdminStatsController::getAverageCustomerAge(), 1);
break;
case 'pending_messages':
$value = (int)AdminStatsController::getPendingMessages();
break;
@@ -696,22 +710,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
$value = round(AdminStatsController::getMessagesPerThread(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))), 1);
break;
case 'newsletter_registrations':
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'customer`
WHERE newsletter = 1
'.Shop::addSqlRestriction(Shop::SHARE_ORDER));
if (Module::isInstalled('blocknewsletter')) {
$value += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'newsletter`
WHERE active = 1
'.Shop::addSqlRestriction(Shop::SHARE_ORDER));
}
break;
case 'enabled_languages':
$value = Language::countActiveLanguages();
break;
@@ -798,17 +796,106 @@ class AdminStatsControllerCore extends AdminStatsTabController
}
break;
case 'best_selling_room_type':
$nbDaysBestSelling = Validate::isUnsignedInt(Configuration::get('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS')) ? Configuration::get('PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS') : 30;
if (!($idProduct = AdminStatsController::getBestSellingRoomType(
date('Y-m-d', strtotime('-'.($nbDaysBestSelling + 1).' day')),
date('Y-m-d', strtotime('-1 day')),
0
))) {
$value = $this->l('--', null, null, false);
} else {
$objProduct = new Product($idProduct, false, $this->context->language->id);
$value = $objProduct->name;
}
break;
case 'total_rooms':
$value = AdminStatsController::getTotalRooms(0);
break;
case 'occupied_rooms':
$value = AdminStatsController::getOccupiedRooms(0);
break;
case 'vacant_rooms':
$totalAvailableRooms = AdminStatsController::getAvailableRoomsForDiscreteDates(date('Y-m-d'), null, 0);
$totalAvailableRooms = $totalAvailableRooms[strtotime(date('Y-m-d'))];
$totalOccupiedRooms = AdminStatsController::getOccupiedRooms(0);
$value = $totalAvailableRooms - $totalOccupiedRooms;
break;
case 'booked_rooms':
$value = AdminStatsController::getBookedRooms(0);
break;
case 'disabled_rooms':
$value = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0);
$value = $value[strtotime(date('Y-m-d'))];
break;
case 'online_bookable_rooms':
$value = AdminStatsController::getAvailableRoomsForDiscreteDates(date('Y-m-d'), null, 0, 1);
$value = $value[strtotime(date('Y-m-d'))];
break;
case 'offline_bookable_rooms':
$value = AdminStatsController::getAvailableRoomsForDiscreteDates(date('Y-m-d'), null, 0);
$value = $value[strtotime(date('Y-m-d'))];
break;
case 'total_frequent_customers':
$nbOrdersFrequentCustomers = Configuration::get('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS');
$value = AdminStatsController::getTotalFrequentCustomers($nbOrdersFrequentCustomers, 0);
break;
case 'revenue_per_available_customer':
$nbDaysRevPac = Configuration::get('PS_KPI_REVPAC_NB_DAYS');
$value = AdminStatsController::getRevenuePerAvailableCustomer(
date('Y-m-d', strtotime('-'.($nbDaysRevPac + 1).' day')),
date('Y-m-d', strtotime('-1 day')),
0
);
$value = Tools::displayPrice($value, $currency);
break;
case 'total_newsletter_registrations':
$value = AdminStatsController::getTotalNewsletterRegistrations();
break;
case 'total_new_customers':
$nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30;
$value = AdminStatsController::getTotalNewCustomers($nbDaysNewCustomers);
break;
case 'total_banned_customers':
$value = AdminStatsController::getTotalBannedCustomers();
break;
default:
$value = false;
}
if ($value !== false) {
$array = array('value' => $value);
if (isset($data)) {
$array['data'] = $data;
}
die(json_encode($array));
}
die(json_encode(array('has_errors' => true)));
return $value;
}
public static function getFrontOfficeTranslations()
@@ -936,12 +1023,16 @@ class AdminStatsControllerCore extends AdminStatsTabController
);
}
public static function getTotalRooms($idHotel = false)
public static function getTotalRooms($idHotel = null)
{
return Db::getInstance()->getValue(
'SELECT COUNT(`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri
WHERE 1'.HotelBranchInformation::addHotelRestriction($idHotel, 'hri')
);
$sql = 'SELECT COUNT(hri.`id`)
FROM `'._DB_PREFIX_.'htl_room_information` hri
INNER JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`booking_product` = 1 '.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '');
return Db::getInstance()->getValue($sql);
}
public static function getOccupancyData($dateFrom, $dateTo, $idsHotel = false)
@@ -1099,12 +1190,12 @@ class AdminStatsControllerCore extends AdminStatsTabController
public static function getRevenue($dateFrom, $dateTo, $idHotel = false, $orderSource = '')
{
$sql = 'SELECT SUM(total_paid_tax_excl - refunded_amount)
FROM (SELECT o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl,
IFNULL(orr.`refunded_amount`, 0) AS refunded_amount,
(SELECT hbd.`id_hotel` FROM`'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order` LIMIT 1) AS id_hotel
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `' ._DB_PREFIX_.'order_return` orr ON orr.`id_order` = o.`id_order`
WHERE o.`valid` = 1 AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"';
FROM (SELECT o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl,
(SELECT IFNULL(SUM(orr.`refunded_amount`), 0) FROM`'._DB_PREFIX_.'order_return` orr WHERE orr.`id_order` = o.`id_order`) AS refunded_amount,
(SELECT hbd.`id_hotel` FROM`'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order` LIMIT 1) AS id_hotel
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`valid` = 1 AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"';
if ($orderSource) {
$sql .= ' AND o.`source` = "'.pSQL($orderSource).'"';
@@ -1482,7 +1573,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
/**
* total available (unoccupied) for each date
*/
public static function getAvailableRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true)
public static function getAvailableRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $showAtFront = null, $useCache = true)
{
$dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo;
$discreteDates = array();
@@ -1500,7 +1591,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$result = array();
foreach ($discreteDates as $discreteDate) {
$cacheKey = 'AdminStats::getAvailableRoomsForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'.
(!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel));
(is_null($showAtFront) ? 'null_' : (int) $showAtFront).(!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel));
if (!Cache::isStored($cacheKey) || !$useCache) {
$sql = 'SELECT (num_total - num_booked - num_inactive - num_temporarily_inactive) AS num_available
FROM (
@@ -1510,6 +1601,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`active` = 1'.
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_total,
(
@@ -1519,11 +1611,77 @@ class AdminStatsControllerCore extends AdminStatsTabController
ON (hri.`id` = hbd.`id_room`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`active` = 1
WHERE p.`active` = 1'.
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').'
AND hbd.`is_refunded` = 0
AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
) AS num_booked,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_INACTIVE.'
AND p.`active` = 1'.
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_inactive,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
ON (hrdd.`id_room` = hri.`id`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
AND p.`active` = 1'.
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_temporarily_inactive
) AS t';
$value = Db::getInstance()->getValue($sql);
Cache::store($cacheKey, $value);
}
$result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey);
}
return $result;
}
public static function getDisabledRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true)
{
$dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo;
$discreteDates = array();
$dateTemp = $dateFrom;
while ($dateTemp <= $dateTo) {
$dateNext = date('Y-m-d', strtotime('+1 day', strtotime($dateTemp)));
$discreteDates[] = array(
'date_from' => $dateTemp,
'date_to' => $dateNext,
'timestamp_from' => strtotime($dateTemp),
);
$dateTemp = $dateNext;
};
$result = array();
foreach ($discreteDates as $discreteDate) {
$cacheKey = 'AdminStats::getDisabledRoomsForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'.
(!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel));
if (!Cache::isStored($cacheKey) || !$useCache) {
$sql = 'SELECT (num_room_type_disabled + num_inactive + num_temporarily_inactive) AS num_disabled
FROM (
SELECT (
SELECT IFNULL(COUNT(hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`active` = 0'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
) AS num_room_type_disabled,
(
SELECT IFNULL(COUNT(hri.`id`), 0)
FROM `'._DB_PREFIX_.'htl_room_information` hri
@@ -1557,6 +1715,121 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $result;
}
/**
* Returns the number of rooms that have been checked-in.
*/
public static function getOccupiedRooms($idHotel = null)
{
$sql = 'SELECT COUNT(DISTINCT hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri
ON (hri.`id` = hbd.`id_room`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`active` = 1
AND hbd.`is_refunded` = 0
AND hbd.`is_cancelled` = 0
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
$result = Db::getInstance()->getValue($sql);
return $result;
}
/**
* Returns the number of rooms that have been booked but not checked-in yet.
*/
public static function getBookedRooms($idHotel = null)
{
$dateToday = date('Y-m-d');
$sql = 'SELECT COUNT(DISTINCT hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`is_refunded` = 0
AND hbd.`is_cancelled` = 0
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_ALLOTED.'
AND hbd.`date_from` = "'.pSQL($dateToday).' 00:00:00"'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
$result = Db::getInstance()->getValue($sql);
return $result;
}
public static function getTotalFrequentCustomers($nbOrders = 5, $idHotel = null)
{
$sql = 'SELECT COUNT(t.`id_customer`)
FROM (
SELECT o.`id_customer`, COUNT(o.`id_order`) AS nb_orders,
(
SELECT hbd.`id_hotel`
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
WHERE hbd.`id_order` = o.`id_order` LIMIT 1
) AS id_hotel
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`valid` = 1
GROUP BY o.`id_customer`
HAVING 1 '.(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel) : '').'
) AS t
WHERE t.`nb_orders` >= '.(int) $nbOrders;
$result = Db::getInstance()->getValue($sql);
return $result;
}
public static function getRevenuePerAvailableCustomer($dateFrom, $dateTo, $idHotel = null)
{
$totalRevenue = self::getRevenue($dateFrom, $dateTo, $idHotel);
$totalCustomers = Db::getInstance()->getValue(
'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`date_add` <= "'.pSQL($dateTo).' 23:59:59"'
);
return $totalCustomers ? $totalRevenue / $totalCustomers : 0;
}
public static function getTotalNewsletterRegistrations()
{
$customerRegistrations = Db::getInstance()->getValue(
'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`newsletter` = 1'
);
$visitorRegistrations = 0;
if (Module::isInstalled('blocknewsletter')) {
$visitorRegistrations = Db::getInstance()->getValue(
'SELECT COUNT(n.`id`)
FROM `'._DB_PREFIX_.'newsletter` n
WHERE n.`active` = 1'
);
}
return $customerRegistrations + $visitorRegistrations;
}
public static function getTotalNewCustomers($nbDaysNewCustomers)
{
$maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day'));
$sql = 'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0';
$result = Db::getInstance()->getValue($sql);
return $result;
}
public static function getTotalBannedCustomers()
{
$sql = 'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`deleted` = 1';
$result = Db::getInstance()->getValue($sql);
return $result;
}
public static function getOccupancyRateForDiscreteDates($dateFrom, $dateTo, $idHotel = null)
{
if ($dateFrom == $dateTo) {

View File

@@ -1366,7 +1366,7 @@ class AdminTranslationsControllerCore extends AdminController
$helper->href = $this->context->link->getAdminLink('AdminLanguages');
$helper->title = $this->l('Enabled Languages', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=enabled_languages';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-fo-translations';
@@ -1374,7 +1374,7 @@ class AdminTranslationsControllerCore extends AdminController
$helper->color = 'color3';
$helper->title = $this->l('Front office Translations', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=frontoffice_translations';
$kpis[] = $helper->generate();
$kpis[] = $helper;
$helper = new HelperKpi();
$helper->id = 'box-bo-translations';
@@ -1386,7 +1386,11 @@ class AdminTranslationsControllerCore extends AdminController
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=backoffice_translations';
$helper->refresh = (bool)(ConfigurationKPI::get('BACKOFFICE_TRANSLATIONS_EXPIRE') < $time);
$kpis[] = $helper->generate();
$kpis[] = $helper;
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
'kpis' => &$kpis,
));
$helper = new HelperKpiRow();
$helper->kpis = $kpis;

View File

@@ -66,6 +66,7 @@ class HistoryControllerCore extends FrontController
}
$this->context->smarty->assign(array(
'orders' => $orders,
'overbooking_order_states' => OrderState::getOverBookingStates(),
'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
'reorderingAllowed' => !(bool)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'),
'slowValidation' => Tools::isSubmit('slowvalidation')

View File

@@ -679,6 +679,7 @@ class OrderDetailControllerCore extends FrontController
'invoice' => (OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection())),
'logable' => (bool) $order_status->logable,
'order_history' => $order->getHistory($this->context->language->id, false, true),
'overbooking_order_states' => OrderState::getOverBookingStates(),
'products' => $products,
'discounts' => $order->getCartRules(),
'carrier' => $carrier,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -95,6 +95,9 @@
<configuration id="PS_NB_DAYS_NEW_PRODUCT" name="PS_NB_DAYS_NEW_PRODUCT">
<value>20</value>
</configuration>
<configuration id="PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS" name="PS_KPI_BEST_SELLING_ROOM_TYPE_NB_DAYS">
<value>30</value>
</configuration>
<configuration id="PS_SSL_ENABLED" name="PS_SSL_ENABLED">
<value>0</value>
</configuration>
@@ -332,6 +335,12 @@
<configuration id="PS_GUEST_CHECKOUT_ENABLED" name="PS_GUEST_CHECKOUT_ENABLED">
<value>0</value>
</configuration>
<configuration id="PS_OVERBOOKING_ORDER_ACTION" name="PS_OVERBOOKING_ORDER_ACTION">
<value>1</value>
</configuration>
<configuration id="PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY" name="PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY">
<value>0</value>
</configuration>
<configuration id="PS_ORDER_CONF_MAIL_TO_CUSTOMER" name="PS_ORDER_CONF_MAIL_TO_CUSTOMER">
<value>1</value>
</configuration>
@@ -431,6 +440,9 @@
<configuration id="PS_OS_OVERBOOKING_UNPAID" name="PS_OS_OVERBOOKING_UNPAID">
<value>11</value>
</configuration>
<configuration id="PS_OS_OVERBOOKING_PARTIAL_PAID" name="PS_OS_OVERBOOKING_PARTIAL_PAID">
<value>12</value>
</configuration>
<!-- <configuration id="PS_OS_AWAITING_PARTIAL_PAYMENT" name="PS_OS_AWAITING_PARTIAL_PAYMENT">
<value>13</value>
</configuration> -->
@@ -884,6 +896,18 @@
<configuration id="PS_CUSTOMER_OPTIN" name="PS_CUSTOMER_OPTIN">
<value>1</value>
</configuration>
<configuration id="PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS" name="PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS">
<value>5</value>
</configuration>
<configuration id="PS_KPI_REVPAC_NB_DAYS" name="PS_KPI_REVPAC_NB_DAYS">
<value>30</value>
</configuration>
<configuration id="PS_KPI_CONVERSION_RATE_NB_DAYS" name="PS_KPI_CONVERSION_RATE_NB_DAYS">
<value>30</value>
</configuration>
<configuration id="PS_KPI_NEW_CUSTOMERS_NB_DAYS" name="PS_KPI_NEW_CUSTOMERS_NB_DAYS">
<value>30</value>
</configuration>
<configuration id="PS_PACK_STOCK_TYPE" name="PS_PACK_STOCK_TYPE">
<value>0</value>
</configuration>

View File

@@ -26,7 +26,7 @@
</order_state>
<order_state id="Payment_error" invoice="0" send_email="1" color="#8f0621" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
</order_state>
<order_state id="Overbooking_paid" invoice="1" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
<order_state id="Overbooking_paid" invoice="1" send_email="0" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
</order_state>
<order_state id="Partial_payment_accepted" invoice="1" send_email="1" color="#F0B656" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
</order_state>
@@ -34,7 +34,9 @@
</order_state>
<order_state id="Payment_remotely_accepted" invoice="1" send_email="0" color="#32CD32" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
</order_state>
<order_state id="Overbooking_unpaid" invoice="0" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
<order_state id="Overbooking_unpaid" invoice="0" send_email="0" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
</order_state>
<order_state id="Overbooking_partial_paid" invoice="0" send_email="0" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
</order_state>
</entities>
</entity_order_state>

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -33,11 +33,15 @@
<template/>
</order_state>
<order_state id="Overbooking_paid">
<name>Overbooking (paid)</name>
<name>Overbooking (Paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_unpaid">
<name>Overbooking (not paid)</name>
<name>Overbooking (Not paid)</name>
<template/>
</order_state>
<order_state id="Overbooking_partial_paid">
<name>Overbooking (Partial payment)</name>
<template/>
</order_state>
<order_state id="Partial_payment_accepted">

View File

@@ -504,6 +504,14 @@ function changeCMSActivationAuthorization()
getE('PS_CONDITIONS_CMS_ID').disabled = 'disabled';
}
function changeOverbookingOrderAction()
{
if (getE('PS_OVERBOOKING_ORDER_ACTION').value == $("input[name='OVERBOOKING_ORDER_CANCEL_ACTION']").val())
$('#PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY').closest('.form-group').hide();
else
$('#PS_MAX_OVERBOOKING_PER_HOTEL_PER_DAY').closest('.form-group').show();
}
function disableZipFormat()
{
if ($('#need_zip_code_on').prop('checked') == false)
@@ -1573,6 +1581,61 @@ function refresh_kpis()
});
}
$(document).on('change', '.kpi-container .kpi-display-toggle', function (e) {
let kpiCheckbox = $(this);
let isVisible = parseInt(kpiCheckbox.is(':checked') & 1);
// hide or show the KPI
$('#' + kpiCheckbox.attr('data-kpi-id')).parent().toggle(isVisible);
// save visibility state to cookie
$.ajax({
type: 'POST',
headers: { 'cache-control': 'no-cache' },
url: window.location,
cache: false,
dataType: 'json',
data: {
ajax: 1,
controller: help_class_name,
action: 'changeKpiVisibility',
kpi_id: kpiCheckbox.attr('data-kpi-id'),
is_visible: isVisible,
}
});
// at least one KPI must be displayed
if ($(kpiCheckbox).closest('.actions-wrap').find('.kpi-display-toggle:checked').length == 1) {
$(kpiCheckbox).closest('.actions-wrap').find('.kpi-display-toggle:checked').attr('disabled', true);
} else {
$(kpiCheckbox).closest('.actions-wrap').find('.kpi-display-toggle').attr('disabled', false);
}
});
// prevent dropdown from closing on clicking its body
$(document).on('click', '.kpi-container .dropdown-menu', function (e) {
e.stopPropagation();
});
function toggleKpiView() {
$('.kpi-container').toggleClass('no-wrapping'); // default view is to wrap KPIs
// save view to cookie
$.ajax({
type: 'POST',
headers: { 'cache-control': 'no-cache' },
url: window.location,
cache: false,
dataType: 'json',
data: {
ajax: 1,
controller: help_class_name,
action: 'saveKpiView',
no_wrapping: parseInt($('.kpi-container').hasClass('no-wrapping') & 1),
}
});
}
function createSqlQueryName()
{
var container = false;

View File

@@ -1844,6 +1844,11 @@ $(document).on('click', '#booking-documents-modal .documents-list .btn-delete-do
}
});
$(document).on('click', '.reallocate_overbooking', function(e) {
e.preventDefault();
$('#reallocate_room_' + $(this).attr('id_htl_booking')).trigger('click');
});
const BookingDocumentsModal = {
init: function(idHtlBooking, $this) {
BookingDocumentsModal.currentTr = $this;

381
mails/en/overbooking.html Executable file
View File

@@ -0,0 +1,381 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Message from {shop_name}</title>
<style> @media only screen and (max-width: 300px){
body {
width:218px !important;
margin:auto !important;
}
thead, tbody{width: 100%}
.table {width:195px !important;margin:auto !important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
span.title{font-size:20px !important;line-height: 23px !important}
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
td.box p{font-size: 12px !important;font-weight: bold !important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 200px!important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
@media only screen and (min-width: 301px) and (max-width: 500px) {
body {width:425px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 295px !important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.table-recap tr th{font-size: 10px !important}
}
@media only screen and (min-width: 501px) and (max-width: 768px) {
body {width:478px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
}
@media only screen and (max-device-width: 480px) {
body {width:340px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 295px!important;}
.table-recap tr td, .conf_body td{text-align:center!important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
</style>
</head>
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
<td align="center" style="padding:7px 0">
<table class="table" bgcolor="#ffffff" style="width:100%">
<tr>
<td align="center" class="logo" style="border-bottom:4px solid #333333;padding:7px 0">
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
<img src="{shop_logo}" alt="{shop_name}" />
</a>
</td>
</tr>
<tr>
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">Thank you for selecting our hotel!</span><br/><br/>
<span class="subtitle" style="font-weight:600;font-size:16px;line-height:25px">Bookings in this order are Not Confirmed yet !!</span><br/>
<span class="subtitle" style="font-weight:500;font-size:14px;line-height:25px">We are sorry for your inconvenience. Please contact hotel to get final confirmation for your bookings.</span>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td width="10" style="padding:7px 0">&nbsp;</td>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">Order details</p>
<span style="color:#777">
<span style="color:#333"><strong>Order:</strong></span> {order_name} Placed on {date}<br /><br />
<span style="color:#333"><strong>Payment:</strong></span> {payment}<br /><br />
<span style="color:#333"><strong>Status:</strong></span> <span style="background-color: {order_status_color}; color: #FFF; padding: 5px 10px; border-radius: 2px; font-weight: 600;">{order_status}</span>
</span>
</font>
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tbody>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
<tr>
<td style="text-align:center;color:#777;padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<td colspan="2" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{discounts}
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Extra Services Cost </strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_tax_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td style="padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td class="box address" width="310" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td width="10" style="padding:7px 0">&nbsp;</td>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
Customer address </p>
<span data-html-only="1" style="color:#777">
{invoice_block_html}
</span>
</font>
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="linkbelow" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span>
You can review your order and download your invoice from the <a href="{history_url}" style="color:#337ff1">"Order history"</a> section of your customer account by clicking <a href="{my_account_url}" style="color:#337ff1">"My account"</a> on our shop. </span>
</font>
</td>
</tr>
<tr>
<td class="linkbelow" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span>
If you have a guest account, you can follow your order via the <a href="{guest_tracking_url}?id_order={order_name}" style="color:#337ff1">"Guest Tracking"</a> section on our shop.</span>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="footer" style="border-top:4px solid #333333;padding:7px 0">
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="https://webkul.com" style="color:#337ff1">Webkul&trade;</a></span>
</td>
</tr>
</table>
</td>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
</tr>
</table>
</body>
</html>

60
mails/en/overbooking.txt Normal file
View File

@@ -0,0 +1,60 @@
Message from {shop_name}
Hi {firstname} {lastname},
Thank you for selecting our hotel!
Bookings in this order are Not Confirmed yet !!
We are sorry for your inconvenience. Please contact hotel to get final confirmation for your bookings.
Order details
Order: {order_name} Placed on {date}
Payment: {payment}
Status: {order_status}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
{discounts}
Total Rooms Cost
{total_products}
Total Extra Services Cost
{total_extra_demands_te}
Discounts
{total_discounts}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Final Booking Amount
{total_paid}
Customer address
{invoice_block_html}
You can review your order and download your invoice from the
"Order history" [{history_url}] section of your
customer account by clicking "My account"
[{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking"
[{guest_tracking_url}?id_order={order_name}] section
on our shop.
{shop_name} [{shop_url}] powered by
Webkul(tm) [https://webkul.com]

353
mails/en/overbooking_admin.html Executable file
View File

@@ -0,0 +1,353 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Message from {shop_name}</title>
<style> @media only screen and (max-width: 300px){
body {
width:218px !important;
margin:auto !important;
}
thead, tbody{width: 100%}
.table {width:195px !important;margin:auto !important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
span.title{font-size:20px !important;line-height: 23px !important}
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
td.box p{font-size: 12px !important;font-weight: bold !important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 200px!important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
@media only screen and (min-width: 301px) and (max-width: 500px) {
body {width:425px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 295px !important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.table-recap tr th{font-size: 10px !important}
}
@media only screen and (min-width: 501px) and (max-width: 768px) {
body {width:478px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
}
@media only screen and (max-device-width: 480px) {
body {width:340px!important;margin:auto!important;}
thead, tbody{width: 100%}
.table {margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 295px!important;}
.table-recap tr td, .conf_body td{text-align:center!important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
</style>
</head>
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:800px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
<td align="center" style="padding:7px 0">
<table class="table" bgcolor="#ffffff" style="width:100%">
<tr>
<td align="center" class="logo" style="border-bottom:4px solid #333333;padding:7px 0">
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
<img src="{shop_logo}" alt="{shop_name}" />
</a>
</td>
</tr>
<tr>
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/><br/>
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">New Bookings created on {shop_name}!</span><br/><br/>
<span class="subtitle" style="font-weight:600;font-size:16px;line-height:25px">Bookings in this order have Overbookings !!</span><br/>
<span class="subtitle" style="font-weight:500;font-size:14px;line-height:25px">This order is not confirmed yet. Please check the order details to resolve overbookings.</span>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td width="10" style="padding:7px 0">&nbsp;</td>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
Customer details </p>
<span style="color:#777">
<span style="color:#333"><strong>Name:</strong></span> {customer_name}<br /><br />
<span style="color:#333"><strong>Email:</strong></span> {customer_email}
</span>
</font>
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td width="10" style="padding:7px 0">&nbsp;</td>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
Order details </p>
<span style="color:#777">
<span style="color:#333"><strong>Order:</strong></span> {order_name} Placed on {date}<br /><br />
<span style="color:#333"><strong>Payment:</strong></span> {payment}<br /><br />
<span style="color:#333"><strong>Status:</strong></span> <span style="background-color: {order_status_color}; color: #FFF; padding: 5px 10px; border-radius: 2px; font-weight: 600;">{order_status}</span>
</span>
</font>
</td>
<td width="10" style="padding:7px 0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
<tr>
<tr>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Image</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Room Description</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Hotel</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Room Capcity</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Unit Price</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Rooms Qty</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-in Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Check-out Date</th>
<th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;" width="17%">Total</th>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
&nbsp;&nbsp;{cart_booking_data_html}
</td>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
{extra_demands_details_html}
</td>
</tr>
<tr>
<td colspan="9" style="border:1px solid #D6D4D4;text-align:center;color:#777;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
&nbsp;&nbsp;{discounts}
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Rooms Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{room_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Extra Services Cost</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" align="right" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{additional_service_price_tax_excl}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Discounts</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_discounts}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Convenience Fees</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_convenience_fee_te}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Total Tax</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
{total_tax_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr class="conf_body">
<td bgcolor="#f8f8f8" colspan="4" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<strong>Final Booking Amount</strong>
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#f8f8f8" colspan="5" style="border:1px solid #D6D4D4;color:#333;padding:7px 0">
<table class="table" style="width:100%;border-collapse:collapse">
<tr>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
<td align="right" style="color:#333;padding:0">
<font size="4" face="Open-sans, sans-serif" color="#555454">
{total_paid}
</font>
</td>
<td width="10" style="color:#333;padding:0">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important">&nbsp;</td>
</tr>
<tr>
<td class="footer" style="border-top:4px solid #333333;padding:7px 0">
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="https://webkul.com" style="color:#337ff1">Webkul&trade;</a></span>
</td>
</tr>
</table>
</td>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,51 @@
Message from {shop_name}
Hi {firstname} {lastname},
New Bookings created on {shop_name}!
Bookings in this order have Overbookings !!
This order is not confirmed yet. Please check the order details to resolve overbookings.
Customer details
Name: {customer_name}
Email: {customer_email}
Order details
Order: {order_name} Placed on {date}
Payment: {payment}
Status: {order_status}
Room Image
Room Description
Hotel
Room Capcity
Unit Price
Rooms Qty
Check-in Date
Check-out Date
Total
{cart_booking_data_text}
{extra_demands_details_text}
{discounts}
Total Rooms Cost
{total_products}
Total Extra Services Cost
{total_extra_demands_te}
Discounts
{total_discounts}
Total Rooms Tax
{total_tax_paid}
Extra Services Tax
{extra_demands_tax}
Final Booking Amount
{total_paid}
{shop_name} powered by Webkul&trade;

View File

@@ -55,9 +55,8 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
// Check Order restrict condition before Payment by the customer
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$order_restrict_error = HotelOrderRestrictDate::validateOrderRestrictDateOnPayment($this);
if ($order_restrict_error) {
die($this->errors);
if (HotelOrderRestrictDate::validateOrderRestrictDateOnPayment($this)) {
Tools::redirect('index.php?controller=order-opc');
}
}

View File

@@ -54,9 +54,8 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
/*Check Order restrict condition before Payment by the customer*/
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
$order_restrict_error = HotelOrderRestrictDate::validateOrderRestrictDateOnPayment($this);
if ($order_restrict_error) {
die($this->errors);
if (HotelOrderRestrictDate::validateOrderRestrictDateOnPayment($this)) {
Tools::redirect('index.php?controller=order-opc');
}
}
/*END*/

View File

@@ -168,6 +168,23 @@ class HotelBookingDetail extends ObjectModel
parent::__construct($id);
}
public function update($null_values = false)
{
$result = parent::update($null_values);
// if automatic overbooking resolution is enabled
if (Configuration::get('PS_OVERBOOKING_AUTO_RESOLVE')) {
// if room is getting free and this room is not already in back order then resolve the overbookings for this free room
// $this->is_cancelled == 1 is not checked because currently we always set is_refunded to 1 when room is free
// $this->is_back_order == 0 is checked because $this->is_back_order == 1 is used as room is free
if ($this->is_refunded == 1 && $this->is_back_order == 0) {
$this->resolveOverBookings();
}
}
return $result;
}
public function getBookingDataParams($params)
{
if (!isset($params['id_room_type'])) {
@@ -1956,6 +1973,7 @@ class HotelBookingDetail extends ObjectModel
{
$table = 'htl_booking_detail';
$data = array('is_refunded' => (int) $is_refunded);
if ($id_rooms) {
foreach ($id_rooms as $key_rm => $val_rm) {
$where = 'id_order='.(int)$id_order.' AND id_room = '.(int)$val_rm['id_room'].' AND `date_from`= \''.
@@ -1963,8 +1981,15 @@ class HotelBookingDetail extends ObjectModel
$result = Db::getInstance()->update($table, $data, $where);
}
} else {
return Db::getInstance()->update($table, $data, 'id_order='.(int)$id_order);
$result = Db::getInstance()->update($table, $data, 'id_order='.(int)$id_order);
}
// if automatic overbooking resolution is enabled
if ($result && Configuration::get('PS_OVERBOOKING_AUTO_RESOLVE') && $is_refunded) {
// if room is getting free and this room is not already in back order then resolve the overbookings for this free room
$this->resolveOverBookings();
}
return $result;
}
@@ -3007,4 +3032,191 @@ class HotelBookingDetail extends ObjectModel
return false;
}
/**
* Get overbooked rooms in the order|hotel
* @param [int] $idOrder : id of the order
* @param [int] $idHotel : id of the hotel
* @param [string] $dateFrom
* @param [string] $dateTo
* @param [int] $datewiseBreakup : send 1 to get overbooked rooms in datewise breakup
* @param [int] $roomCount : send 1 to get the count of the rooms overbooked only
* @param [int] $bookedRoomFlag : send 0 for no action | send 1 to get booked room info | send 2 to get overbooked rooms which are free
*
* @return array | integer : array of overbooked rooms | count of overbooked rooms
*/
public function getOverbookedRooms(
$idOrder = 0,
$idHotel = 0,
$dateFrom = '',
$dateTo = '',
$datewiseBreakup = 0,
$roomCount = 0,
$bookedRoomInfoFlag = 0
) {
$result = array();
$sql = 'SELECT';
if ($roomCount) {
$sql .= ' COUNT(*)';
} else {
$sql .= ' *';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_back_order` = 1 AND `is_refunded` = 0 AND `is_cancelled` = 0';
if ($idOrder) {
$sql .= ' AND `id_order` = '.(int) $idOrder;
}
if ($idHotel) {
$sql .= ' AND `id_hotel` = '.(int) $idHotel;
}
if ($datewiseBreakup && $dateFrom && $dateTo) {
for ($currentDate = $dateFrom; $currentDate < $dateTo; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) {
$dateSql = $sql . ' AND `date_from` <= \''.pSQL($currentDate).'\' AND `date_to` > \''.pSQL($currentDate).'\'';
if ($roomCount) {
$result[$currentDate] = Db::getInstance()->getValue($dateSql);
} else {
$result[$currentDate] = Db::getInstance()->executeS($dateSql);
}
}
} else {
if ($dateFrom && $dateTo) {
$sql .= ' AND `date_from` < \''.pSQL($dateTo).'\' AND `date_to` > \''.pSQL($dateFrom).'\'';
}
if ($roomCount) {
$result = Db::getInstance()->getValue($sql);
} else {
$result = Db::getInstance()->executeS($sql);
}
}
if ($bookedRoomInfoFlag && !$roomCount && $result) {
$link = new Link();
foreach ($result as $key => $bookingInfo) {
$result[$key]['booked_room_info'] = $this->chechRoomBooked($bookingInfo['id_room'], $bookingInfo['date_from'], $bookingInfo['date_to']);
$result[$key]['orders_filter_link'] = $link->getAdminLink('AdminOrders');
// if need only rooms which are available to resolve overbooking the unset booked rooms
if ($bookedRoomInfoFlag == 2 && $result[$key]['booked_room_info']) {
unset($result[$key]);
}
}
}
return $result;
}
/**
* Get all the orders which are in overbooking
* @param integer $onlyFutureDates : for orders which bookings dates are in future
* @return array
*/
public function getOverBookedOrders($onlyFutureDates = 0)
{
$sql = 'SELECT DISTINCT `id_order` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_back_order` = 1 AND `is_refunded` = 0 AND `is_cancelled` = 0';
if ($onlyFutureDates) {
$sql .= ' AND `date_to` > \''.pSQL(date('Y-m-d')).'\'';
}
$sql .= ' ORDER BY `id_order` ASC';
$result = Db::getInstance()->executeS($sql);
return array_column($result, 'id_order');
}
// Resolve overbookings by checking current available rooms
// Overbookings resolution will only be done if all overbookings are getting resolved in the order
public function resolveOverBookings($idHotelBooking = 0)
{
$result = false;
$overBookedOrders = array();
if ($idHotelBooking) {
if (Validate::isLoadedObject($objHtlBookingDetail = new HotelBookingDetail($idHotelBooking))) {
$overBookedOrders = array($objHtlBookingDetail->id_order);
}
} else {
$overBookedOrders = $this->getOverBookedOrders(1);
}
if ($overBookedOrders) {
foreach ($overBookedOrders as $idOrder) {
// get all overbooked rooms in the order so that we can decide status of the order after overbooking resolved
$overBookedRooms = $this->getOverbookedRooms($idOrder);
$totalOverBookedInOrder = count($overBookedRooms);
// if request for specific booking resolve
if ($idHotelBooking) {
$overBookedRooms = array((array)($objHtlBookingDetail));
}
if ($overBookedRooms) {
$resolvableOverbookings = array();
foreach($overBookedRooms as $roomBooking) {
$params = array(
'idHotel' => $roomBooking['id_hotel'],
'dateFrom' => $roomBooking['date_from'],
'dateTo' => $roomBooking['date_to'],
'idRoomType' => $roomBooking['id_product'],
'searchOccupancy' => 0,
'allowedIdRoomTypes' => implode(",", array($roomBooking['id_product']))
);
if ($availableRooms = $this->getSearchAvailableRooms($params)) {
if (isset($availableRooms['availableRoomTypes']['roomTypes'][$roomBooking['id_product']]['rooms'])
&& $availableRooms['availableRoomTypes']['roomTypes'][$roomBooking['id_product']]['rooms']
) {
$availableRoomsInfo = $availableRooms['availableRoomTypes']['roomTypes'][$roomBooking['id_product']]['rooms'];
if ($roomIdsAvailable = array_column($availableRoomsInfo, 'id_room')) {
// If room is still there in the available rooms list then we can resolve its overbooking
if (in_array($roomBooking['id_room'], $roomIdsAvailable)) {
$resolvableOverbookings[] = $roomBooking['id'];
}
}
}
}
}
// if request for specific booking Or all overbooked rooms are resolved then resolve the overbooking by setting is_back_order to 0
if ($idHotelBooking || (count($resolvableOverbookings) == $totalOverBookedInOrder)) {
foreach ($resolvableOverbookings as $idHtlBookingDtl) {
$objBookingDetail = new HotelBookingDetail($idHtlBookingDtl);
$objBookingDetail->is_back_order = 0;
$objBookingDetail->update();
$result = true;
}
// After all overbookings are resolved we can update the status of the order
if (count($resolvableOverbookings) == $totalOverBookedInOrder) {
$objOrder = new Order($idOrder);
$idOrderState = 0;
if ($objOrder->current_state == Configuration::get('PS_OS_OVERBOOKING_PAID')) {
$idOrderState = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
} elseif ($objOrder->current_state == Configuration::get('PS_OS_OVERBOOKING_PARTIAL_PAID')) {
$idOrderState = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} elseif ($objOrder->current_state == Configuration::get('PS_OS_OVERBOOKING_UNPAID')) {
$idOrderState = Configuration::get('PS_OS_AWAITING_PAYMENT');
}
// if we have order state to change
if ($idOrderState) {
$objOrderHistory = new OrderHistory();
$objOrderHistory->id_order = (int)$idOrder;
$objOrderHistory->changeIdOrderState((int)$idOrderState, $objOrder, true);
$objOrderHistory->add();
}
}
}
}
}
}
return $result;
}
}

View File

@@ -653,7 +653,7 @@ class HotelBranchInformation extends ObjectModel
return $return;
}
public function addCategory($name, $parent_cat = false, $group_ids, $ishotel = false, $idHotel = false)
public function addCategory($name, $parent_cat = false, $group_ids, $ishotel = false, $idHotel = false, $link_rewrite = false)
{
$context = Context::getContext();
if (!$parent_cat) {
@@ -669,6 +669,15 @@ class HotelBranchInformation extends ObjectModel
$catName,
$parent_cat
)) {
if (is_array($link_rewrite)) {
$objCategory = new Category($categoryExists['id_category']);
foreach (Language::getLanguages() as $lang) {
$objCategory->link_rewrite[$lang['id_lang']] = $link_rewrite[$lang['id_lang']];
}
$objCategory->save();
}
return $categoryExists['id_category'];
} else {
$category = new Category();
@@ -682,7 +691,12 @@ class HotelBranchInformation extends ObjectModel
$category->description[$lang['id_lang']] = $this->moduleInstance->l(
'Hotel Branch Category', 'HotelBranchInformation'
);
$category->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($catName);
if (is_array($link_rewrite)) {
$category->link_rewrite[$lang['id_lang']] = $link_rewrite[$lang['id_lang']];
} else {
$category->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($catName);
}
}
$category->id_parent = $parent_cat;
$category->groupBox = $group_ids;

View File

@@ -482,7 +482,7 @@ class HotelReservationSystemDb
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 1, `id_lang`, 'General Settings', 'Configure Your hotel general gettings using this option.'
SELECT 1, `id_lang`, 'General Settings', 'Configure Your hotel general settings using this option.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",

View File

@@ -205,7 +205,8 @@ class HotelRoomTypeDemand extends ObjectModel
$idCustomer = null,
$idCart = null,
$id_address = null,
Context $context = null
Context $context = null,
$customPrice = null
) {
if (!$context) {
$context = Context::getContext();
@@ -266,7 +267,8 @@ class HotelRoomTypeDemand extends ObjectModel
$useTax,
$decimals,
$idCustomer,
$idCart
$idCart,
$customPrice
);
}
@@ -282,7 +284,8 @@ class HotelRoomTypeDemand extends ObjectModel
$useTax,
$decimals,
$idCustomer = 0,
$idCart = 0
$idCart = 0,
$customPrice = null
) {
static $address = null;
static $context = null;
@@ -310,24 +313,28 @@ class HotelRoomTypeDemand extends ObjectModel
// here get the price of global demand
$objRoomDmdPrice = new HotelRoomTypeDemandPrice();
if ($idOption) {
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption);
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
$idProduct,
$idGlobalDemand,
$idOption
);
if (!Validate::isPrice($price)) {
$price = $objOption->price;
}
if (!is_null($customPrice)) {
$price = $customPrice;
} else {
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand);
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
$idProduct,
$idGlobalDemand
);
if (!Validate::isPrice($price)) {
$price = $objGlobalDemand->price;
if ($idOption) {
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption);
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
$idProduct,
$idGlobalDemand,
$idOption
);
if (!Validate::isPrice($price)) {
$price = $objOption->price;
}
} else {
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand);
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
$idProduct,
$idGlobalDemand
);
if (!Validate::isPrice($price)) {
$price = $objGlobalDemand->price;
}
}
}
$price = Tools::convertPrice($price, $idCurrency);

View File

@@ -112,7 +112,6 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['lang'] = true;
$smartyVars['iso'] = $this->context->language->iso_code;
//lang vars
$currentLangId = $this->default_form_language ? $this->default_form_language : Configuration::get('PS_LANG_DEFAULT');
$smartyVars['languages'] = Language::getLanguages(false);
$smartyVars['currentLang'] = Language::getLanguage((int) $currentLangId);
@@ -129,6 +128,7 @@ class AdminAddHotelController extends ModuleAdminController
if ($this->display == 'edit') {
$idHotel = Tools::getValue('id');
$hotelBranchInfo = new HotelBranchInformation($idHotel);
$objCategory = new Category($hotelBranchInfo->id_category);
$addressInfo = HotelBranchInformation::getAddress($idHotel);
$idCountry = Tools::getValue('hotel_country', $addressInfo['id_country']);
@@ -136,6 +136,7 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['edit'] = 1;
$smartyVars['address_info'] = $addressInfo;
$smartyVars['hotel_info'] = (array) $hotelBranchInfo;
$smartyVars['link_rewrite_info'] = $objCategory->link_rewrite;
//Hotel Images
$objHotelImage = new HotelImage();
if ($hotelAllImages = $objHotelImage->getImagesByHotelId($idHotel)) {
@@ -188,6 +189,7 @@ class AdminAddHotelController extends ModuleAdminController
Media::addJsDef(
array(
'img_dir_l' => _PS_IMG_.'l/',
'PS_ALLOW_ACCENTED_CHARS_URL' => (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'),
)
);
$this->fields_form = array(
@@ -254,6 +256,21 @@ class AdminAddHotelController extends ModuleAdminController
}
}
}
// validate Friendly URL values
if (!trim(Tools::getValue('link_rewrite_'.$defaultLangId))) {
$this->errors[] = $this->l('Friendly URL is required at least in ').
$objDefaultLanguage['name'];
} else {
foreach ($languages as $lang) {
if (trim(Tools::getValue('link_rewrite_'.$lang['id_lang']))) {
if (!Validate::isLinkRewrite(Tools::getValue('link_rewrite_'.$lang['id_lang']))) {
$this->errors[] = $this->l('Invalid Friendly URL in ').$lang['name'];
}
}
}
}
if (!$phone) {
$this->errors[] = $this->l('Phone number is required field.');
} elseif (!Validate::isPhoneNumber($phone)) {
@@ -316,19 +333,19 @@ class AdminAddHotelController extends ModuleAdminController
if (!$enableUseGlobalMaxOrderDate) {
$maximumBookingDateFormatted = date('Y-m-d', strtotime($maximumBookingDate));
if ($maximumBookingDate == '') {
$this->errors[] = Tools::displayError('Maximum Global Date to book a room is a required field.');
$this->errors[] = $this->l('Maximum Check-out Date to book a room is a required field.');
} elseif (!Validate::isDate($maximumBookingDateFormatted)) {
$this->errors[] = Tools::displayError('Maximum Global Date to book a room is invalid.');
$this->errors[] = $this->l('Maximum Check-out Date to book a room is invalid.');
} elseif (strtotime($maximumBookingDateFormatted) < strtotime(date('Y-m-d'))) {
$this->errors[] = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.');
$this->errors[] = $this->l('Maximum Check-out Date to book a room can not be a past date. Please use a future date.');
}
}
if (!$enableUseGlobalPreparationTime) {
if ($preparationTime === '') {
$this->errors[] = Tools::displayError('Preparation time is a required field.');
$this->errors[] = $this->l('Preparation time is a required field.');
} elseif ($preparationTime !== '0' && !Validate::isUnsignedInt($preparationTime)) {
$this->errors[] = Tools::displayError('Preparation time is invalid.');
$this->errors[] = $this->l('Preparation time is invalid.');
}
}
}
@@ -358,6 +375,7 @@ class AdminAddHotelController extends ModuleAdminController
// lang fields
$hotelCatName = array();
$linkRewriteArray = array();
foreach ($languages as $lang) {
if (!trim(Tools::getValue('hotel_name_'.$lang['id_lang']))) {
$objHotelBranch->hotel_name[$lang['id_lang']] = Tools::getValue(
@@ -369,6 +387,16 @@ class AdminAddHotelController extends ModuleAdminController
);
}
if (!trim(Tools::getValue('link_rewrite_'.$lang['id_lang']))) {
$linkRewriteArray[$lang['id_lang']] = Tools::getValue(
'link_rewrite_'.$defaultLangId
);
} else {
$linkRewriteArray[$lang['id_lang']] = Tools::getValue(
'link_rewrite_'.$lang['id_lang']
);
}
$cleanShortDescription = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$lang['id_lang'])
);
@@ -502,7 +530,6 @@ class AdminAddHotelController extends ModuleAdminController
if ($catState) {
if ($catCity = $objHotelBranch->addCategory($city, $catState, $groupIds)) {
$hotelCatName = $objHotelBranch->hotel_name;
// add/update hotel category
if ($objHotelBranch->id_category) {
$objCategory = new Category($objHotelBranch->id_category);
@@ -510,7 +537,7 @@ class AdminAddHotelController extends ModuleAdminController
$objCategory->save();
} else {
if ($catHotel = $objHotelBranch->addCategory(
$hotelCatName, $catCity, $groupIds, 1, $newIdHotel
$hotelCatName, $catCity, $groupIds, 1, $newIdHotel, $linkRewriteArray
)) {
$objHotelBranch = new HotelBranchInformation($newIdHotel);
$objHotelBranch->id_category = $catHotel;

View File

@@ -353,8 +353,8 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
}
$isPlanTypeExists = 0;
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on' && $jsonSpecialDays == "false") {
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
} else {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
@@ -412,14 +412,10 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To must be a date after Date From.');
}
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on') {
$isSpecialDaysExists = 1;
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$isSpecialDaysExists = 0;
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
} else {
$isSpecialDaysExists = 0;
}
} else {
if ($specificDate == '') {

View File

@@ -492,6 +492,12 @@ p.room_cat_data
.week_days {
display: none;
}
.week_days .checkboxes-wrap {
display: flex;
}
.week_days .checkboxes-wrap .day-wrap {
min-width: 50px;
}
.room_type_search_results_ul {
padding: 0px;
background: #ffffff none repeat scroll 0 0;

View File

@@ -580,8 +580,8 @@ $(document).ready(function() {
});
$(".is_special_days_exists").on ('click', function() {
if ($(this).is(':checked')) {
$('[name="is_special_days_exists"]').on('change', function() {
if (parseInt($('[name="is_special_days_exists"]:checked').val())) {
$('.week_days').show(200);
} else {
$('.week_days').hide(200);

View File

@@ -117,14 +117,35 @@
{foreach from=$languages item=language}
{assign var="hotel_name" value="hotel_name_`$language.id_lang`"}
<input type="text"
id="hotel_name_{$language.id_lang}"
id="name_{$language.id_lang}"
name="hotel_name_{$language.id_lang}"
value="{if isset($smarty.post.$hotel_name)}{$smarty.post.$hotel_name|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$hotel_info.hotel_name[{$language.id_lang}]|escape:'htmlall':'UTF-8'}{/if}"
class="form-control wk_text_field_all wk_text_field_{$language.id_lang} copy2friendlyUrl"
maxlength="128"
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
{/foreach}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label required" for="link_rewrite" >
{l s='Friendly URL :' mod='hotelreservationsystem'}
{include file="../../../_partials/htl-form-fields-flag.tpl"}
</label>
<div class="col-lg-6">
{foreach from=$languages item=language}
{assign var="link_rewrite" value="link_rewrite_`$language.id_lang`"}
<input type="text"
id="link_rewrite_{$language.id_lang}"
name="link_rewrite_{$language.id_lang}"
value="{if isset($smarty.post.$link_rewrite)}{$smarty.post.$link_rewrite|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$link_rewrite_info[{$language.id_lang}]|escape:'htmlall':'UTF-8'}{/if}"
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
maxlength="128"
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
{/foreach}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default" onmousedown="updateFriendlyURLByName();"><i class="icon-random"></i> {l s='Generate'}</button>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">
@@ -339,7 +360,7 @@
</div>
</div>
<div class="form-group" {if isset($smarty.post.enable_use_global_max_order_date)}{if !$smarty.post.enable_use_global_max_order_date}style="display:block;"{else}style="display:none;"{/if}{elseif isset($order_restrict_date_info.use_global_max_order_date) && !$order_restrict_date_info.use_global_max_order_date}style="display:block;" {else} style="display:none;" {/if}>
<label class="control-label col-sm-3 required" for="maximum_booking_date">{l s='Maximum Date to book a room :' mod='hotelreservationsystem'}</label>
<label class="control-label col-sm-3 required" for="maximum_booking_date">{l s='Maximum Check-out Date to book a room :' mod='hotelreservationsystem'}</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="maximum_booking_date" name="maximum_booking_date" value="{if isset($smarty.post.maximum_booking_date)}{$smarty.post.maximum_booking_date|escape:'html':'UTF-8'}{elseif isset($edit) && isset($order_restrict_date_info.max_order_date)}{$order_restrict_date_info.max_order_date|escape:'htmlall':'UTF-8'}{/if}" />
</div>
@@ -507,6 +528,7 @@
<script type="text/javascript">
var id_language = {$defaultFormLanguage|intval};
allowEmployeeFormLang = {$allowEmployeeFormLang|intval};
var ps_force_friendly_product = false;
// for tiny mce setup
var iso = "{$iso|escape:'htmlall':'UTF-8'}";

View File

@@ -29,22 +29,7 @@
{if isset($edit)}
<input type="hidden" value="{$objFeaturePrice->id|escape:'html':'UTF-8'}" name="id_feature_price" />
{/if}
<div class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Room Type :' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input autocomplete="off" type="text" id="room_type_name" name="room_type_name" class="form-control" placeholder= "{l s='Enter room type name' mod='hotelreservationsystem'}" value="{if isset($productName)}{$productName}{/if}"/>
<input type="hidden" id="room_type_id" name="room_type_id" class="form-control" value="{if isset($objFeaturePrice->id_product)}{$objFeaturePrice->id_product}{else}0{/if}"/>
<div class="dropdown">
<ul class="room_type_search_results_ul"></ul>
</div>
<p class="error-block" style="display:none; color: #CD5D5D;">{l s='No match found for this search. Please try with an existing name.' mod='hotelreservationsystem'}</p>
</div>
<div class="help-block">
**{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
@@ -72,6 +57,24 @@
{/if}
</div>
<div class="form-group room-type-name">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Room Type :' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input autocomplete="off" type="text" id="room_type_name" name="room_type_name" class="form-control" placeholder= "{l s='Enter room type name' mod='hotelreservationsystem'}" value="{if isset($productName)}{$productName}{/if}"/>
<input type="hidden" id="room_type_id" name="room_type_id" class="form-control" value="{if isset($objFeaturePrice->id_product)}{$objFeaturePrice->id_product}{else}0{/if}"/>
<div class="dropdown">
<ul class="room_type_search_results_ul"></ul>
</div>
<p class="error-block" style="display:none; color: #CD5D5D;">{l s='No match found for this search. Please try with an existing name.' mod='hotelreservationsystem'}</p>
<div class="help-block">
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
</div>
</div>
</div>
<div class="form-group">
<label for="date_selection_type" class="control-label col-lg-3">
{l s='Date Selection type :' mod='hotelreservationsystem'}
@@ -113,29 +116,30 @@
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
</div>
</div>
<div class="form-group special_days_content" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group special_days_content" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='If you want to create this Advanced price rule only for some special days of the week of selected date range then you can select select days after checking this option. Otherwise rule will be created for whole selected date range.' mod='hotelreservationsystem'}">
{l s='For Special Days' mod='hotelreservationsystem'}
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to restrict this rule to specific week days (for example, weekends) of the selected date range. If disabled, rule will be applicable to all week days.' mod='hotelreservationsystem'}">
{l s='Restrict to Week Days' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-sm-2">
<p class="checkbox">
<label>
<input class="is_special_days_exists pull-left" type="checkbox" name="is_special_days_exists"
{if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists)
|| (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}
checked="checked"
{/if}/>
{l s='Check to select special days' mod='hotelreservationsystem'}
</label>
</p>
<div class="col-lg-9 ">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 1}checked="checked"{elseif isset($edit) && $objFeaturePrice->is_special_days_exists == 1}checked="checked"{/if} value="1" id="is_special_days_exists_on" name="is_special_days_exists">
<label for="is_special_days_exists_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input {if isset($edit) && $objFeaturePrice->is_special_days_exists == 0} checked="checked" {elseif !isset($smarty.post.is_special_days_exists) && !isset($edit)}checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
<div class="col-sm-7 week_days"
{if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists) || (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}
style="display:block;"
{/if}>
<div class="col-sm-1">
</div>
<div class="form-group week_days" {if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists) || (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}style="display:block;"{/if}>
<label for="Price Impact Way" class="control-label col-lg-3">
{l s='Select Week Days' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3 checkboxes-wrap">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="mon"
{if (isset($smarty.post.special_days) && in_array('mon', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('mon', $special_days))}
@@ -143,7 +147,7 @@
{/if}/>
<p>{l s='Mon' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="tue"
{if (isset($smarty.post.special_days) && in_array('tue', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('tue', $special_days))}
@@ -151,7 +155,7 @@
{/if}/>
<p>{l s='Tue' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="wed"
{if (isset($smarty.post.special_days) && in_array('wed', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('wed', $special_days))}
@@ -159,7 +163,7 @@
{/if}/>
<p>{l s='Wed' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="thu"
{if (isset($smarty.post.special_days) && in_array('thu', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('thu', $special_days))}
@@ -167,7 +171,7 @@
{/if}/>
<p>{l s='Thu' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="fri"
{if (isset($smarty.post.special_days) && in_array('fri', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('fri', $special_days))}
@@ -175,7 +179,7 @@
{/if}/>
<p>{l s='Fri' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="sat"
{if (isset($smarty.post.special_days) && in_array('sat', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('sat', $special_days))}
@@ -183,7 +187,7 @@
{/if}/>
<p>{l s='Sat' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="sun"
{if (isset($smarty.post.special_days) && in_array('sun', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('sun', $special_days))}

View File

@@ -84,7 +84,11 @@
<td{if isset($order.order_state)} data-value="{$order.id_order_state}"{/if} class="history_state">
{if isset($order.order_state)}
<span class="label{if isset($order.order_state_color) && Tools::getBrightness($order.order_state_color) > 128} dark{/if}"{if isset($order.order_state_color) && $order.order_state_color} style="background-color:{$order.order_state_color|escape:'html':'UTF-8'}; border-color:{$order.order_state_color|escape:'html':'UTF-8'};"{/if}>
{$order.order_state|escape:'html':'UTF-8'}
{if $order.current_state|in_array:$overbooking_order_states}
{l s='Order Not Confirmed'}
{else}
{$order.order_state|escape:'html':'UTF-8'}
{/if}
</span>
{/if}
</td>

View File

@@ -76,7 +76,15 @@
{foreach from=$order_history item=state name="orderStates"}
<tr class="{if $smarty.foreach.orderStates.first}first_item{elseif $smarty.foreach.orderStates.last}last_item{/if} {if $smarty.foreach.orderStates.index % 2}alternate_item{else}item{/if}">
<td class="step-by-step-date">{dateFormat date=$state.date_add full=0}</td>
<td><span{if isset($state.color) && $state.color} style="background-color:{$state.color|escape:'html':'UTF-8'}; border-color:{$state.color|escape:'html':'UTF-8'};"{/if} class="label{if isset($state.color) && Tools::getBrightness($state.color) > 128} dark{/if}">{$state.ostate_name|escape:'html':'UTF-8'}</span></td>
<td>
<span{if isset($state.color) && $state.color} style="background-color:{$state.color|escape:'html':'UTF-8'}; border-color:{$state.color|escape:'html':'UTF-8'};"{/if} class="label{if isset($state.color) && Tools::getBrightness($state.color) > 128} dark{/if}">
{if $state.id_order_state|in_array:$overbooking_order_states}
{l s='Order Not Confirmed'}
{else}
{$state.ostate_name|escape:'html':'UTF-8'}
{/if}
</span>
</td>
</tr>
{/foreach}
</tbody>