Merge branch 'develop' into gli-1798

This commit is contained in:
Shreesh Arora
2024-07-24 13:03:52 +05:30
124 changed files with 1735 additions and 836 deletions

1
.gitignore vendored
View File

@@ -53,6 +53,7 @@ composer.lock
img/**
!/img/404.gif
!/img/.htaccess
!/img/admin/
!/img/admin/*.gif
!/img/admin/*.png

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -77,3 +77,9 @@
.room_status_info_form
.room_status
white-space: normal
#noteContent
max-height: 200px
.panel-refund-request .refunded_amount
margin-top: 2px

View File

@@ -9,7 +9,7 @@
// Kill the scroll on the body
.modal-open {
overflow-x: hidden;
overflow: hidden;
}
// Container that the modal scrolls within

View File

@@ -29,31 +29,29 @@
{if $input.name == 'vat_number'}
<div id="vat_area" style="display: visible">
{/if}
{if $input.type == 'text_customer' && !isset($customer)}
<label class="control-label col-lg-3 required" for="email">{l s='Customer email'}</label>
{else}
{$smarty.block.parent}
{/if}
{$smarty.block.parent}
{/block}
{block name="field"}
{block name="input"}
{if $input.type == 'text_customer'}
{if isset($customer)}
<div class="col-lg-9">
<a class="btn btn-default" href="?tab=AdminCustomers&amp;id_customer={$customer->id|intval}&amp;viewcustomer&amp;token={$tokenCustomer}">
<i class="icon-eye-open"></i> {$customer->lastname} {$customer->firstname} ({$customer->email})
</a>
</div>
<a class="btn btn-default" href="?tab=AdminCustomers&amp;id_customer={$customer->id|intval}&amp;viewcustomer&amp;token={$tokenCustomer}">
<i class="icon-eye-open"></i> {$customer->lastname} {$customer->firstname} ({$customer->email})
</a>
<input type="hidden" name="id_customer" value="{$customer->id}" />
<input type="hidden" name="email" value="{$customer->email}" />
{else}
<script type="text/javascript">
$('input[name=email]').live('blur', function(e)
{/if}
{else if $input.type == 'select' && $input.name == 'id_customer'}
{$smarty.block.parent}
<input type="hidden" name="email" id="email" value="">
<script type="text/javascript">
$('#id_customer').on('change', function(e)
{
var email = $(this).val();
if (email.length > 5)
{
var id_customer = parseInt($(this).val());
$('#email').val('');
if (!isNaN(id_customer)) {
var email = $(this).find('[value="'+id_customer+'"]').text();
$('#email').val(email);
var data = {};
data.email = email;
data.token = "{$token|escape:'html':'UTF-8'}";
@@ -66,31 +64,29 @@
data: data,
dataType: 'json',
async : true,
success: function(msg)
{
if (msg)
{
success: function(msg) {
if (msg) {
var infos = msg.infos.replace("\\'", "'").split('_');
$('input[name=firstname]').val(infos[0]);
$('input[name=lastname]').val(infos[1]);
$('input[name=company]').val(infos[2]);
$('input[name=id_customer]').val(infos[3]);
} else {
resetCustomerRelatedAddressFields();
}
},
error: function(msg)
{
}
});
} else {
resetCustomerRelatedAddressFields();
}
});
</script>
<div class="col-lg-4">
<input type="hidden" name="id_customer" value="{$fields_value[$input.name]}" />
<input type="email" id="email" name="email" value="{$fields_value[$input.name]|escape:'html':'UTF-8'}"/>
</div>
{/if}
function resetCustomerRelatedAddressFields() {
$('input[name=firstname]').val('');
$('input[name=lastname]').val('');
$('input[name=company]').val('');
$('input[name=id_customer]').val('');
}
</script>
{else}
{$smarty.block.parent}
{/if}

View File

@@ -146,15 +146,27 @@
<label class="control-label col-lg-3">{l s='Status'}</label>
<div class="col-lg-9">
<p class="form-control-static">
{if $customer->active}
<span class="label label-success">
<i class="icon-check"></i>
{l s='Active'}
{if !$customer->deleted}
{if $customer->active}
<span class="label label-success">
<i class="icon-check"></i>
{l s='Active'}
</span>
{else}
<span class="label label-danger">
<i class="icon-remove"></i>
{l s='Inactive'}
</span>
{/if}
{elseif $customer->deleted == Customer::STATUS_BANNED}
<span class="label label-warning">
<i class="icon-remove"></i>
{l s='Banned'}
</span>
{else}
{elseif $customer->deleted == Customer::STATUS_DELETED}
<span class="label label-danger">
<i class="icon-remove"></i>
{l s='Inactive'}
{l s='Deleted'}
</span>
{/if}
</p>

View File

@@ -39,7 +39,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="NOFOLLOW, NOINDEX">
<title>
{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}&gt;{/if} {$meta_title}{/if} (PrestaShop&trade;)
{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}&gt;{/if} {$meta_title}{/if} (QloApps&trade;)
</title>
{if isset($css_files)}
{foreach from=$css_files key=css_uri item=media}

View File

@@ -92,7 +92,7 @@
{foreach $data['child_ages'] as $childAge}
<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<select class="guest_child_age room_occupancies" name="occupancy[0][child_ages][]">
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select 1'}</option>
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select age'}</option>
<option value="0" {if $childAge == 0}selected{/if}>{l s='Under 1'}</option>
{for $age=1 to ($max_child_age-1)}
<option value="{$age|escape:'htmlall':'UTF-8'}" {if $childAge == $age}selected{/if}>{$age|escape:'htmlall':'UTF-8'}</option>

View File

@@ -1,196 +0,0 @@
{*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="new_product" style="display:none">
<td style="display:none;" colspan="3" class="text-center">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
<div class="form-group">
<label>{l s='Room Type:'}</label>
<div class="input-group">
<input type="text" id="add_product_product_name" value=""/>
<div class="input-group-addon">
<i class="icon-search"></i>
</div>
</div>
</div>
<!-- <div id="add_product_product_attribute_area" class="form-group" style="display: none;">
<label>{l s='Combinations'}</label>
<select name="add_product[product_attribute_id]" id="add_product_product_attribute_id"></select>
</div>
<div id="add_product_product_warehouse_area" class="form-group" style="display: none;">
<label>{l s='Warehouse'}</label>
<select id="add_product_warehouse" name="add_product_warehouse"></select>
</div> -->
</td>
<td style="display:none;" class="bookingDuration text-center" colspan="2">
<center>
<div class="room_check_in_div">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">{l s='Check In'}</div>
<input type="text" class="form-control add_room_date_from" name="add_product[date_from]" readonly />
<div class="input-group-addon"><i class="icon-calendar"></i></div>
</div>
</div>
<br/>
<div class="room_check_out_div">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">{l s='Check Out'}</div>
<input type="text" class="form-control add_room_date_to" name="add_product[date_to]" readonly/>
<div class="input-group-addon"><i class="icon-calendar"></i></div>
</div>
</div>
</center>
</td>
<td style="display:none;" class="productQuantity text-center" colspan="1">
{if $order->with_occupancy}
<div class="booking_occupancy">
<div class="dropdown">
<button class="booking_guest_occupancy form-control btn btn-default btn-left btn-block input-occupancy disabled" type="button">
<span>{l s='Select occupancy'}</span>
</button>
<input type="hidden" class="max_avail_type_qty" value="">
<div class="dropdown-menu booking_occupancy_wrapper fixed-width-xxl well well-sm">
<div class="booking_occupancy_inner">
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1'}</label></div>
<div class="col-sm-12">
<div class="row">
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1">
</div>
<div class="form-group col-xs-6 occupancy_count_block">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
<div class="row children_age_info_block" style="display:none">
<div class="form-group col-sm-12">
<label class="">{l s='All Children'}</label>
<div class="">
<div class="row children_ages">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<hr class="occupancy-info-separator col-sm-12">
<div class="add_occupancy_block col-sm-12">
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
<a class="pull-right close_occupancy_link" href="#">{l s='close'} <i class="icon-remove"></i></a>
</div>
</div>
</div>
</div>
{else}
<center>
<input type="number" class="form-control fixed-width-sm" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" disabled="disabled" min="1"/>
</center>
{/if}
</td>
<td style="display:none;" class="text-center" colspan="2">
<center>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="row">
<div class="input-group fixed-width-xl">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</center>
</td>
{*{if ($order->hasBeenPaid())}<td style="display:none;" class="productQuantity"></td>{/if}
{if $display_warehouse}<td></td>{/if}
{if ($order->hasBeenDelivered())}<td style="display:none;" class="productQuantity"></td>{/if}
<td style="display:none;" class="productQuantity" id="add_product_product_stock">0</td>*}
<td style="display:none;" id="add_product_product_total" class="text-center">{displayPrice price=0 currency=$currency->id}</td>
<td style="display:none;" class="text-center">
{if sizeof($invoices_collection)}
<select class="form-control" name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
<optgroup class="existing" label="{l s='Existing'}">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='New'}">
<option value="0">{l s='Create a new invoice'}</option>
</optgroup>
</select>
{/if}
</td>
<td style="display:none;" class="text-center">
<button type="button" class="btn btn-default" id="cancelAddProduct">
<i class="icon-remove text-danger"></i>
{l s='Cancel'}
</button>
<button type="button" class="btn btn-default" id="submitAddProduct" disabled="disabled">
<i class="icon-ok text-success"></i>
{l s='Add'}
</button>
</td>
</tr>
<!-- <tr id="new_invoice" style="display:none">
<td colspan="10">
<h4>{l s='New invoice information'}</h4>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-lg-3">{l s='Carrier'}</label>
<div class="col-lg-9">
<p class="form-control-static"><strong>{$carrier->name}</strong></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Shipping Cost'}</label>
<div class="col-lg-9">
<div class="checkbox">
<label>
<input type="checkbox" name="add_invoice[free_shipping]" value="1" />
{l s='Free shipping'}
</label>
<p class="help-block">{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}</p>
</div>
</div>
</div>
</div>
</td>
</tr>
-->

View File

@@ -43,15 +43,19 @@
<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">
<a data-toggle="dropdown">
<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>
</a>
<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]}
{if $childAge == 0}
{l s='Child %s : Under 1' sprintf=[$childAge@iteration]}
{else}
{l s='Child %s : %s' sprintf=[$childAge@iteration, $childAge]} {if $childAge > 1}{l s='years'}{else}{l s='year'}{/if}
{/if}
</p>
{/foreach}
{/if}

View File

@@ -70,7 +70,11 @@
{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]}
{if $childAge == 0}
{l s='Child %s : Under 1' sprintf=[$childAge@iteration]}
{else}
{l s='Child %s : %s' sprintf=[$childAge@iteration, $childAge]} {if $childAge > 1}{l s='years'}{else}{l s='year'}{/if}
{/if}
</p>
{/foreach}
{/if}
@@ -246,7 +250,7 @@
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-id_order="{$data['id_order']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}'>
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-id_order="{$data['id_order']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}' data-allotment_type='{$data['booking_type']}' data-allotment_type_label='{if $data['booking_type'] == $ALLOTMENT_MANUAL}{l s='Manual'}{else}{l s='Auto'}{/if}' data-comment='{$data.comment}'>
<i class="icon-refresh"></i>
{l s='Reallocate/Swap Room'}
</a>

View File

@@ -28,9 +28,9 @@
{block name=pageTitle}
<h2 class="order_page_title page-title">
{if is_array($title)}{$title|end|strip_tags}{else}{$title|strip_tags}{/if}
{if $currentState == Configuration::get('PS_OS_REFUND')}
{if $currentState->id == Configuration::get('PS_OS_REFUND')}
<span class="toolbar_order_status_badge badge badge-danger">{l s='Refunded'}</span>
{elseif $currentState == Configuration::get('PS_OS_CANCELED')}
{elseif $currentState->id == Configuration::get('PS_OS_CANCELED')}
<span class="toolbar_order_status_badge badge badge-danger">{l s='Cancelled'}</span>
{else}
<span class="toolbar_order_status_badge badge badge-success">{l s='Booked'}</span>
@@ -98,12 +98,12 @@
<table class="table">
<thead>
<tr>
<th>{l s='Room No.'}</th>
<th>{l s='Room Type'}</th>
<th>{l s='Room'}</th>
<th>{l s='Duration'}</th>
<th>{l s='Documents'}</th>
<th>{l s='Room Status'}</th>
<th class="text-center">{l s='Action'}</th>
<th>{l s='Check-In'}</th>
<th>{l s='Check-Out'}</th>
<th>{l s='Allotment'}</th>
<th>{l s='Action'}</th>
</tr>
</thead>
<tbody>
@@ -111,34 +111,43 @@
{foreach from=$htl_booking_order_data item=data}
<tr>
<td>
{$data['room_num']}
</td>
<td>
{$data['room_num']}<br>
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$data['id_product']}&amp;updateproduct" target="_blank">{$data['room_type_name']|escape:'html':'UTF-8'}</a>
</td>
<td>
{dateFormat date=$data['date_from']} - {dateFormat date=$data['date_to']}
</td>
<td>
<a href="#" onclick="BookingDocumentsModal.init({$data.id|intval}, this); return false;">
{if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}{l s='Upload'}{/if} {l s='Documents'}
</a>
</td>
<td>
{if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']}
{l s='Alloted'}
{elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']}
<span class="text-danger room_status">{l s='Checked in on'} {dateFormat date=$data['check_in']}</span>
{elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']}
<span class="text-success room_status">{l s='Checked out on'} {dateFormat date=$data['check_out']}</span>
{if ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']) || ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status'])}
<span class="text-danger room_status">{l s='Checked in on'}<br>{dateFormat date=$data['check_in'] full=1}</span>
{else}
--
{/if}
</td>
<td class="text-center">
<td>
{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']}
<span class="text-success room_status">{l s='Checked out on'}<br>{dateFormat date=$data['check_out'] full=1}</span>
{else}
--
{/if}
</td>
<td>
{if $data['booking_type'] == $ALLOTMENT_MANUAL}
{l s='Manual'} &nbsp;{if $data['comment'] != ''}<a class="manual_allotment_comment" href="#" data-id_hotel_booking_detail="{$data['id']}"><i class="icon-info-circle"></i></a>{/if}
{else}
{l s='Auto'}
{/if}
</td>
<td>
<a title="{l s='Upload/Check guest documents'}" class="btn btn-default" href="#" onclick="BookingDocumentsModal.init({$data.id|intval}, this); return false;">
<span class="badge badge-info">{if $data.num_checkin_documents > 0}{$data.num_checkin_documents}{else}0{/if}</span> <i class="icon-file-text"></i>
</a>
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
<span class="badge badge-danger">{if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if}</span>
{else}
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}">
<i class="icon-pencil"></i>
<i class="icon-pencil"></i> {l s='Edit'}
</a>
{/if}
</td>
@@ -783,7 +792,7 @@
</div>
{/if}
<div class="panel">
<div class="panel panel-refund-request">
<div class="panel-heading">
<i class="icon-undo"></i> &nbsp;{l s='Refund Requests'}
</div>
@@ -814,7 +823,7 @@
<td>
<span class="badge" style="background-color:{$return_info.state_color}">{$return_info.state_name}</span>
{if $return_info.refunded_amount > 0}
&nbsp;<span class="badge badge-success">{displayPrice price=$return_info.refunded_amount currency=$currency->id}</span>
&nbsp;<span class="badge badge-success refunded_amount">{displayPrice price=$return_info.refunded_amount currency=$currency->id}</span>
{/if}
</td>
</tr>
@@ -918,7 +927,7 @@
{assign var=additional_service_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)}
{if $room_price_tax_excl}
<tr id="total_products">
<td class="text-right">{l s='Total Rooms Cost (tax excl.)'}</td>
<td class="text-right">{l s='Total Rooms Cost (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$room_price_tax_excl currency=$currency->id}
</td>
@@ -927,34 +936,16 @@
{/if}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
<tr id="total_products">
<td class="text-right">{l s='Total Extra services (tax excl.)'}</td>
<td class="text-right">{l s='Total Extra services (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=($additional_service_price_tax_excl - $totalConvenienceFeeTE) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {if $room_price_tax_excl}
<tr id="total_tax_order">
<td class="text-right"><strong>{l s='Total Rooms Tax'}</strong></td>
<td class="text-right nowrap">
<strong>{displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
<tr id="total_tax_order">
<td class="text-right"><strong>{l s='Extra services Tax'}</strong></td>
<td class="text-right nowrap">
<strong>{displayPrice price=($additional_service_price_tax_incl - $additional_service_price_tax_excl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if} *}
{if $service_products_price_tax_excl}
<tr id="total_products">
<td class="text-right">{l s='Total service products cost (tax excl.)'}</td>
<td class="text-right">{l s='Total service products cost (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$service_products_price_tax_excl currency=$currency->id}
</td>
@@ -962,10 +953,64 @@
</tr>
{/if}
{if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0}
<tr id="total_products">
<td class="text-right">{l s='Convenience Fee (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$totalConvenienceFeeTE currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if $room_price_tax_excl}
<tr id="total_tax_order">
<td class="text-right">{l s='Total Rooms Tax'}</td>
<td class="text-right nowrap">
{displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
<tr id="total_tax_order">
<td class="text-right">{l s='Extra services Tax'}</td>
<td class="text-right nowrap">
{displayPrice price=(($additional_service_price_tax_incl - $additional_service_price_tax_excl) - ($totalConvenienceFeeTI - $totalConvenienceFeeTE)) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0}
<tr id="total_products">
<td class="text-right">{l s='Convenience Fee Tax'}</td>
<td class="amount text-right nowrap">
{displayPrice price=($totalConvenienceFeeTI - $totalConvenienceFeeTE) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *}
<tr id="total_taxes">
<td class="text-right"><strong>{l s='Total Taxes'}</strong>
</td>
<td class="amount text-right nowrap" ><strong>{displayPrice price=(($order->total_paid_tax_incl + $order->total_discounts_tax_incl) - ($order->total_paid_tax_excl + $order->total_discounts_tax_excl)) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{* {/if} *}
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td class="text-right">{l s='Discounts'}</td>
<td class="text-right"><strong>{l s='Total Booking Amount'}</strong></td>
<td class="amount text-right nowrap">
-{displayPrice price=$order_discount_price currency=$currency->id}
<strong>{displayPrice price=($order->total_paid_tax_incl + $order->total_discounts_tax_incl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td class="text-right"><strong>{l s='Discounts'}</strong></td>
<td class="amount text-right nowrap">
<strong>-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
@@ -976,24 +1021,6 @@
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if isset($totalConvenienceFeeTI) && $totalConvenienceFeeTI > 0}
<tr id="total_products">
<td class="text-right">{l s='Convenience Fee'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$totalConvenienceFeeTE currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *}
<tr id="total_taxes">
<td class="text-right">{l s='Total Taxes'}
</td>
<td class="amount text-right nowrap" >{displayPrice price=($order->total_paid_tax_incl - $order->total_paid_tax_excl) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{* {/if} *}
<tr id="total_order">
<td class="text-right"><strong>{l s='Final Booking Total'}</strong></td>
<td class="amount text-right nowrap">
@@ -1248,14 +1275,13 @@
{addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL}
{addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'}
{addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'}
{addJsDef ROOM_STATUS_ALLOTED=$ROOM_STATUS_ALLOTED|escape:'quotes':'UTF-8'}
{addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'}
{addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'}
{addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'}
{addJsDef PS_OS_CANCELED=Configuration::get('PS_OS_CANCELED')|escape:'quotes':'UTF-8'}
{addJsDef PS_OS_REFUND=Configuration::get('PS_OS_REFUND')|escape:'quotes':'UTF-8'}
{addJsDefL name=txt_booking_document_upload_success}{l s='Document uploaded successfully.' js=1}{/addJsDefL}
{addJsDefL name=txt_booking_document_delete_confirm}{l s='Are you sure?' js=1}{/addJsDefL}
{addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL}
{/strip}
{/block}
{/block}

View File

@@ -49,7 +49,7 @@
<div class="row form-group">
<div class="col-sm-6">
<label class="control-label">{l s='Price (Tax excl.)'}</label>
<label class="control-label">{l s='Price (tax excl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control" type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" disabled="disabled"/>
@@ -57,7 +57,7 @@
</div>
</div>
<div class="col-sm-6">
<label class="control-label">{l s='Price (Tax incl.)'}</label>
<label class="control-label">{l s='Price (tax incl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control" type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" disabled="disabled"/>

View File

@@ -58,7 +58,7 @@
<div class="row form-group">
<div class="col-sm-6">
<label class="control-label">{l s='Price (Tax excl.)'}</label>
<label class="control-label">{l s='Price (tax excl.)'}</label>
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input class="form-control room_unit_price" type="text" name="room_unit_price" value=""/>
@@ -67,55 +67,55 @@
</div>
<div class="col-sm-6">
<label class="control-label">{l s='Occupancy'}</label>
{if $order->with_occupancy}
<div class="booking_occupancy_edit">
<div class="dropdown">
<button class="form-control booking_guest_occupancy btn btn-default btn-left btn-block input-occupancy" 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 booking_occupancy_wrapper fixed-width-xxl well well-sm">
<div class="booking_occupancy_inner">
<input type="hidden" class="max_adults" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="occupancy_info_block" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><span class="room_num_wrapper">{l s='Room - 1'}</span></div>
<div class="row">
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1" max="{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}">
</div>
</div>
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
<div class="booking_occupancy_edit">
<div class="dropdown">
<button class="form-control booking_guest_occupancy btn btn-default btn-left btn-block input-occupancy" 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 booking_occupancy_wrapper fixed-width-xxl well well-sm">
<div class="booking_occupancy_inner">
<input type="hidden" class="max_adults" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_children" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}{/if}">
<input type="hidden" class="max_guests" value="{if isset($data['room_type_info'])}{$data['room_type_info']['max_guests']|escape:'html':'UTF-8'}{/if}">
<div class="occupancy_info_block" occ_block_index="0">
<div class="occupancy_info_head col-sm-12"><span class="room_num_wrapper">{l s='Room - 1'}</span></div>
<div class="row">
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label>{l s='Adults'}</label>
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1" max="{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}">
</div>
</div>
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
<div class="col-xs-6 occupancy_count_block">
<div class="col-sm-12">
<label class="col-sm-12">{l s='All Children'}</label>
<div class="col-sm-12">
<div class="row children_ages">
{if isset($data['child_ages']) && $data['child_ages']}
{foreach $data['child_ages'] as $childAge}
<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<select class="guest_child_age room_occupancies" name="occupancy[0][child_ages][]">
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select 1'}</option>
<option value="0" {if $childAge == 0}selected{/if}>{l s='Under 1'}</option>
{for $age=1 to ($max_child_age-1)}
<option value="{$age|escape:'htmlall':'UTF-8'}" {if $childAge == $age}selected{/if}>{$age|escape:'htmlall':'UTF-8'}</option>
{/for}
</select>
</p>
{/foreach}
{/if}
</div>
<label>{l s='Child'} <span class="label-desc-txt"></span></label>
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
</div>
</div>
</div>
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
<div class="col-sm-12">
<label class="col-sm-12">{l s='All Children'}</label>
<div class="col-sm-12">
<div class="row children_ages">
{if isset($data['child_ages']) && $data['child_ages']}
{foreach $data['child_ages'] as $childAge}
<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<select class="guest_child_age room_occupancies" name="occupancy[0][child_ages][]">
<option value="-1" {if $childAge == -1}selected{/if}>{l s='Select age'}</option>
<option value="0" {if $childAge == 0}selected{/if}>{l s='Under 1'}</option>
{for $age=1 to ($max_child_age-1)}
<option value="{$age|escape:'htmlall':'UTF-8'}" {if $childAge == $age}selected{/if}>{$age|escape:'htmlall':'UTF-8'}</option>
{/for}
</select>
</p>
{/foreach}
{/if}
</div>
</div>
</div>
@@ -124,9 +124,7 @@
</div>
</div>
</div>
{else}
<span class="booking_occupancy_edit" style="display:none;">{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}
</div>
</div>
</div>
</div>

View File

@@ -31,8 +31,8 @@
<thead>
<tr>
<th>{l s='Name'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Total Price'}</th>
<th>{l s='Unit Price (tax excl.)'}</th>
<th>{l s='Total Price (tax excl.)'}</th>
<th class="text-right">{l s='Action'}</th>
</tr>
</thead>
@@ -77,7 +77,7 @@
<th></th>
<th>{l s='Name'}</th>
<th>{l s='Option'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Unit Price (tax excl.)'}</th>
</tr>
</thead>
<tbody>

View File

@@ -33,8 +33,8 @@
<th>{l s='Name'}</th>
<th class="fixed-width-sm"></th>
<th class="fixed-width-sm text-center">{l s='Quantity'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Total Price'}</th>
<th>{l s='Unit Price (tax excl.)'}</th>
<th>{l s='Total Price (tax excl.)'}</th>
<th class="text-right">{l s='Action'}</th>
</tr>
</thead>
@@ -101,7 +101,7 @@
<th>{l s='Name'}</th>
<th class="fixed-width-sm"> </th>
<th class="fixed-width-sm text-center">{l s='Quantity'}</th>
<th>{l s='Unit Price'}</th>
<th>{l s='Unit Price (tax excl.)'}</th>
</tr>
</thead>
<tbody>

View File

@@ -0,0 +1,28 @@
{*
* Since 2010 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 Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*}
<div class="modal-body">
<div><b>{l s='Allotment remark'}</b>: {$comment}</div>
{if isset($loaderImg) && $loaderImg}
<div class="loading_overlay">
<img src='{$loaderImg}' class="loading-img"/>
</div>
{/if}
</div>

View File

@@ -28,15 +28,25 @@
</ul>
<div class="tab-content active">
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
<div class="row">
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Current Room Number'}</label>
<dd><i class="icon-bed"></i> &nbsp;<span class="modal_curr_room_num"></span></dd>
</dl>
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Allotment type'}</label>
<dd><span class="modal_curr_allotent_type"></span></dd>
</dl>
</div>
<div class="row">
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Currently Alloted Customer'}</label>
<dd><i class="icon-user"></i> &nbsp;<span class="cust_name"></span></dd>
<dd><i class="icon-envelope"></i> &nbsp;<span class="cust_email"></span></dd>
</dl>
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Current Room Number'}</label>
<dd><i class="icon-bed"></i> &nbsp;<span class="modal_curr_room_num"></span></dd>
<dl class="list-detail col-sm-6 allotment_comment_block">
<label class="label-title">{l s='Allotment Comment'}</label>
<dd><span class="modal_curr_allotment_comment"></span></dd>
</dl>
</div>
@@ -90,15 +100,25 @@
</form>
</div>
<div role="tabpanel" class="tab-pane" id="swap_room_tab">
<div class="row">
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Current Room Number'}</label>
<dd><i class="icon-bed"></i> &nbsp;<span class="modal_curr_room_num"></span></dd>
</dl>
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Allotment type'}</label>
<dd><span class="modal_curr_allotent_type"></span></dd>
</dl>
</div>
<div class="row">
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Currently Alloted Customer'}</label>
<dd><i class="icon-user"></i> &nbsp;<span class="cust_name"></span></dd>
<dd><i class="icon-envelope"></i> &nbsp;<span class="cust_email"></span></dd>
</dl>
<dl class="list-detail col-sm-6">
<label class="label-title">{l s='Current Room Number'}</label>
<dd><i class="icon-bed"></i> &nbsp;<span class="modal_curr_room_num"></span></dd>
<dl class="list-detail col-sm-6 allotment_comment_block">
<label class="label-title">{l s='Allotment Comment'}</label>
<dd><span class="modal_curr_allotment_comment"></span></dd>
</dl>
</div>
<hr>

View File

@@ -43,7 +43,7 @@
{l s='Price'}
</th>
<th>
{l s='Tax rate'}
{l s='Tax rule'}
</th>
<th class="fixed-width-lg text-center">
{l s='Per day price calculation'}

View File

@@ -27,7 +27,7 @@
<span>{l s='Price'}</span>
</th>
<th>
<span>{l s='Tax'}</span>
<span>{l s='Tax rule'}</span>
</th>
</tr>
</thead>

View File

@@ -138,6 +138,9 @@
</select>
{elseif isset($input.empty_message)}
{$input.empty_message}
{else}
<select class="form-control fixed-width-xxl {if isset($field['class'])}{$field['class']}{/if}" name="{$key}"{if isset($field['js'])} onchange="{$field['js']}"{/if} id="{$key}" {if isset($field['size'])} size="{$field['size']}"{/if}>
</select>
{/if}
</div>
{elseif $field['type'] == 'bool'}

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -517,5 +517,4 @@ class AddressCore extends ObjectModel
)
');
}
}

31
classes/BoOrder.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
/**
* 2010-2022 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-2022 Webkul IN
* @license https://store.webkul.com/license.html
*/
class BoOrder extends PaymentModule
{
public $active = 1;
public $name = 'bo_order';
public function __construct()
{
$this->displayName = $this->l('Back office order');
$this->validateOrderAmount = false;
}
}

View File

@@ -135,6 +135,9 @@ class CustomerCore extends ObjectModel
public $groupBox;
const STATUS_BANNED = 1;
const STATUS_DELETED = 2;
protected $webserviceParameters = array(
'fields' => array(
'id_default_group' => array('xlink_resource' => 'groups'),
@@ -179,7 +182,7 @@ class CustomerCore extends ObjectModel
'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'deleted' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
'note' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false),
'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false),
@@ -294,21 +297,37 @@ class CustomerCore extends ObjectModel
}
/**
* Return customers list
* Returns a list of customers.
*
* @param null|bool $only_active Returns only active customers when true
* @return array Customers
* @param null|bool $active Optional. Filter customers by their active status. If null, no filter is applied.
* @param null|bool $deleted Optional. Filter customers by their deleted status. If null, no filter is applied.
* @param null|bool $havingAddress Optional. Filter customers having|not having address. If true, only customers having an address are returned.
* If false, only customers without an address are returned. If null, no filter is applied.
* @return array List of customers matching the specified criteria.
*/
public static function getCustomers($only_active = null)
public static function getCustomers($active = null, $deleted = null, $havingAddress = null)
{
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`
FROM `'._DB_PREFIX_.'customer`
WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).
($only_active ? ' AND `active` = 1' : '').'
ORDER BY `id_customer` ASC';
$sqlSelect = 'SELECT c.`id_customer`, c.`email`, c.`firstname`, c.`lastname`';
$sqlFrom = 'FROM `'._DB_PREFIX_.'customer` c';
$sqlJoin = '';
$sqlWhere = 'WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).
(!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ).
(!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' ');
$sqlOrderBy = 'ORDER BY c.`id_customer` ASC';
$sqlGroupBy = 'GROUP BY c.`id_customer`';
if (!is_null($havingAddress)) {
$sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'address` a
ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0';
$sqlWhere .= (($havingAddress) ? ' AND a.`id_address` IS NOT NULL': ' AND a.`id_address` IS NULL');
}
$sql = $sqlSelect .' '. $sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy.' '.$sqlOrderBy;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
/**
* Return customer instance from its e-mail (optionnaly check password)
*
@@ -951,4 +970,5 @@ class CustomerCore extends ObjectModel
$sql_filter .= Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'main');
return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit);
}
}

View File

@@ -33,6 +33,7 @@ abstract class PaymentModuleCore extends Module
public $currencies = true;
public $currencies_mode = 'checkbox';
public $payment_type = OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT;
public $validateOrderAmount = true;
public function install()
{
@@ -162,7 +163,7 @@ abstract class PaymentModuleCore extends Module
*/
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
$secure_key = false, Shop $shop = null)
$secure_key = false, Shop $shop = null, $send_mails = true)
{
if (self::DEBUG_MODE) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Function called', 1, null, 'Cart', (int)$id_cart, true);
@@ -418,8 +419,7 @@ abstract class PaymentModuleCore extends Module
// If webservice order request then no need to impose equal amounts(total cart and sent amount) condition
if ($order_status->logable
&& number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_)
&& $this->name != 'wsorder'
&& $this->name != 'bo_order'
&& ($this->validateOrderAmount)
) {
// if customer is paying full payment amount
$id_order_state = Configuration::get('PS_OS_ERROR');
@@ -684,24 +684,25 @@ abstract class PaymentModuleCore extends Module
if ($voucher->add()) {
// If the voucher has conditions, they are now copied to the new voucher
CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);
$params = array(
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
'{voucher_num}' => $voucher->code,
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{id_order}' => $order->reference,
'{order_name}' => $order->getUniqReference()
);
Mail::Send(
(int)$order->id_lang,
'voucher',
sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference),
$params,
$this->context->customer->email,
$this->context->customer->firstname.' '.$this->context->customer->lastname,
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
if ($send_mails) {
$params = array(
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
'{voucher_num}' => $voucher->code,
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{id_order}' => $order->reference,
'{order_name}' => $order->getUniqReference()
);
Mail::Send(
(int)$order->id_lang,
'voucher',
sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference),
$params,
$this->context->customer->email,
$this->context->customer->firstname.' '.$this->context->customer->lastname,
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
}
}
}
@@ -1050,10 +1051,12 @@ abstract class PaymentModuleCore extends Module
// Set the order status
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);
if ($send_mails) {
$new_history->addWithemail(true, $extra_vars);
} else {
$new_history->add(true);
}
// Switch to back order if needed
$objHotelBookingDetail = new HotelBookingDetail();
@@ -1089,7 +1092,11 @@ abstract class PaymentModuleCore extends Module
$history = new OrderHistory();
$history->id_order = (int)$order->id;
$history->changeIdOrderState($id_order_state, $order, true);
$history->addWithemail();
if ($send_mails) {
$history->addWithemail();
} else {
$history->add();
}
}
unset($order_detail);
@@ -1098,7 +1105,11 @@ abstract class PaymentModuleCore extends Module
$order = new Order((int)$order->id);
// Send an e-mail to customer (one order = one email)
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
if ($id_order_state != Configuration::get('PS_OS_ERROR')
&& $id_order_state != Configuration::get('PS_OS_CANCELED')
&& $this->context->customer->id
&& $send_mails
) {
$invoice = new Address($order->id_address_invoice);
$delivery = new Address($order->id_address_delivery);
$delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
@@ -1327,9 +1338,7 @@ abstract class PaymentModuleCore extends Module
}
}
}
if ($idHotel
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
) {
if ($idHotel && 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) {

View File

@@ -233,7 +233,7 @@ class ValidateCore
*/
public static function isPrice($price)
{
return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
return preg_match('/^[0-9]{1,10}(\.[0-9]{1,})?$/', $price);
}
/**
@@ -244,7 +244,7 @@ class ValidateCore
*/
public static function isNegativePrice($price)
{
return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,})?$/', $price);
}
/**
@@ -364,7 +364,7 @@ class ValidateCore
*/
public static function isCityName($city)
{
return preg_match(Tools::cleanNonUnicodeSupport('/^[^!<>;?=+@#"°{}_$%]*$/u'), $city);
return preg_match(Tools::cleanNonUnicodeSupport('/^\p{L}+[^!<>;?=+@#"°{}_$%]*$/u'), $city);
}
/**

View File

@@ -502,7 +502,7 @@ abstract class CacheCore
$this->_deleteMulti($invalidKeys);
if ($keyToKeep) {
$this->sql_tables_cached[$table][$keyToKeep] = $toKeep ?? null;
$this->sql_tables_cached[$table][$keyToKeep] = isset($toKeep) ? $toKeep : null;
}
}
$this->adjustTableCacheSize = false;

View File

@@ -1805,7 +1805,7 @@ class OrderCore extends ObjectModel
SELECT opd.`amount` as `real_paid_amount`, opd.*, op.*
FROM `'._DB_PREFIX_.'order_payment_detail` opd
INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`)
WHERE `id_order` = '.$this->id
WHERE `id_order` = '.(int) $this->id
);
}

View File

@@ -822,7 +822,9 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
*/
protected function getTemplateByCountry($iso_country)
{
$file = Configuration::get('PS_INVOICE_MODEL');
// $file = Configuration::get('PS_INVOICE_MODEL');
// @todo redesign invoice template for b2b, for now we have ony one template design.
$file = 'invoice';
// try to fetch the iso template
$template = $this->getTemplate($file.'.'.$iso_country);

View File

@@ -26,5 +26,6 @@ class WebserviceOrderCore extends PaymentModule
public function __construct()
{
$this->displayName = $this->l('Order from API');
$this->validateOrderAmount = false;
}
}

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -112,18 +112,43 @@ class AdminAddressesControllerCore extends AdminController
public function renderForm()
{
$customerField =array(
'type' => 'text_customer',
'label' => $this->l('Customer'),
'name' => 'id_customer',
'required' => false,
);
if ($this->loadObject(true)
&& !$this->object->id
&& !Tools::getValue('liteDisplaying')
) {
$customerEmails = array(array(
'email' => $this->l('Select Customer'),
'id_customer' => 0,
'id_address'=> 0
));
$customerEmails = array_merge($customerEmails, Customer::getCustomers(null, 0, 0));
$customerField = array(
'type' => 'select',
'label' => $this->l('Customer'),
'name' => 'id_customer',
'required' => true,
'class' => 'chosen',
'options' => array(
'query' => $customerEmails,
'id' => 'id_customer',
'name' => 'email'
),
);
}
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Addresses'),
'icon' => 'icon-envelope-alt'
),
'input' => array(
array(
'type' => 'text_customer',
'label' => $this->l('Customer'),
'name' => 'id_customer',
'required' => false,
),
$customerField,
array(
'type' => 'text',
'label' => $this->l('Identification Number'),
@@ -191,9 +216,8 @@ class AdminAddressesControllerCore extends AdminController
}
$this->tpl_form_vars = array(
'customer' => isset($customer) ? $customer : null,
'tokenCustomer' => isset($token_customer) ? $token_customer : null,
'back_url' => urldecode(Tools::getValue('back'))
'customer' => (isset($customer) && ($this->object->id || Tools::getValue('liteDisplaying'))) ? $customer : null,
'tokenCustomer' => isset($token_customer) ? $token_customer : null
);
// Order address fields depending on country format
@@ -503,7 +527,7 @@ class AdminAddressesControllerCore extends AdminController
return $out;
}
/**
/**
* Method called when an ajax request is made
* @see AdminController::postProcess()
*/

View File

@@ -85,6 +85,7 @@ class AdminCmsContentControllerCore extends AdminController
public function initContent()
{
$this->loadObject(true);
$this->initTabModuleList();
$this->renderPageHeaderToolbar();
@@ -151,8 +152,9 @@ class AdminCmsContentControllerCore extends AdminController
if (Tools::getValue('addcms') !== false) {
$this->toolbar_title[] = $this->l('Add new');
} elseif ($id_cms_page) {
$cms_page = new CMS($id_cms_page);
} elseif ($id_cms_page
&& Validate::isLoadedObject($cms_page = new CMS($id_cms_page))
) {
$this->toolbar_title[] = sprintf($this->l('Edit: %s'), $cms_page->meta_title[$this->context->employee->id_lang]);
}
} else {

View File

@@ -170,6 +170,11 @@ class AdminCustomersControllerCore extends AdminController
'type' => 'datetime',
'search' => false,
'havingFilter' => true
),
'deleted' => array(
'title' => $this->l('Banned'),
'type' => 'bool',
'displayed' => false,
)
));
@@ -218,6 +223,12 @@ class AdminCustomersControllerCore extends AdminController
}
parent::postProcess();
// Added this to check if the filter for the banned(deleted) is used, since $this->delete = true will not display the deleted customers.
$prefix = $this->getCookieFilterPrefix();
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) {
$this->deleted = false;
}
}
public function initContent()
@@ -739,6 +750,9 @@ class AdminCustomersControllerCore extends AdminController
$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;
$date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day'));
$date_to = date('Y-m-d');
$helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_date_add[]='.$date_from.'&customerFilter_date_add[]='.$date_to;
$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);
@@ -750,6 +764,7 @@ class AdminCustomersControllerCore extends AdminController
$helper->color = 'color2';
$helper->title = $this->l('Banned Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
$helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_deleted=1';
$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;
@@ -958,8 +973,8 @@ class AdminCustomersControllerCore extends AdminController
// If customer is going to be deleted permanently then if customer has orders the change this customer as an anonymous customer
if (Validate::isLoadedObject($objCustomer = $this->loadObject())) {
if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) {
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain();
$objCustomer->deleted = 1;
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::link_rewrite(Configuration::get('PS_SHOP_NAME')).'_anonymous.com';
$objCustomer->deleted = Customer::STATUS_DELETED;
if (!$objCustomer->update()) {
$this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer');
return;
@@ -1000,7 +1015,7 @@ class AdminCustomersControllerCore extends AdminController
// check if customer has orders for email change else customer will be deleted
if (Order::getCustomerOrders($objCustomer->id, true)) {
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain();
$objCustomer->deleted = 1;
$objCustomer->deleted = Customer::STATUS_DELETED;
if ($objCustomer->update()) {
// unset the customer which is processed
// not processed customers will be deleted with default process if no errors are there
@@ -1040,7 +1055,7 @@ class AdminCustomersControllerCore extends AdminController
$this->redirect_after = false;
}
// Check that the new email is not already in use
$customer_email = strval(Tools::getValue('email'));
$customer_email = trim(strval(Tools::getValue('email')));
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
@@ -1048,6 +1063,9 @@ class AdminCustomersControllerCore extends AdminController
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
$this->display = 'edit';
return $customer;
} elseif (Customer::customerExists($customer_email, false, true)) {
$this->errors[] = Tools::displayError('The email is already associated with a banned account. Please use a different one.');
$this->display = 'edit';
} elseif (trim(Tools::getValue('passwd')) == '') {
$this->validateRules();
$this->errors[] = Tools::displayError('Password can not be empty.');
@@ -1068,7 +1086,7 @@ class AdminCustomersControllerCore extends AdminController
public function processUpdate()
{
if (Validate::isLoadedObject($this->object)) {
$customer_email = strval(Tools::getValue('email'));
$customer_email = trim(strval(Tools::getValue('email')));
// check if e-mail already used
if ($customer_email != $this->object->email) {
@@ -1297,4 +1315,41 @@ class AdminCustomersControllerCore extends AdminController
die('ok');
}
}
public function ajaxProcessVerifyCustomerEmail()
{
$response = array('status' => true);
$idCustomer = Tools::getValue('id_customer', 0);
if (($email = trim(strval(Tools::getValue('email'))))
&& ($idCustomerByEmail = Customer::customerExists($email, true, false))
&& (Validate::isLoadedObject($objCustomer = new Customer($idCustomerByEmail)))
&& $idCustomerByEmail != $idCustomer // the admin is trying to add/update the account
) {
$response['status'] = false;
if ($objCustomer->deleted) {
$response['msg'] = Tools::displayError('This email is already associated with a banned account. Please use a different one.');
} else {
$response['msg'] = Tools::displayError('An account already exists for this email address.');
}
}
$this->ajaxDie(json_encode($response));
}
public function setMedia()
{
parent::setMedia();
if ($this->loadObject(true)
&& ($this->display == 'edit' || $this->display == 'add')
) {
$idCustomer = $this->object->id ? $this->object->id : 0;
Media::addJSDef(
array(
'customer_controller_url' => self::$currentIndex.'&token='.$this->token,
'id_customer' => $idCustomer
)
);
$this->addJS(_PS_JS_DIR_.'admin/customers.js');
}
}
}

View File

@@ -452,10 +452,9 @@ class AdminFeaturesControllerCore extends AdminController
$this->initToolbar();
$this->initPageHeaderToolbar();
if ($this->display == 'edit' || $this->display == 'add') {
if (!$this->loadObject(true)) {
return;
if ($this->loadObject(true)) {
$this->content .= $this->renderForm();
}
$this->content .= $this->renderForm();
} elseif ($this->display == 'view') {
// Some controllers use the view action without an object
if ($this->className) {

View File

@@ -208,7 +208,6 @@ class AdminNormalProductsControllerCore extends AdminController
// show the list of the product according to the booking or service products
$this->_where .= ' AND a.`booking_product` = 0';
$this->_use_found_rows = false;
$this->_group = 'GROUP BY a.`id_product`';
$this->fields_list = array();
@@ -1393,7 +1392,10 @@ class AdminNormalProductsControllerCore extends AdminController
parent::postProcess();
}
if ($this->display == 'edit' || $this->display == 'add') {
if (in_array($this->display, array('add', 'edit'))
&& $this->tabAccess[$this->display] == '1'
&& $this->loadObject(true)
) {
$this->addJqueryUI(array(
'ui.core',
'ui.widget'
@@ -2815,9 +2817,7 @@ class AdminNormalProductsControllerCore extends AdminController
}
// let's calculate this once for all
if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) {
$this->errors[] = 'Unable to load object';
} else {
if ($this->loadObject(true)) {
$this->_displayDraftWarning($this->object->active);
// if there was an error while saving, we don't want to lose posted data

View File

@@ -82,6 +82,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
)
);
$maxOrderDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE', Configuration::get('MAX_GLOBAL_BOOKING_DATE'));
$this->fields_options = array(
'order_restrict' => array(
'title' => $this->l('Order Restrict'),
@@ -92,11 +93,13 @@ class AdminOrderPreferencesControllerCore extends AdminController
'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'),
'type' => 'text',
'id' => 'max_global_book_date',
'auto_value' => false,
'value' => date('d-m-Y', strtotime($maxOrderDate)),
'class' => 'fixed-width-xxl readonly',
),
'GLOBAL_PREPARATION_TIME' => array(
'title' => $this->l('Preparation time'),
'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'),
'title' => $this->l('Minimum booking offset'),
'hint' => $this->l('The minimum booking offset is the minimum number of days before the check-in date that a guest must book a room. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'),
'desc' => $this->l('Set to 0 to disable this feature.'),
'type' => 'text',
'class' => 'fixed-width-xl',
@@ -329,6 +332,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
$this->errors[] = Tools::displayError('Please assign a valid CMS page for Terms and Conditions.');
}
$_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE')));
$maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE');
$globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME');
$maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate));
@@ -342,9 +346,9 @@ class AdminOrderPreferencesControllerCore extends AdminController
}
if ($globalPreparationTime === '') {
$this->errors[] = Tools::displayError('Field \'Preparation time\' can not be empty.');
$this->errors[] = Tools::displayError('Field \'Minimum booking offset\' can not be empty.');
} elseif ($globalPreparationTime !== '0' && !Validate::isUnsignedInt($globalPreparationTime)) {
$this->errors[] = Tools::displayError('Field \'Preparation time\' is invalid.');
$this->errors[] = Tools::displayError('Field \'Minimum booking offset\' is invalid.');
}
}

View File

@@ -24,17 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class BoOrder extends PaymentModule
{
public $active = 1;
public $name = 'bo_order';
public function __construct()
{
$this->displayName = $this->l('Back office order');
}
}
/**
* @property Order $object
*/
@@ -628,11 +617,23 @@ class AdminOrdersControllerCore extends AdminController
$payment_methods[] = $module->displayName;
}
}
// Set the order currency at first element of currencies
if ($currencies = Currency::getCurrenciesByIdShop($objOrder->id_shop)) {
foreach ($currencies as $key => $currency) {
if ($currency['id_currency'] == $objOrder->id_currency) {
unset($currencies[$key]);
array_unshift($currencies, $currency);
break;
}
}
}
$this->context->smarty->assign(
array(
'current_index' => self::$currentIndex,
'order' => $objOrder,
'currencies' => Currency::getCurrenciesByIdShop($objOrder->id_shop),
'currencies' => $currencies,
'payment_methods' => $payment_methods,
'payment_types' => $this->getPaymentsTypes(),
'invoices_collection' => $objOrder->getInvoicesCollection(),
@@ -765,6 +766,33 @@ class AdminOrdersControllerCore extends AdminController
die(Tools::jsonEncode($response));
}
public function ajaxProcessInitRoomAllotmentCommentModal()
{
$response['hasError'] = 1;
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail(Tools::getValue('id_hotel_booking')))) {
if ($objBookingDetail->booking_type == HotelBookingDetail::ALLOTMENT_MANUAL) {
// get booking information by order
$this->context->smarty->assign('comment', $objBookingDetail->comment);
$title = $objBookingDetail->room_num.' - '.$objBookingDetail->room_type_name.' ('.
Tools::displayDate($objBookingDetail->date_from).' - '.Tools::displayDate($objBookingDetail->date_to).')';
$modal = array(
'modal_id' => 'room-allotment-comment-modal',
'modal_class' => 'modal-md order_detail_modal',
'modal_title' => '<i class="icon icon-comment"></i> &nbsp'.$title,
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_room_allotment_comment.tpl'),
'modal_actions' => array(),
);
$this->context->smarty->assign($modal);
$response['hasError'] = 0;
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
}
}
die(Tools::jsonEncode($response));
}
public function ajaxProcessInitRoomReallocationModal()
{
// set modal details
@@ -991,7 +1019,9 @@ class AdminOrdersControllerCore extends AdminController
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
if ($this->tabAccess['edit'] == 1 && $this->display == 'view') {
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
if ($this->loadObject()) {
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
}
// add js for reallocation process
$this->addJS(_PS_JS_DIR_.'admin/reallocation.js');
// $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js');
@@ -2856,6 +2886,7 @@ class AdminOrdersControllerCore extends AdminController
$this->tpl_view_vars = array(
'totalRefundedRooms' => $totalRefundedRooms,
'orderOverBookings' => $orderOverBookings,
// refund info
'refund_allowed' => (int) $order->isReturnable(),
'applicable_refund_policies' => $applicableRefundPolicies,
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
@@ -2948,9 +2979,9 @@ class AdminOrdersControllerCore extends AdminController
'customer' => $customer)
),
'orderDocuments' => $order->getDocuments(),
'ROOM_STATUS_ALLOTED' => HotelBookingDetail::STATUS_ALLOTED,
'ROOM_STATUS_CHECKED_IN' => HotelBookingDetail::STATUS_CHECKED_IN,
'ROOM_STATUS_CHECKED_OUT' => HotelBookingDetail::STATUS_CHECKED_OUT,
'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL,
);
return parent::renderView();
@@ -4820,6 +4851,7 @@ class AdminOrdersControllerCore extends AdminController
'tax_excl' => $totalRoomPriceAfterTE,
'tax_incl' => $totalRoomPriceAfterTI,
);
if ($update_htl_tables = $obj_booking_detail->UpdateHotelCartHotelOrderOnOrderEdit(
$id_order,
$id_room,
@@ -6924,4 +6956,4 @@ class AdminOrdersControllerCore extends AdminController
$this->ajaxDie(json_encode($result));
}
}
}

View File

@@ -201,13 +201,15 @@ class AdminProductsControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtd ON (hrtd.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))';
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))
LEFT JOIN `'._DB_PREFIX_.'htl_advance_payment` hap ON (hap.`id_product` = a.`id_product`)';
$this->_select .= ' (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
$this->_select .= ' a.`show_at_front`, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
$this->_select .= 'hrt.`adults`, hrt.`children`, hrt.`max_guests`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, ';
$this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, ';
$this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`';
$this->_select .= ', IFNULL((SELECT hap.`active` FROM `'._DB_PREFIX_.'htl_advance_payment` hap WHERE hap.`id_product` = a.`id_product`), 0) AS advance_payment';
$this->_select .= ', IFNULL(hap.`active`, 0) AS advance_payment';
$this->_select .= ', IF(IFNULL(hap.`active`, 0), 1, 0) badge_success, IF(IFNULL(hap.`active`, 0), 0, 1) badge_danger ';
if ($join_category) {
$this->_join .= ' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.') ';
@@ -319,10 +321,23 @@ class AdminProductsControllerCore extends AdminController
'optional' => true,
);
$this->fields_list['show_at_front'] = array(
'title' => $this->l('Show at front'),
'align' => 'text-center',
'type' => 'bool',
'active' => 'show_at_front',
'optional' => true,
'havingFilter' => true,
'visible_default' => true,
'orderby' => false,
);
if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) {
$this->fields_list['advance_payment'] = array(
'title' => $this->l('Advance Payment'),
'active' => 'advance_payment',
'callback' => 'getAdvancePaymentStatus',
'badge_success' => true,
'badge_danger' => true,
'align' => 'text-center',
'type' => 'bool',
'optional' => true,
@@ -431,6 +446,18 @@ class AdminProductsControllerCore extends AdminController
}
}
public function getAdvancePaymentStatus($val, $row)
{
if ($val) {
$str_return = $this->l('Yes');
} else {
$str_return = $this->l('No');
}
return $str_return;
}
private function buildCategoryOptions($category)
{
$space = str_repeat('&nbsp;', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1));
@@ -816,6 +843,13 @@ class AdminProductsControllerCore extends AdminController
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$product->id,
@@ -839,11 +873,6 @@ class AdminProductsControllerCore extends AdminController
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
@@ -1336,10 +1365,10 @@ class AdminProductsControllerCore extends AdminController
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
}
// Toggle Advance Payment
elseif (Tools::getIsset('advance_payment'.$this->table)) {
// Toggle Show at front
elseif (Tools::getIsset('show_at_front'.$this->table)) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'toggleAdvancePayment';
$this->action = 'toggleShowAtFront';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
@@ -1457,6 +1486,7 @@ class AdminProductsControllerCore extends AdminController
if (in_array($this->display, array('add', 'edit'))
&& $this->tabAccess[$this->display] == '1'
&& $this->loadObject(true)
) {
$this->addJqueryUI(array(
'ui.core',
@@ -1896,38 +1926,21 @@ class AdminProductsControllerCore extends AdminController
return $res;
}
public function processToggleAdvancePayment()
public function processToggleShowAtFront()
{
if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) {
$this->loadObject(true);
if (!Validate::isLoadedObject($this->object)) {
return false;
}
if (!$this->loadObject()) {
return false;
}
if (!Product::isBookingProduct($this->object->id)) {
return false;
}
if (!Product::isBookingProduct($this->object->id)) {
return false;
}
$objHotelAdvancedPayment = new HotelAdvancedPayment();
$roomTypeAdvancePaymentInfo = $objHotelAdvancedPayment->getIdAdvPaymentByIdProduct($this->object->id);
if ($roomTypeAdvancePaymentInfo) {
$objHotelAdvancedPayment = new HotelAdvancedPayment($roomTypeAdvancePaymentInfo['id']);
$objHotelAdvancedPayment->active = !$objHotelAdvancedPayment->active;
} else {
$objHotelAdvancedPayment->id_product = $this->object->id;
$objHotelAdvancedPayment->payment_type = '';
$objHotelAdvancedPayment->value = '';
$objHotelAdvancedPayment->id_currency = '';
$objHotelAdvancedPayment->tax_include = '';
$objHotelAdvancedPayment->calculate_from = 0;
$objHotelAdvancedPayment->active = 1;
}
if ($objHotelAdvancedPayment->save()) {
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
} else {
$this->errors[] = $this->l('Something went wrong while updating Advance payment status.');
}
$this->object->show_at_front = !$this->object->show_at_front;
if ($this->object->save()) {
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
} else {
$this->errors[] = $this->l('An error occurred while updating "show at front".');
}
}
@@ -2463,7 +2476,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The count of rooms that are currently occupied by guests.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2473,7 +2486,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The count of rooms that are either booked but currently unoccupied or available for booking', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2483,7 +2496,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The total number of rooms that are currently booked and and awaiting guest check-in', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2493,7 +2506,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The total number of rooms that are currently disabled.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2503,7 +2516,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The total number of rooms that can be booked directly from the front office.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2513,7 +2526,7 @@ class AdminProductsControllerCore extends AdminController
$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);
$helper->tooltip = $this->l('The total number of rooms available for booking through the back office.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2850,9 +2863,7 @@ class AdminProductsControllerCore extends AdminController
}
// let's calculate this once for all
if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) {
$this->errors[] = 'Unable to load object';
} else {
if ($this->loadObject(true)) {
$this->_displayDraftWarning($this->object->active);
// if there was an error while saving, we don't want to lose posted data

View File

@@ -283,11 +283,9 @@ class AdminRequestSqlControllerCore extends AdminController
$this->initToolbar();
$this->initPageHeaderToolbar();
if ($this->display == 'edit' || $this->display == 'add') {
if (!$this->loadObject(true)) {
return;
if ($this->loadObject(true)) {
$this->content .= $this->renderForm();
}
$this->content .= $this->renderForm();
} elseif ($this->display == 'view') {
// Some controllers use the view action without an object
if ($this->className) {

View File

@@ -172,6 +172,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'name' => 'name',
'maxlength' => 32,
'required' => true,
'col' => 3,
'hint' => $this->l('Forbidden characters').' <>;=#{}'
),
array(
@@ -222,8 +223,8 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'name' => 'price',
'disabled' => ($this->object->price == -1 ? 1 : 0),
'maxlength' => 10,
'suffix' => $this->context->currency->getSign('right'),
'suffix' => $this->context->currency->sign,
'col' => 3,
),
array(
'type' => 'checkbox',
@@ -279,6 +280,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Reduction'),
'name' => 'reduction',
'col' => 3,
'required' => true,
),
),
@@ -297,16 +299,12 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
);
$price = $this->getFieldValue($this->object, 'price');
if ($price != -1 && Validate::isPrice($price)) {
$price = number_format($price, 6);
} else {
if ($price == -1 || !Validate::isPrice($price)) {
$price = '';
}
$reduction = $this->getFieldValue($this->object, 'reduction');
if (Validate::isPrice($reduction)) {
$reduction = number_format($reduction, 6);
} else {
if (!Validate::isPrice($reduction)) {
$reduction = 0;
}

View File

@@ -573,20 +573,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
{
$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)
SELECT count(hbd.`id_product`)
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
) as total_booked 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'.
WHERE p.`active` = 1 AND p.`booking_product` = 1 '.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : '').'
HAVING totalRevenue > 0
ORDER BY totalRevenue DESC';
GROUP By p.`id_product`
HAVING total_booked > 0
ORDER BY total_booked DESC';
return Db::getInstance()->getValue($sql);
}
@@ -856,20 +856,36 @@ class AdminStatsControllerCore extends AdminStatsTabController
break;
case 'occupied_rooms':
$value = AdminStatsController::getOccupiedRooms(0);
$value = AdminStatsController::getDistinctRoomBookingsCount(
date('Y-m-d', strtotime('-1 day')),
date('Y-m-d'),
0,
HotelBookingDetail::STATUS_CHECKED_IN
);
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;
$totalUnAvailRooms = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0);
$totalUnAvailRooms = $totalUnAvailRooms[strtotime(date('Y-m-d'))];
$totalRooms = AdminStatsController::getTotalRooms(0);
$totalOccupiedRooms = AdminStatsController::getDistinctRoomBookingsCount(
date('Y-m-d', strtotime('-1 day')),
date('Y-m-d'),
0,
HotelBookingDetail::STATUS_CHECKED_IN
);
$value = $totalRooms - ($totalUnAvailRooms + $totalOccupiedRooms);
break;
case 'booked_rooms':
$value = AdminStatsController::getBookedRooms(0);
$value = AdminStatsController::getDistinctRoomBookingsCount(
date('Y-m-d'),
date('Y-m-d', strtotime('+1 day')),
0,
HotelBookingDetail::STATUS_ALLOTED
);
break;
@@ -965,6 +981,12 @@ class AdminStatsControllerCore extends AdminStatsTabController
case 'average_lead_time':
$dateToday = date('Y-m-d');
$value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2);
if ($value && $value <= 1) {
$value .= ' '.$this->l('day');
} else {
$value .= ' '.$this->l('days');
}
break;
case 'average_guest_in_booking':
$dateToday = date('Y-m-d');
@@ -1103,13 +1125,14 @@ class AdminStatsControllerCore extends AdminStatsTabController
);
}
public static function getTotalRooms($idHotel = null)
public static function getTotalRooms($idHotel = null, $active = null)
{
$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($active) ? ' AND p.`active` ='.(int) $active : ' ').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '');
return Db::getInstance()->getValue($sql);
@@ -1123,16 +1146,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$occupancyData = array('count_total' => 0, 'count_occupied' => 0, 'count_available' => 0, 'count_unavailable' => 0);
$countTotal = Db::getInstance()->getValue(
'SELECT COUNT(hri.`id`)
FROM `'._DB_PREFIX_.'htl_room_information` hri
INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi
ON (hbi.`id` = hri.`id_hotel`)
LEFT JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`active` = 1'.
HotelBranchInformation::addHotelRestriction($idsHotel, 'hri')
);
$countTotal = self::getTotalRooms($idsHotel, true);
$occupancyData['count_total'] = $countTotal;
// Occupied rooms are booked rooms that are not refunded in the date range
@@ -1417,7 +1431,27 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $result;
}
public static function getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel = null)
public static function getDistinctRoomBookingsCount($dateFrom = false, $dateTo = false, $idHotel = null, $roomBookingStatus = 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 '.
(($dateFrom && $dateTo) ? ' AND hbd.`date_from` <= "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00" ': ' ').
(!is_null($roomBookingStatus) ? ' AND hbd.`id_status` = '.(int) $roomBookingStatus : ' ').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
$result = Db::getInstance()->getValue($sql);
return $result ? $result : 0;
}
public static function getTotalBookedRooms($dateFrom, $dateTo, $idHotel = null)
{
$sql = 'SELECT COUNT(hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
@@ -1795,46 +1829,6 @@ 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`)
@@ -1891,7 +1885,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
public static function getTotalNewCustomers($nbDaysNewCustomers)
{
$maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day'));
$maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day'));
$sql = 'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0';
@@ -1976,7 +1970,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$nightsBookedByDate = self::getRoomNightsData($dateFrom, $dateTo, $idHotel);
$totalNightsBooked = array_sum($nightsBookedByDate);
$totalOccupiedRoom = self::getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel);
$totalOccupiedRoom = self::getTotalBookedRooms($dateFrom, $dateTo, $idHotel);
return $totalOccupiedRoom ? ($totalNightsBooked / $totalOccupiedRoom) : 0;
}

View File

@@ -707,6 +707,15 @@ class AdminStatusesControllerCore extends AdminController
$theme = new Theme($this->context->shop->id_theme);
$default_path = '../mails/';
$theme_path = '../themes/'.$theme->directory.'/mails/'; // Mail templates can also be found in the theme folder
$templatesToIgnore = array(
'footer.html',
'header.html',
'shipped.html',
'in_transit.html',
'download_products.html',
'header_order_conf.html',
'test.html'
);
$array = array();
foreach (Language::getLanguages(false) as $language) {
@@ -722,7 +731,9 @@ class AdminStatusesControllerCore extends AdminController
// We merge all available emails in one array
$templates = array_unique(array_merge(scandir(_PS_ADMIN_DIR_.'/'.$default_path.$iso_code), $theme_templates));
foreach ($templates as $key => $template) {
if (!strncmp(strrev($template), 'lmth.', 5)) {
if (!strncmp(strrev($template), 'lmth.', 5)
&& !in_array($template, $templatesToIgnore)
) {
$search_result = array_search($template, $theme_templates);
$array[$iso_code][] = array(
'id' => substr($template, 0, -5),

View File

@@ -186,8 +186,8 @@ class AdminThemesControllerCore extends AdminController
'thumb' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_FAVICON').(Tools::getValue('conf') ? sprintf('?%04d', rand(0, 9999)) : ''))
),
'PS_STORES_ICON' => array(
'title' => $this->l('Store icon'),
'hint' => $this->l('Will appear on the store locator (inside Google Maps).').'<br />'.$this->l('Suggested size: 30x30, transparent GIF.'),
'title' => $this->l('Map icon'),
'hint' => $this->l('This icon will be displayed at hotel locations on Google Maps.').'<br />'.$this->l('Suggested size: 30x30, transparent GIF.'),
'type' => 'file',
'name' => 'PS_STORES_ICON',
'tab' => 'icons',

View File

@@ -954,7 +954,7 @@ class AdminTranslationsControllerCore extends AdminController
*
* @throws PrestaShopException
*/
protected function findAndWriteTranslationsIntoFile($file_name, $files, $theme_name, $module_name, $dir = false)
protected function findAndWriteTranslationsIntoFile($file_name, $files, $theme_name, $module_name, $dir = false, $copyExistingTranslations = false)
{
// These static vars allow to use file to write just one time.
static $cache_file = array();
@@ -964,7 +964,12 @@ class AdminTranslationsControllerCore extends AdminController
// Set file_name in static var, this allow to open and wright the file just one time
if (!isset($cache_file[$theme_name.'-'.$file_name])) {
require $file_name;
if (file_exists($file_name)) {
require $file_name;
} else {
$_MODULE = array();
}
$module_existing_translations = $_MODULE;
$str_write = '';
$cache_file[$theme_name.'-'.$file_name] = true;
@@ -1010,25 +1015,26 @@ class AdminTranslationsControllerCore extends AdminController
}
if (array_key_exists($post_key, $_POST) && !in_array($pattern, $array_check_duplicate)) {
$array_check_duplicate[] = $pattern;
if ($_POST[$post_key] == '') {
continue;
}
$array_check_duplicate[] = $pattern;
$str_write .= '$_MODULE['.$pattern.'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $_POST[$post_key])).'\';'."\n";
$this->total_expression++;
}
}
foreach ($module_existing_translations as $key => $value) {
if (!in_array('\''.$key.'\'', $array_check_duplicate)) {
$str_write .= '$_MODULE[\''.$key.'\'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $value)).'\';'."\n";
}
}
}
}
if (isset($cache_file[$theme_name.'-'.$file_name]) && $str_write != "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n") {
if ($copyExistingTranslations) {
foreach ($module_existing_translations as $key => $value) {
if (!in_array('\''.$key.'\'', $array_check_duplicate)) {
$str_write .= '$_MODULE[\''.$key.'\'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $value)).'\';'."\n";
}
}
}
if (isset($cache_file[$theme_name.'-'.$file_name])) {
file_put_contents($file_name, $str_write);
}
}
@@ -1056,6 +1062,8 @@ class AdminTranslationsControllerCore extends AdminController
unset($files[$key]);
} elseif ($type_clear === 'directory' && (!is_dir($path.$file) || in_array($file, $arr_exclude))) {
unset($files[$key]);
} else if ($file == 'index.php') {
unset($files[$key]);
}
}
@@ -1468,8 +1476,15 @@ class AdminTranslationsControllerCore extends AdminController
$arr_files = $this->getAllModuleFiles($modules, null, $this->lang_selected->iso_code, true);
// Find and write all translation modules files
foreach ($arr_files as $value) {
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']);
foreach ($arr_files as $key => $value) {
$copyExistingTranslations = false;
if (!isset($arr_files[$key + 1])
|| ($arr_files[$key + 1]['module'] != $value['module'])
) {
$copyExistingTranslations = true;
}
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir'], $copyExistingTranslations);
}
// Clear modules cache

View File

@@ -59,7 +59,6 @@ class CategoryControllerCore extends FrontController
$this->addCSS(_THEME_CSS_DIR_.'occupancy.css');
$this->addJS(_THEME_JS_DIR_.'occupancy.js');
$scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
if ($scenes && count($scenes)) {
$this->addJS(_THEME_JS_DIR_.'scenes.js');
@@ -101,16 +100,8 @@ class CategoryControllerCore extends FrontController
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
$currentTimestamp = strtotime(date('Y-m-d'));
$dateFromTimestamp = strtotime($dateFrom);
$dateToTimestamp = strtotime($dateTo);
if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($id_category);
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
@@ -165,6 +156,16 @@ class CategoryControllerCore extends FrontController
$currency = new Currency($this->context->currency->id);
if ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($id_category)) {
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($id_hotel);
if ($preparationTime
&& strtotime('+ '.$preparationTime.' day') >= strtotime($date_from)
) {
$date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
if (strtotime($date_from) >= strtotime($date_to)) {
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
}
}
$id_cart = $this->context->cart->id;
$id_guest = $this->context->cookie->id_guest;

View File

@@ -79,8 +79,8 @@ class CmsControllerCore extends FrontController
} elseif (Validate::isLoadedObject($this->cms_category) && $this->cms_category->active && $this->cms_category->isAssociatedToShop()) {
$this->assignCase = 2;
} else {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
// incase the cms page in invalid i.e, url is tampered
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
}
@@ -134,6 +134,9 @@ class CmsControllerCore extends FrontController
'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',
'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite)
));
} else {
// incase the cms page is inactive
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
$this->setTemplate(_PS_THEME_DIR_.'cms.tpl');

View File

@@ -235,6 +235,11 @@ class ContactControllerCore extends FrontController
// GOOGLE MAP
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
Media::addJsDef(
array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
)
);
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.
'&libraries=places&language='.$this->context->language->iso_code.'&region='.$this->context->country->iso_code
@@ -308,6 +313,7 @@ class ContactControllerCore extends FrontController
$this->context->smarty->assign(
array(
'hotelsInfo' => $hotelsInfo,
'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
'gblHtlPhone' => $gblHtlPhone,
'gblHtlEmail' => $gblHtlEmail,
'gblHtlAddress' => $gblHtlAddress,

View File

@@ -614,7 +614,9 @@ class GuestTrackingControllerCore extends FrontController
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if ($apiKey = Configuration::get('PS_API_KEY')) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
) {

View File

@@ -423,6 +423,7 @@ class OrderDetailControllerCore extends FrontController
'obj_hotel_branch_information' => $objHotelBranchInformation,
'hotel_address_info' => $hotelAddressInfo,
'hotel_refund_rules' => $hotelRefundRules,
'view_on_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
)
);
@@ -797,7 +798,9 @@ class OrderDetailControllerCore extends FrontController
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder(Tools::getValue('id_order'))) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if ($apiKey = Configuration::get('PS_API_KEY')) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
) {
@@ -808,6 +811,7 @@ class OrderDetailControllerCore extends FrontController
'map_input_text' => $objHotelBranchInformation->map_input_text,
),
'hotel_name' => $objHotelBranchInformation->hotel_name,
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON'))
));
$this->addJS(

View File

@@ -426,7 +426,9 @@ class OrderOpcControllerCore extends ParentOrderController
public function initContent()
{
// validate room types before payment by customer
$this->errors = HotelCartBookingData::validateCartBookings();
if ($orderRestrictErr = HotelCartBookingData::validateCartBookings()) {
$this->errors = array_merge($this->errors, $orderRestrictErr);
}
parent::initContent();
@@ -494,7 +496,7 @@ class OrderOpcControllerCore extends ParentOrderController
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->context->smarty->assign(
array(
'orderRestrictErr' => count($this->errors) ? 1 : 0,
'orderRestrictErr' => count($orderRestrictErr) ? 1 : 0,
// 'allDemands' => $allDemands,
// 'defaultcurrencySign' => $objCurrency->sign,
'THEME_DIR' => _THEME_DIR_,

View File

@@ -78,7 +78,8 @@ class ProductControllerCore extends FrontController
'hotel_location' => array(
'latitude' => $objHotelBranchInformation->latitude,
'longitude' => $objHotelBranchInformation->longitude,
)
),
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON'))
));
$this->addJS(
@@ -109,26 +110,18 @@ class ProductControllerCore extends FrontController
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
$currentTimestamp = strtotime(date('Y-m-d'));
$dateFromTimestamp = strtotime($dateFrom);
$dateToTimestamp = strtotime($dateTo);
if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
parent::init();
if ($id_product = (int) Tools::getValue('id_product')) {
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
}
if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) {
$objHotelRoomType = new HotelRoomType();
$hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id);
$idHotel = (int) $hotelRoomInfo['id_hotel'];
if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
} else if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
@@ -341,6 +334,7 @@ class ProductControllerCore extends FrontController
$date_from = Tools::getValue('date_from');
$date_to = Tools::getValue('date_to');
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
// set date to according to los
@@ -355,6 +349,17 @@ class ProductControllerCore extends FrontController
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
if ($preparationTime
&& strtotime('+ '.$preparationTime.' day') >= strtotime($date_from)
) {
$date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
if (strtotime($date_from) >= strtotime($date_to)) {
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
}
$hotel_branch_obj = new HotelBranchInformation($hotel_id);
/*Max date of ordering for order restrict*/
$order_date_restrict = false;
@@ -368,9 +373,6 @@ class ProductControllerCore extends FrontController
}
}
/*End*/
// booking preparation time
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
$objHotelImage = new HotelImage();
$hotelImageLink = null;
if ($coverImage = HotelImage::getCover($hotel_id)) {

View File

@@ -208,8 +208,12 @@ class StoresControllerCore extends FrontController
*/
protected function assignStores()
{
$this->context->smarty->assign('hasStoreIcon', Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_DIR_.Configuration::get('PS_STORES_ICON')))); // by webkul to get media link.
$hasStoreIcon = false;
if (Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')))) { // by webkul to get media link.
$hasStoreIcon = true;
}
$this->context->smarty->assign('hasStoreIcon', $hasStoreIcon);
$distance_unit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distance_unit, array('km', 'mi'))) {
$distance_unit = 'km';

View File

@@ -1 +1,10 @@
Deny from ALL
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1 +1,10 @@
Allow from ALL
# Apache 2.2
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from ALL
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all granted
</IfModule>

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

16
img/.htaccess Normal file
View File

@@ -0,0 +1,16 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
<Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico|webp|avif)$">
Allow from all
</Files>
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
<Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm|ico|webp|avif)$">
Require all granted
</Files>
</IfModule>

View File

@@ -1,8 +0,0 @@
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
deny from all
<Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm)$">
order deny,allow
allow from all
</Files>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 175 KiB

51
js/admin/customers.js Normal file
View File

@@ -0,0 +1,51 @@
/*
* Copyright since 2010 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 Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*/
$(document).ready(function() {
$(document).on('focusout', '#email', function() {
var email = $.trim($('#email').val());
if (email != '') {
$('.customer_email_msg').hide();
$.ajax({
url: customer_controller_url,
method: 'POST',
dataType: 'json',
data: {
ajax : 1,
id_customer: id_customer,
email: email,
action: 'verifyCustomerEmail'
},
success: function(response) {
if (!response.status) {
if ($('#email').closest('.input-group').parent().find('.customer_email_msg').length) {
$('.customer_email_msg').text(response.msg);
} else {
$('#email').closest('.input-group').parent().append('<p class="text-danger customer_email_msg">'+ response.msg+'</p>');
}
$('.customer_email_msg').show();
} else {
$('.customer_email_msg').hide();
}
}
});
}
});
});

View File

@@ -306,11 +306,17 @@ function init()
e.preventDefault();
});
// voucher modal show and close
$('#add_voucher').unbind('click').click(function(e) {
e.preventDefault();
VoucherModal.show();
});
$(document).on('hidden.bs.modal', '#voucher-modal', function(){
$('#voucher-modal').remove();
});
// End: voucher modal show and close
$(document).on('change','#discount_type', function(e) {
// Percent type
if ($(this).val() == 1)
@@ -342,11 +348,18 @@ function init()
$('select[name=discount_invoice]').attr('disabled', false);
});
// payment information modal show and close
$('.open_payment_information').unbind('click').click(function(e) {
e.preventDefault();
OrderPaymentDetailModal.show($(this));
});
$(document).on('hidden.bs.modal', '#payment-detail-modal', function(){
$('#payment-detail-modal').remove();
});
// End: payment information modal show and close
initRoomEvents();
initProductEvents();
}
@@ -523,15 +536,12 @@ function initProductEvents()
$(this).val(max_child_in_room);
if (elementVal == 1) {
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
haserror = true;
} else {
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
haserror = true;
}
} else if (elementVal > max_allowed_for_current) {
$(this).val(max_allowed_for_current);
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
haserror = true;
}
} else {
max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val();
@@ -1171,15 +1181,21 @@ function initRoomEvents()
e.preventDefault();
});
// order-payment-modal hide and show
$('#add_new_payment').on('click', function(e) {
e.preventDefault();
OrderPaymentModal.show();
});
$(document).on('hidden.bs.modal', '#order-payment-modal', function(){
$('#order-payment-modal').remove();
});
$('#cancle_add_payment').on('click', function(e) {
e.preventDefault();
OrderPaymentModal.hide();
});
// end order-payment-modal hide and show
}
function addRoomRefreshTotal() {
var quantity = parseInt($('#add_product_product_quantity').val());
@@ -1655,6 +1671,10 @@ $(document).ready(function() {
DocumentNoteModal.show($(this));
});
$(document).on('hidden.bs.modal', '#document-note-modal', function(){
$('#document-note-modal').remove();
});
$(document).on('click', '.submitDocumentNote', function(e) {
e.preventDefault();
DocumentNoteModal.submit();
@@ -1669,6 +1689,10 @@ $(document).ready(function() {
TravellerModal.show();
});
$(document).on('hidden.bs.modal', '#traveller-modal', function(){
$('#traveller-modal').remove();
});
$(document).on('click', '.submitTravellerInfo', function(e) {
e.preventDefault();
TravellerModal.submit();
@@ -1709,6 +1733,10 @@ $(document).ready(function() {
RoomStatusModal.show($(this));
});
$(document).on('hidden.bs.modal', '#room-status-modal', function(){
$('#room-status-modal').remove();
});
$(document).on('click', '.submitRoomStatus', function(e) {
e.preventDefault();
RoomStatusModal.submit();
@@ -1716,6 +1744,19 @@ $(document).ready(function() {
// End: RoomStatusModal: Processes
// ======================================
// Start: RoomAllotmentCommentModal: Processes
$(document).on('click', '.manual_allotment_comment', function(e){
e.preventDefault();
RoomAllotmentCommentModal.show(this);
});
$(document).on('hidden.bs.modal', '#room-allotment-comment-modal', function(){
$('#room-allotment-comment-modal').remove();
});
// End: RoomAllotmentCommentModal: Processes
// ======================================
// Start: AddRoomBookingModal: Processes
/*For adding rooms to the order*/
$(document).on('click', '#add_room', function(e){
@@ -1736,6 +1777,10 @@ $(document).ready(function() {
$('.submitAddRoom').attr('disabled', true);
}
});
$(document).on('hidden.bs.modal', '#add-room-booking-modal', function(){
$('#add-room-booking-modal').remove();
});
// End: AddRoomBookingModal: Processes
// ======================================
@@ -1789,6 +1834,10 @@ $(document).ready(function() {
CancelRoomBookingModal.show();
});
$(document).on('hidden.bs.modal', '#cancel-room-booking-modal', function(){
$('#cancel-room-booking-modal').remove();
});
$(document).on('click', '.submitCancelBooking', function(e) {
e.preventDefault();
CancelRoomBookingModal.submit();
@@ -2337,6 +2386,10 @@ const AddRoomBookingModal = {
$('#add_product_product_price_tax_incl').val(data.price_tax_incl);
$('#add_product_product_price_tax_excl').val(data.price_tax_excl);
$("#new_product .max_adults").val(data.room_type_info.max_adults);
$("#new_product .max_children").val(data.room_type_info.max_children);
$("#new_product .max_guests").val(data.room_type_info.max_guests);
//Added by webkul to set curent date in the date fields by default
var date_in = $.datepicker.formatDate('dd-mm-yy', new Date());
var date_out = $.datepicker.formatDate('dd-mm-yy', new Date(new Date().getTime()+24*60*60*1000));
@@ -2528,6 +2581,40 @@ const CancelRoomBookingModal = {
}
};
// Modal object to handle comment on rooms for manual cancellation
const RoomAllotmentCommentModal = {
show: function(element) {
$(".loading_overlay").show();
let idHtlBooking = parseInt($(element).attr('data-id_hotel_booking_detail'));
$.ajax({
type: 'POST',
headers: {
"cache-control": "no-cache"
},
url: admin_order_tab_link,
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_hotel_booking='+idHtlBooking+'&action=initRoomAllotmentCommentModal',
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
$('#room-allotment-comment-modal').modal('show');
} else {
showErrorMessage(txtSomeErr);
}
},
complete: function() {
$(".loading_overlay").hide();
}
});
},
close: function() {
$('#room-allotment-comment-modal').modal('hide');
}
};
function updateAdditionalServices(element)
{
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');

View File

@@ -1,2 +1,11 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -1,5 +1,16 @@
Order deny,allow
Deny from all
<FilesMatch "\.(html|txt)$">
Allow from all
</FilesMatch>
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
<FilesMatch "\.(html|txt)$">
Allow from all
</FilesMatch>
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
<FilesMatch "\.(html|txt)$">
Require all granted
</FilesMatch>
</IfModule>

View File

@@ -1,3 +1,12 @@
<FilesMatch "\.tpl$">
Deny from all
<FilesMatch "(\.tpl|config\.xml|config_([a-z]+)\.xml)$">
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
</FilesMatch>

View File

@@ -103,6 +103,24 @@ class blocknavigationmenu extends Module
}
}
public function hookActionObjectCMSUpdateAfter($params)
{
$idCMS = $params['object']->id;
if (!$params['object']->active) {
$objCustomNavigationLink = new WkCustomNavigationLink();
// Disabling depended Navigation link
$objCustomNavigationLink->disableNavigationLinksByIdCMS($idCMS);
}
}
public function hookActionObjectCMSDeleteAfter($params)
{
$idCMS = $params['object']->id;
$objCustomNavigationLink = new WkCustomNavigationLink();
// Deleting depended Navigation link
$objCustomNavigationLink->deleteNavigationLinksByIdCMS($idCMS);
}
public function install()
{
$objModuleDb = new WkBlockNavigationMenuDb();
@@ -125,6 +143,8 @@ class blocknavigationmenu extends Module
array (
'footer',
'actionObjectLanguageAddAfter',
'actionObjectCMSUpdateAfter',
'actionObjectCMSDeleteAfter',
'displayDefaultNavigationHook',
'displayNavigationHook',
'top',

View File

@@ -235,6 +235,39 @@ class WkCustomNavigationLink extends ObjectModel
$objCustomNavigationLink->is_custom_link = 0;
$objCustomNavigationLink->link = 'contact';
$objCustomNavigationLink->save();
return true;
}
public function getNavigationLinksByIdCMS($idCMS)
{
return Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'htl_custom_navigation_link`
WHERE `id_cms`='.(int) $idCMS
);
}
public function disableNavigationLinksByIdCMS($idCMS)
{
$objCustomNavigationLink = new WkCustomNavigationLink();
if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) {
foreach ($navLinks as $navLink) {
$objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']);
$objCustomNavigationLink->active = 0;
$objCustomNavigationLink->save();
}
}
}
public function deleteNavigationLinksByIdCMS($idCMS)
{
$objCustomNavigationLink = new WkCustomNavigationLink();
if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) {
foreach ($navLinks as $navLink) {
$objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']);
$objCustomNavigationLink->delete();
}
}
}
}

View File

@@ -179,6 +179,17 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
if (Validate::isLoadedObject($objNavigationLink)) {
$smartyVars['navigationLinkInfo'] = (array) $objNavigationLink;
$smartyVars['edit'] = 1;
if ($objNavigationLink->id_cms
&& Validate::isLoadedObject($objCMS = new CMS($objNavigationLink->id_cms))
) {
$smartyVars['id_cms_category'] = $objCMS->id_cms_category;
if (empty($this->errors)
&& !$objCMS->active
) {
$cmsEditLink = $this->context->link->getAdminLink('AdminCmsContent').'&updatecms&id_cms='.(int) $objCMS->id;
$this->warnings[] = $this->l('Please enable linked').' <a href="'.$cmsEditLink.'" target="_blank">'.$this->l('CMS page').'</a> '.$this->l('to enable this navigation link.');
}
}
}
// send theme's front pages
$themePages = array();
@@ -196,7 +207,29 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
$smartyVars['themePages'] = $themePages;
$smartyVars['languages'] = Language::getLanguages(false);
$smartyVars['currentLang'] = Language::getLanguage((int) Configuration::get('PS_LANG_DEFAULT'));
$smartyVars['cmsPages'] = CMS::getCMSPages($smartyVars['currentLang'], 1);
$categoryWiseCmsPages = array();
if ($cmsPages = CMS::getCMSPages($smartyVars['currentLang'], null, false)) {
foreach ($cmsPages as $page) {
$cmsPage['id_cms'] = $page['id_cms'];
$cmsPage['meta_title'] = $page['meta_title'];
$categoryWiseCmsPages[$page['id_cms_category']][] = $cmsPage;
}
}
if ($cmsCategories = CMSCategory::getCategories($this->context->language->id, false, false)) {
if (!isset($smartyVars['id_cms_category'])) {
$smartyVars['id_cms_category'] = $cmsCategories[0]['id_cms_category'];
}
foreach ($cmsCategories as $cmsCatKey => $cmsCategory) {
if (!isset($categoryWiseCmsPages[$cmsCategory['id_cms_category']])) {
unset($cmsCategories[$cmsCatKey]);
}
}
}
$smartyVars['categoryWiseCmsPages'] = $categoryWiseCmsPages;
$smartyVars['categories'] = $cmsCategories;
$this->context->smarty->assign($smartyVars);
$this->fields_form = array(
'submit' => array(
@@ -261,6 +294,10 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
}
if ($isCmsPage) {
$objCustomNavigationLink->id_cms = $idCms;
$objCMS = new CMS((int) $idCms);
if (!$objCMS->active) {
$active = $objCMS->active;
}
} else {
$objCustomNavigationLink->id_cms = 0;
foreach ($languages as $language) {
@@ -365,7 +402,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
if (isset($pos[2]) && (int) $pos[2] === $idNavigationLink) {
if ($objFeatureBlock = new WkCustomNavigationLink((int) $pos[2])) {
if (isset($position)
&& $objFeatureBlock->updatePosition($way, $position, $idNavigationLink)
&& $objFeatureBlock->updatePosition($way, $position)
) {
echo 'ok position '.(int) $position.' for custom navigation link '.(int) $pos[1].'\r\n';
} else {
@@ -381,9 +418,31 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
}
}
public function processStatus()
{
if (Validate::isLoadedObject($this->loadObject())
&& $this->object->id_cms
&& Validate::isLoadedObject($objCMS = new CMS($this->object->id_cms))
) {
if (!$objCMS->active
&& !$this->object->active
) {
$this->errors[] = $this->l('Please activate the linked CMS page to enable this navigation link.');
}
}
if (empty($this->errors)) {
return parent::processStatus();
}
return $this->object;
}
public function setMedia()
{
parent::setMedia();
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_navigation_link.js');
if ($this->display == 'edit' || $this->display == 'add') {
$this->addJS($this->module->getPathUri().'views/js/admin/wk_navigation_link.js');
}
}
}

View File

@@ -37,6 +37,12 @@ $(document).ready(function() {
$(".custom_redirect_page_div").removeClass('hidden');
}
});
$(document).on('change', '#id_cms_category', function(){
var id_cat = parseInt($('#id_cms_category').val());
$('.cms_pages_table').hide();
$('#cms_pages_table_'+id_cat).show();
});
});
function showNavigationLinkLangField(lang_iso_code, id_lang)
@@ -45,4 +51,4 @@ function showNavigationLinkLangField(lang_iso_code, id_lang)
$('.navigation_link_name_all').hide();
$('#navigation_link_name_'+id_lang).show();
}
}

View File

@@ -52,8 +52,26 @@
</div>
{* Feilds of cms page *}
<div id="cms_block_content" class="{if isset($smarty.post.is_cms_block_link)}{if !$smarty.post.is_cms_block_link}hidden{/if}{elseif !isset($navigationLinkInfo['id_cms']) || !$navigationLinkInfo['id_cms']}hidden{/if}">
<div class="form-group">
<div id="selected_parent_category">
<label class="control-label col-lg-3">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Select CMS category to display related CMS pages' mod='blocknavigationmenu'}" data-html="true">
{l s='Select CMS category' mod='blocknavigationmenu'}
</span>
</label>
<div class="col-lg-9">
<select class="form-control fixed-width-xxl " name="id_cms_category" id="id_cms_category">
{if isset($categories) && count($categories)}
{foreach $categories as $category}
<option value="{$category.id_cms_category}" {if isset($smarty.post.id_cms_category)}{if ($smarty.post.id_cms_category == $category.id_cms_category)}selected="selected"{/if}{else if isset($id_cms_category) && ($id_cms_category == $category.id_cms_category)}selected="selected"{/if}>{$category.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
{/if}
</select>
</div>
</div>
</div>
{*Display CMS Pages*}
{if isset($cmsPages)}
{if isset($categoryWiseCmsPages)}
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip"
@@ -61,32 +79,34 @@
{l s='Select CMS Page' mod='blocknavigationmenu'}
</span>
</label>
<div class="col-lg-9">
<table class="table table-bordered" style="width:40%;">
<thead>
<tr>
<th class="fixed-width-xs">
</th>
<th class="fixed-width-xs"><span class="title_box">{l s='ID' mod='blocknavigationmenu'}</span></th>
<th>
<span class="title_box">
{l s='CMS Page Name' mod='blocknavigationmenu'}
</span>
</th>
</tr>
</thead>
<tbody>
{foreach $cmsPages as $cmsPage}
{foreach $categoryWiseCmsPages as $idCMSCategory => $cmsPages}
<div class="col-lg-9">
<table class="table table-bordered cms_pages_table" id="cms_pages_table_{$idCMSCategory}" style="width:40%; {if isset($smarty.post.id_cms_category) && $smarty.post.id_cms_category != $idCMSCategory}display:none;{else if isset($id_cms_category) && ($id_cms_category != $idCMSCategory)}display:none;{/if}">
<thead>
<tr>
<td><input type="radio" value="{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}" name="id_cms" {if isset($navigationLinkInfo['id_cms']) && $navigationLinkInfo['id_cms'] == $cmsPage.id_cms}checked="checked"{/if}>
</td>
<td>{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}</td>
<td><label for="groupBox_{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}">{$cmsPage.meta_title}</label></td>
<th class="fixed-width-xs">
</th>
<th class="fixed-width-xs"><span class="title_box">{l s='ID' mod='blocknavigationmenu'}</span></th>
<th>
<span class="title_box">
{l s='CMS Page Name' mod='blocknavigationmenu'}
</span>
</th>
</tr>
{/foreach}
</tbody>
</table>
</div>
</thead>
<tbody>
{foreach $cmsPages as $cmsPage}
<tr>
<td><input type="radio" value="{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}" name="id_cms" {if isset($navigationLinkInfo['id_cms']) && $navigationLinkInfo['id_cms'] == $cmsPage.id_cms}checked="checked"{/if}>
</td>
<td>{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}</td>
<td><label for="groupBox_{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}">{$cmsPage.meta_title}</label></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/foreach}
</div>
{/if}
</div>

View File

@@ -84,12 +84,23 @@ class Blocknewsletter extends Module
'actionCustomerAccountAdd',
'registerGDPRConsent',
'actionExportGDPRData',
'actionObjectCustomerUpdateBefore',
'actionDeleteGDPRCustomer',
'actionObjectCustomerDeleteAfter',
)
);
}
public function hookActionObjectCustomerUpdateBefore($params)
{
$objCustomer = new Customer ($params['object']->id);
if ($params['object']->deleted == Customer::STATUS_DELETED
&& ($register_status = $this->isNewsletterRegistered($objCustomer->email))
) {
$this->unregister($objCustomer->email, $register_status);
}
}
public function hookActionObjectCustomerDeleteAfter($params)
{
$objCustomer = $params['object'];

View File

@@ -87,10 +87,13 @@ class Dashactivity extends Module
public function hookDashboardZoneOne($params)
{
$this->context->smarty->assign($this->getConfigFieldsValues());
$date_from = $this->context->employee->stats_date_from;
$date_to = $this->context->employee->stats_date_to;
$this->context->smarty->assign(
array(
'dashactivity_config_form' => $this->renderConfigForm(),
'link' => $this->context->link
'link' => $this->context->link,
'new_customer_filter_link' => $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_date_add[]='.$date_from.'&customerFilter_date_add[]='.$date_to
)
);

View File

@@ -122,7 +122,7 @@
<ul class="stats-list">
<li>
<span class="item-label">
<a href="{$link->getAdminLink("AdminCustomers")|escape:"html":"UTF-8"}" target="_blank">
<a href="{$new_customer_filter_link|escape:"html":"UTF-8"}" target="_blank">
<span>{l s="New Customers" mod='dashactivity'}</span>
</a>
</span>

View File

@@ -2098,6 +2098,14 @@ class HotelBookingDetail extends ObjectModel
// Reinject quantity in stock
$objOldOrderDetail->reinjectQuantity($objOldOrderDetail, $objOldOrderDetail->product_quantity, $deleteQty);
// retrieve and delete HotelCartBookingData row
$idHotelCartBookingData = Db::getInstance()->getValue('SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE date_from = "'.pSQL($objOldHotelBooking->date_from).'" AND date_to = "'.pSQL($objOldHotelBooking->date_to).'"
AND id_room = '.(int) $objOldHotelBooking->id_room.' AND `id_order` = '.(int) $objOldHotelBooking->id_order
);
$objCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
$objCartBookingData->delete();
// delete the booking detail
$objOldHotelBooking = new HotelBookingDetail($idHotelBooking);
$objOldHotelBooking->delete();
@@ -2107,6 +2115,19 @@ class HotelBookingDetail extends ObjectModel
// ===============================================================
} else {
// If we are reallocating to the same room type then we need to update only the room details
// update in the cart booking data
// retrieve HotelCartBookingData row
$idHotelCartBookingData = Db::getInstance()->getValue('SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data`
WHERE date_from = "'.pSQL($objOldHotelBooking->date_from).'" AND date_to = "'.pSQL($objOldHotelBooking->date_to).'"
AND id_room = '.(int) $objOldHotelBooking->id_room.' AND `id_order` = '.(int) $objOldHotelBooking->id_order
);
$objCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
$objCartBookingData->id_room = $idRoom;
// set backorder to 0 as available reallocate rooms will always be free
$objOldHotelBooking->is_back_order = 0;
$objCartBookingData->save();
// update in the hotel booking detail table
$objOldHotelBooking->id_room = $idRoom;
$objOldHotelBooking->room_num = $objHotelRoomInfo->room_num;
// set backorder to 0 as available reallocate rooms will always be free
@@ -2253,10 +2274,14 @@ class HotelBookingDetail extends ObjectModel
*
* @return [boolean] [true if updated otherwise false]
*/
public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = 0)
public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = null)
{
$table = 'htl_booking_detail';
$data = array('is_refunded' => (int) $is_refunded, 'is_cancelled' => (int) $is_cancelled);
$data = array('is_refunded' => (int) $is_refunded);
if (!is_null($is_cancelled)) {
$data['is_cancelled'] = (int) $is_cancelled;
}
if ($id_rooms) {
foreach ($id_rooms as $key_rm => $val_rm) {
@@ -3358,15 +3383,19 @@ class HotelBookingDetail extends ObjectModel
}
}
if ($bookedRoomInfoFlag && !$roomCount && $result) {
if (!$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');
$result[$key]['child_ages'] = json_decode($bookingInfo['child_ages'], true);
// 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]);
if ($bookedRoomInfoFlag) {
$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]);
}
}
}
}

View File

@@ -1228,13 +1228,13 @@ class HotelBranchInformation extends ObjectModel
if (!$this->use_global_preparation_time) {
if ($this->preparation_time === '') {
$message = Tools::displayError('Preparation time is a required.');
$message = Tools::displayError('Minimum booking offset is a required.');
if ($die) {
throw new PrestaShopException($message);
}
return $error_return ? $message : false;
} elseif ($this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) {
$message = Tools::displayError('Preparation time is invalid.');
$message = Tools::displayError('Minimum booking offset is invalid.');
if ($die) {
throw new PrestaShopException($message);
}

View File

@@ -225,7 +225,7 @@ class HotelHelper
Configuration::updateValue(
'MAX_GLOBAL_BOOKING_DATE',
date('d-m-Y', strtotime(date('Y-m-d', time()).' + 1 year'))
date('Y-m-d', strtotime(date('Y-m-d', time()).' + 1 year'))
);
Configuration::updateValue('GLOBAL_PREPARATION_TIME', 0);
@@ -931,4 +931,25 @@ class HotelHelper
return $daysDifference;
}
public static function validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)
{
$validStartDateTimeStamp = strtotime(date('Y-m-d'));
if ($preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($idHotel)) {
$validStartDateTimeStamp = strtotime(date('Y-m-d', strtotime('+ '.$preparationTime.' day')));
}
$dateFromTimestamp = strtotime($dateFrom);
$dateToTimestamp = strtotime($dateTo);
$isValid = true;
if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $validStartDateTimeStamp))) {
$isValid = false;
} else if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $validStartDateTimeStamp))) {
$isValid = false;
} else if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) {
$isValid = false;
}
return $isValid;
}
}

View File

@@ -107,6 +107,11 @@ class HotelRoomType extends ObjectModel
$objHotelRoomType->id_hotel = $idHotelNew;
$objHotelRoomType->adults = $roomType['adults'];
$objHotelRoomType->children = $roomType['children'];
$objHotelRoomType->max_adults = $roomType['max_adults'];
$objHotelRoomType->max_children = $roomType['max_children'];
$objHotelRoomType->max_guests = $roomType['max_guests'];
$objHotelRoomType->min_los = $roomType['min_los'];
$objHotelRoomType->max_los = $roomType['max_los'];
if ($objHotelRoomType->save()) {
$objHotelRoomType->updateCategories();
return $returnId ? $objHotelRoomType->id : true;

View File

@@ -180,6 +180,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_product,
$date_from,
$date_to,
$groups,
$type = 'date_range',
$current_Special_days = false,
$id_feature_price = 0
@@ -188,20 +189,26 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$date_to = date('Y-m-d', strtotime($date_to));
if ($type == 'specific_date') {
return Db::getInstance()->getRow(
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing`
WHERE `id_product`='.(int) $id_product.' AND `active`=1
AND `date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_SPECIFIC.'
AND `date_from` = \''.pSQL($date_from).'\'
AND `id_feature_price`!='.(int) $id_feature_price
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp
INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg
ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`)
WHERE rtfp.`id_product`='.(int) $id_product.' AND rtfp.`active`=1
AND rtfp.`date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_SPECIFIC.'
AND rtfp.`date_from` = \''.pSQL($date_from).'\'
AND rtfp.`id_feature_price`!='.(int) $id_feature_price.'
AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')'
);
} elseif ($type == 'special_day') {
$featurePrices = Db::getInstance()->executeS(
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing`
WHERE `id_product`='.(int) $id_product.'
AND `is_special_days_exists`=1 AND `active`=1
AND `date_from` < \''.pSQL($date_to).'\'
AND `date_to` > \''.pSQL($date_from).'\'
AND `id_feature_price`!='.(int) $id_feature_price
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp
INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg
ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`)
WHERE rtfp.`id_product`='.(int) $id_product.'
AND rtfp.`is_special_days_exists`=1 AND `active`=1
AND rtfp.`date_from` < \''.pSQL($date_to).'\'
AND rtfp.`date_to` > \''.pSQL($date_from).'\'
AND rtfp.`id_feature_price`!='.(int) $id_feature_price.'
AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')'
);
if ($featurePrices) {
foreach ($featurePrices as $featurePrice) {
@@ -216,13 +223,16 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
return false;
} elseif ($type == 'date_range') {
return Db::getInstance()->getRow(
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing`
WHERE `id_product`='.(int) $id_product.' AND `active`=1
AND `date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_RANGE.'
AND `is_special_days_exists`=0
AND `date_from` <= \''.pSQL($date_to).'\'
AND `date_to` >= \''.pSQL($date_from).'\'
AND `id_feature_price`!='.(int) $id_feature_price
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp
INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg
ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`)
WHERE rtfp.`id_product`='.(int) $id_product.' AND rtfp.`active`=1
AND rtfp.`date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_RANGE.'
AND rtfp.`is_special_days_exists`=0
AND rtfp.`date_from` <= \''.pSQL($date_to).'\'
AND rtfp.`date_to` >= \''.pSQL($date_from).'\'
AND rtfp.`id_feature_price`!='.(int) $id_feature_price.'
AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')'
);
}
return false;

View File

@@ -104,6 +104,9 @@ class AdminAddHotelController extends ModuleAdminController
public function renderForm()
{
if (!$this->loadObject(true)) {
return;
}
$smartyVars = array();
//tinymce setup
$smartyVars['path_css'] = _THEME_CSS_DIR_;
@@ -125,7 +128,7 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['defaultCountry'] = $country->name[Configuration::get('PS_LANG_DEFAULT')];
$idCountry = null;
if ($this->display == 'edit') {
if ($this->object->id) {
$idHotel = Tools::getValue('id');
$hotelBranchInfo = new HotelBranchInformation($idHotel);
$objCategory = new Category($hotelBranchInfo->id_category);
@@ -168,13 +171,11 @@ class AdminAddHotelController extends ModuleAdminController
}
}
$smartyVars['order_restrict_date_info'] = $restrictDateInfo;
}
// manage state option
if ($this->display == 'add') {
} else {
$idCountry = Tools::getValue('hotel_country');
}
// manage state option
$stateOptions = null;
if ($idCountry) {
$stateOptions = State::getStatesByIdCountry($idCountry);
@@ -183,6 +184,8 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['state_var'] = $stateOptions;
$smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP');
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
$smartyVars['MAX_GLOBAL_BOOKING_DATE'] = (Configuration::get('MAX_GLOBAL_BOOKING_DATE'));
$smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME');
$this->context->smarty->assign($smartyVars);
@@ -343,9 +346,9 @@ class AdminAddHotelController extends ModuleAdminController
if (!$enableUseGlobalPreparationTime) {
if ($preparationTime === '') {
$this->errors[] = $this->l('Preparation time is a required field.');
$this->errors[] = $this->l('Minimum booking offset is a required field.');
} elseif ($preparationTime !== '0' && !Validate::isUnsignedInt($preparationTime)) {
$this->errors[] = $this->l('Preparation time is invalid.');
$this->errors[] = $this->l('Minimum booking offset is invalid.');
}
}
}
@@ -469,7 +472,7 @@ class AdminAddHotelController extends ModuleAdminController
}
// getHotel address
if ($idHotelAddress = $objHotelBranch->getHotelIdAddress()) {
$objAddress = new Address($idHotelAddress);
$objAddress = new Address($idHotelAddress);
} else {
$objAddress = new Address();
}
@@ -776,6 +779,7 @@ class AdminAddHotelController extends ModuleAdminController
'sortRowsUrl' => $this->context->link->getAdminLink('AdminAddHotel'),
'primaryHotelId' => Configuration::get('WK_PRIMARY_HOTEL'),
'disableHotelMsg' => $this->l('Primary hotel for website will be updated to first available active hotel.', null, true),
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
)
);
// GOOGLE MAP

View File

@@ -182,6 +182,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$objFeaturePricing->id_product,
$objFeaturePricing->date_from,
$objFeaturePricing->date_to,
$objFeaturePricing->getGroups($objFeaturePricing->id),
$objFeaturePricing->id,
$objFeaturePricing->is_special_days_exists,
$objFeaturePricing->special_days
@@ -283,6 +284,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$roomTypeId,
$dateFrom,
$dateTo,
$group,
$idFeaturePrice,
$isSpecialDaysExists = false,
$jsonSpecialDays = "false"
@@ -293,6 +295,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$roomTypeId,
$dateFrom,
$dateTo,
$group,
'specific_date',
false,
$idFeaturePrice
@@ -302,6 +305,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$roomTypeId,
$dateFrom,
$dateTo,
$group,
'special_day',
$jsonSpecialDays,
$idFeaturePrice
@@ -311,6 +315,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$roomTypeId,
$dateFrom,
$dateTo,
$group,
'date_range',
false,
$idFeaturePrice
@@ -335,6 +340,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$impactValue = Tools::getValue('impact_value');
$dateSelectionType = Tools::getValue('date_selection_type');
$specificDate = date('Y-m-d', strtotime(Tools::getValue('specific_date')));
$groups = Tools::getValue('groupBox');
$jsonSpecialDays = json_encode($specialDays);
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
@@ -361,6 +367,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$roomTypeId,
$dateFrom,
$dateTo,
$groups,
$idFeaturePrice,
$isSpecialDaysExists,
$jsonSpecialDays
@@ -435,7 +442,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
}
}
if (!(bool)Tools::getValue('groupBox')) {
if (!(bool)$groups) {
$this->errors[] = $this->l('Please select at least one group for the group access');
}
@@ -467,7 +474,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$objFeaturePricing->active = $enableFeaturePrice;
// set the values of the groups for this feature price
$objFeaturePricing->groupBox = Tools::getValue('groupBox');
$objFeaturePricing->groupBox = $groups;
if ($objFeaturePricing->save()) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {

View File

@@ -159,7 +159,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'type' => 'file',
'image' => $imgExist ? $image : false,
'hint' => $this->l('This image appears as header background image on home page.'),
'name' => 'htl_header_image',
'name' => 'WK_HOTEL_HEADER_IMAGE',
'url' => _PS_IMG_,
),
),
@@ -307,7 +307,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'value' => 0,
),
),
'hint' => $this->l('If set to No, Google Maps will not be displayed for hotel location. You need to set hotels location from edit hotel page to display location on the map at contact-us page.'),
'hint' => $this->l('Enable to display Google Maps for hotel locations. If disabled, Google Maps will not be shown.'),
),
'WK_MAP_HOTEL_ACTIVE_ONLY' => array(
'title' => $this->l('Display Active Hotels Only'),
@@ -392,8 +392,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
}
}
}
if ($_FILES['htl_header_image']['name']) {
if ($error = ImageManager::validateUpload($_FILES['htl_header_image'], Tools::getMaxUploadSize())) {
if ($_FILES['WK_HOTEL_HEADER_IMAGE']['name']) {
if ($error = ImageManager::validateUpload($_FILES['WK_HOTEL_HEADER_IMAGE'], Tools::getMaxUploadSize())) {
$this->errors[] = $error;
}
@@ -401,8 +401,10 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
$file_name = 'hotel_header_image_'.time().'.jpg';
$img_path = _PS_IMG_DIR_.$file_name;
if (ImageManager::resize($_FILES['htl_header_image']['tmp_name'], $img_path)) {
if (ImageManager::resize($_FILES['WK_HOTEL_HEADER_IMAGE']['tmp_name'], $img_path)) {
$olderHeaderImg = _PS_IMG_DIR_.Configuration::get('WK_HOTEL_HEADER_IMAGE');
Configuration::updateValue('WK_HOTEL_HEADER_IMAGE', $file_name);
Tools::deleteFile($olderHeaderImg);
} else {
$this->errors[] = $this->l('Some error occured while uoploading image.Please try again.');
}

View File

@@ -58,6 +58,10 @@ class AdminHotelFeaturesController extends ModuleAdminController
public function renderForm()
{
if (!$this->loadObject(true)) {
return;
}
$smartyVars = array();
//lang vars
$languages = Language::getLanguages(false);
@@ -66,7 +70,7 @@ class AdminHotelFeaturesController extends ModuleAdminController
$smartyVars['languages'] = $languages;
$smartyVars['currentLang'] = $currentLang;
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
if ($id = Tools::getValue('id')) {
if ($id = $this->object->id) {
$smartyVars['edit'] = 1;
if (Validate::isLoadedObject($objFeatures = new HotelFeatures($id))) {
$featureInfo = (array) $objFeatures;

View File

@@ -195,7 +195,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
public function renderView()
{
if (!($objOrderReturn = $this->loadObject(true))) {
if (!($objOrderReturn = $this->loadObject())) {
return;
}
$refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id);
@@ -245,7 +245,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(),
'paymentMethods' => $paymentMethods,
'name_controller' => Tools::getValue('controller'),
'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg')
'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg'),
'expiry_date' => time() + (3600 * 24 * 365.25)
)
);
@@ -325,6 +326,14 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
} else {
$this->errors[] = $this->l('Invalid refund state.');
}
if (Tools::isSubmit('generateDiscount')) {
if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) {
$this->errors[] = $this->l('Voucher expiry date is required.');
} elseif (!Validate::isDate($voucher_expiry_date)) {
$this->errors[] = $this->l('Invalid voucher expiry date.');
}
}
} else {
$this->errors[] = $this->l('Invalid refund information found.');
}
@@ -480,7 +489,12 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$cartrule->id_customer = $objOrder->id_customer;
$now = time();
$cartrule->date_from = date('Y-m-d H:i:s', $now);
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
// generateDiscount
if ($voucher_expiry_date) {
$cartrule->date_to = date('Y-m-d H:i:s', strtotime($voucher_expiry_date));
} else {
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
}
$cartrule->active = 1;
$cartrule->highlight = 1;
$cartrule->reduction_amount = $totalRefundedAmount;
@@ -560,6 +574,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
if ($this->display == 'view') {
$this->addJqueryUI('ui.tooltip', 'base', true);
$this->removeJS(Media::getJqueryUIPath('effects.core', 'base', false), false);
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_refund_request.js');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/admin/wk_refund_request.css');
}

View File

@@ -141,14 +141,13 @@ class AdminOrderRefundRulesController extends ModuleAdminController
$smartyVars = array();
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$smartyVars['objCurrency'] = $objCurrency;
if ($this->display == 'edit'
&& $refundRuleInfo = $this->loadObject(true)
if (($refundRuleInfo = $this->loadObject(true))
&& $this->object->id
) {
$smartyVars['edit'] = 1;
$idRefundRule = Tools::getValue('id_refund_rule');
$objRefundRule = new HotelOrderRefundRules();
$smartyVars['refund_rules_info'] = (array)$refundRuleInfo;
$smartyVars['refund_rules_info'] = (array) $refundRuleInfo;
}
//lang vars

View File

@@ -1 +1,10 @@
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -70,7 +70,7 @@ class HotelReservationSystem extends Module
) {
Configuration::updateValue(
'MAX_GLOBAL_BOOKING_DATE',
date('d-m-Y', strtotime(date('Y-m-d', time()).' + 1 year'))
date('Y-m-d', strtotime(date('Y-m-d', time()).' + 1 year'))
);
}
if (!Configuration::get('PS_CATALOG_MODE')) {
@@ -293,7 +293,9 @@ class HotelReservationSystem extends Module
public function hookDisplayLeftColumn()
{
if (Tools::getValue('controller') == 'category') {
if ($apiKey = Configuration::get('PS_API_KEY')) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
) {
$idCategory = Tools::getValue('id_category');
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory);
$objHotel = new HotelBranchInformation($idHotel, $this->context->language->id);
@@ -308,6 +310,7 @@ class HotelReservationSystem extends Module
'map_input_text' => $objHotel->map_input_text,
),
'hotel_name' => $objHotel->hotel_name,
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
));
$this->context->controller->addJS(
@@ -484,7 +487,8 @@ class HotelReservationSystem extends Module
// Make rooms available for booking if order status is cancelled, refunded or error
if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) {
$isCancelled = 0;
// do not change is_cancelled if room is not getting cancelled
$isCancelled = null;
if ($params['newOrderStatus']->id == Configuration::get('PS_OS_CANCELED')) {
$isCancelled = 1;
}

View File

@@ -217,6 +217,7 @@ var GoogleMapsManager = {
position: latLng,
map: that.map,
draggable: true,
icon: PS_STORES_ICON
});
that.markers.push(marker);
marker.addListener('dragend', function(e) {
@@ -531,6 +532,10 @@ $(document).ready(function() {
});
/* ---- HotelConfigurationSettingController Admin ---- */
toggleGoogleMapsFields();
$('#WK_GOOGLE_ACTIVE_MAP_on').parent().on('click', function(e) {
toggleGoogleMapsFields();
});
if ($('#WK_SHOW_MSG_ON_BO_on').prop('checked') === true) {
$("#conf_id_WK_BO_MESSAGE").show();
@@ -826,7 +831,14 @@ $(document).ready(function() {
initGoogleMaps();
});
function toggleGoogleMapsFields()
{
if ($('#WK_GOOGLE_ACTIVE_MAP_on').attr('checked') == 'checked') {
$('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().show();
} else {
$('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().hide();
}
}
function showFeaturePriceRuleLangField(lang_iso_code, id_lang)

View File

@@ -23,6 +23,21 @@ $(document).ready(function() {
manageRefundOptions();
}
$('#order_return_form').on('submit', function() {
if ($("#id_refund_state option:selected").attr('refunded') == 1) {
if ($('#generateDiscount:checked').length) {
if ($('#voucher_expiry').val() == '') {
$('#voucher_expiry').parent().addClass('has-error');
return false;
}
}
}
});
$('#voucher_expiry').on('focus', function() {
$('#voucher_expiry').parent().removeClass('has-error');
});
// initialize tootip for room price
if ($('#rooms_refund_info .price_info').length) {
$('#rooms_refund_info .price_info').each(function (i, element) {
@@ -70,6 +85,21 @@ $(document).ready(function() {
}
});
$('#voucher_expiry').datepicker({
dateFormat: 'dd-mm-yy',
altFormat: 'yy-mm-dd',
altField: '#voucher_expiry_date',
minDate: 0,
});
$(document).on('change', '#generateDiscount', function() {
if ($(this).is(':checked')) {
$(".generate_discount_fields").show(200);
} else {
$(".generate_discount_fields").hide(200);
}
});
$('#id_refund_state').on('change', function() {
if ($("#id_refund_state option:selected").attr('refunded') == 1) {
$(".refunded_state_fields").show(200);

View File

@@ -34,6 +34,7 @@ function initMap() {
position: hotelLocation,
map: map,
title: hotel_name,
icon: PS_STORES_ICON
});
marker.addListener('click', function() {

View File

@@ -357,17 +357,18 @@
<label for="enable_use_global_max_order_date_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
<div class="help-block">{l s='Global max order date:' mod='hotelreservationsystem'} {dateFormat date=$MAX_GLOBAL_BOOKING_DATE}</div>
</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 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}" />
<input type="text" class="form-control" id="maximum_booking_date" name="maximum_booking_date" value="{if isset($order_restrict_date_info.max_order_date)}{$order_restrict_date_info.max_order_date|escape:'htmlall':'UTF-8'}{/if}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
<span>{l s='Use Global preparation time :' mod='hotelreservationsystem'}</span>
<span>{l s='Use Global minimum booking offset :' mod='hotelreservationsystem'}</span>
</label>
<div class="col-lg-6">
<span class="switch prestashop-switch fixed-width-lg">
@@ -377,10 +378,11 @@
<label for="enable_use_global_preparation_time_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
<div class="help-block">{l s='Global preparation time :' mod='hotelreservationsystem'} {$GLOBAL_PREPARATION_TIME}</div>
</div>
</div>
<div class="form-group" {if isset($smarty.post.enable_use_global_preparation_time)}{if !$smarty.post.enable_use_global_preparation_time}style="display:block;"{else}style="display:none;"{/if}{elseif isset($order_restrict_date_info.use_global_preparation_time) && !$order_restrict_date_info.use_global_preparation_time}style="display:block;" {else} style="display:none;" {/if}>
<label class="control-label col-sm-3 required" for="preparation_time">{l s='Preparation time :' mod='hotelreservationsystem'}</label>
<label class="control-label col-sm-3 required" for="preparation_time">{l s='Minimum booking offset :' mod='hotelreservationsystem'}</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="preparation_time" name="preparation_time" value="{if isset($smarty.post.preparation_time)}{$smarty.post.preparation_time|escape:'html':'UTF-8'}{elseif isset($edit) && isset($order_restrict_date_info.preparation_time)}{$order_restrict_date_info.preparation_time|escape:'htmlall':'UTF-8'}{/if}" />
</div>

View File

@@ -5,7 +5,7 @@
<i class="icon-info-circle"></i> &nbsp;{l s='Order Cancellation Request Information' mod='hotelreservationsystem'}
</div>
<br>
<form id="{$table|escape:'htmlall':'UTF-8'}_form" class="defaultForm {$name_controller|escape:'htmlall':'UTF-8'} form-horizontal" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style|escape:'htmlall':'UTF-8'}"{/if}>
<form id="{$table|escape:'htmlall':'UTF-8'}_form" class="defaultForm {$name_controller|escape:'htmlall':'UTF-8'} form-horizontal" action="{$link->getAdminLink('AdminOrderRefundRequests')|escape:'html':'UTF-8'}&amp;vieworder_return&amp;id_order_return={$orderReturnInfo['id']|escape:'html':'UTF-8'|intval}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style|escape:'htmlall':'UTF-8'}"{/if}>
<div class="panel">
{if isset($customer_name)}
<div class="row">
@@ -369,6 +369,22 @@
</div>
</div>
</div>
<div class="generate_discount_fields" style="display:none;">
<div class="form-group">
<div class="col-sm-3">
<label for="voucher_expiry" class="control-label required">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Please select the date until which the voucher can be used.' mod='hotelreservationsystem'}">{l s='Voucher expiry date' mod='hotelreservationsystem'}</span> :
</label>
</div>
<div class="col-sm-3">
<div class="input-group">
<input type="text" id="voucher_expiry" value="{$expiry_date|date_format:"%d-%m-%Y"}">
<div class="input-group-addon"><i class="icon-calendar"></i></div>
<input type="hidden" name="voucher_expiry_date" id="voucher_expiry_date" value="{$expiry_date|date_format:"%Y-%m-%d"}">
</div>
</div>
</div>
</div>
</div>
{/if}
{/if}

View File

@@ -140,11 +140,31 @@ class WkRoomSearchHelper
if (!$dateTo = Tools::getValue('date_to')) {
$dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateFrom)));
}
$smartyVars['date_from'] = $dateFrom;
$smartyVars['date_to'] = $dateTo;
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($idHotelCategory);
$htlCategoryInfo = $objHotelInfo->getCategoryDataByIdCategory((int) $objCategory->id_parent);
$searchedData['htl_dtl'] = $objHotelInfo->hotelBranchesInfo(0, 1, 1, $idHotel);
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($idHotel);
if ($preparationTime
&& strtotime('+ '.$preparationTime.' day') >= strtotime($dateFrom)
) {
$dateFrom = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
if (strtotime($dateFrom) >= strtotime($dateTo)) {
$controller = Tools::getValue('controller');
if ($controller == 'product'
&& ($idProduct = Tools::getValue('id_product'))
) {
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($idProduct, $dateFrom);
$dateTo = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($dateFrom)));
} else {
$dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateFrom)));
}
}
}
$smartyVars['date_from'] = $dateFrom;
$smartyVars['date_to'] = $dateTo;
$objBookingDetail = new HotelBookingDetail();
$searchedData['num_days'] = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
@@ -152,7 +172,6 @@ class WkRoomSearchHelper
$searchedData['parent_data'] = $htlCategoryInfo;
$searchedData['date_from'] = $dateFrom;
$searchedData['date_to'] = $dateTo;
$searchedData['htl_dtl'] = $objHotelInfo->hotelBranchesInfo(0, 1, 1, $idHotel);
if ($locationCategoryId) {
$objLocationCategory = new Category($locationCategoryId, $context->language->id);

View File

@@ -47,12 +47,13 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro
if ($hotelInfo = $obj_htl_info->hotelBranchInfoByCategoryId($category['id_category'])) {
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotelInfo['id']);
$maxOrderDate = date('Y-m-d', strtotime($maxOrderDate));
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotelInfo['id']);
$hotelsInfo[] = array(
'id_hotel' => $hotelInfo['id'],
'id_category' => $hotelInfo['id_category'],
'hotel_name' => $hotelInfo['hotel_name'],
'max_order_date' => $maxOrderDate,
'preparation_time' => $preparationTime
);
}
}

View File

@@ -138,7 +138,11 @@ const BookingSearchManager = {
$('#hotel_cat_id').val('');
$('#id_hotel_button').html(result.html_hotel_options);
$('#id_hotel_button').trigger('chosen:updated');
// Resetting the data from previously selected hotel
$('#preparation_time').val(0);
var max_order_date = $('#max_order_date').val();
var preparation_time = 0;
createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val());
if (search_auto_focus_next_field) {
BookingSearchManager.activateStep('hotel');
}
@@ -380,6 +384,14 @@ $(document).ready(function() {
if (preparation_time) {
start_date.setDate(start_date.getDate() + parseInt(preparation_time));
start_date.setHours(0, 0, 0, 0);
let selectedDateFrom = new Date(Date.parse(dateFrom));
let selectedDateTo = new Date(Date.parse(dateTo));
if (selectedDateFrom < start_date
|| selectedDateTo < start_date
) {
$('#check_in_time').val('');
$('#check_out_time').val('');
}
}
if (max_order_date) {
@@ -987,4 +999,4 @@ function setBookingSearchPositions() {
$(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) {
inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(positionClass);
});
}
}

View File

@@ -20,7 +20,7 @@
<option value=""></option>
{if isset($hotels_info) && is_array($hotels_info)}
{foreach from=$hotels_info item=hotel_info}
<option class="search_result_li" data-id-hotel="{$hotel_info.id_hotel}" data-hotel-cat-id="{$hotel_info.id_category}" data-max_order_date="{$hotel_info.max_order_date}" tabindex="-1">
<option class="search_result_li" data-id-hotel="{$hotel_info.id_hotel}" data-hotel-cat-id="{$hotel_info.id_category}" data-max_order_date="{$hotel_info.max_order_date}" data-preparation_time="{$hotel_info.preparation_time}" tabindex="-1">
{$hotel_info.hotel_name}
</option>
{/foreach}

View File

@@ -1,2 +1,10 @@
Order deny,allow
Deny from all
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

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