Merge 'origin/develop' into gli-1076-clone and reference field from hidden fields in order webservice parameters
@@ -50,6 +50,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// buttons text align
|
||||
.btn-left {
|
||||
text-align: left;
|
||||
}
|
||||
.btn-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
// Alternate buttons
|
||||
// --------------------------------------------------
|
||||
@@ -140,8 +148,6 @@
|
||||
.btn-block {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
// Vertically space out multiple block buttons
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
{l s='Cart Details'}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-12 table-responsive">
|
||||
<table class="table" id="customer_cart_details_table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -31,6 +31,9 @@
|
||||
<th><span class="title_box">{l s='Room Image'}</th>
|
||||
<th><span class="title_box">{l s='Room Type'}</span></th>
|
||||
<th><span class="title_box">{l s='Duration'}</span></th>
|
||||
{if $occupancy_required_for_booking}
|
||||
<th><span class="fixed-width-lg title_box">{l s='Occupancy'}</span></th>
|
||||
{/if}
|
||||
<th><span class="title_box">{l s='Unit Price (tax excl)'}</span></th>
|
||||
<th><span class="title_box">{l s='Additinal Facilities (tax excl)'}</span></th>
|
||||
<th><span class="title_box">{l s='Total Rooms Price (tax excl)'}</span></th>
|
||||
@@ -42,7 +45,7 @@
|
||||
{if isset($cart_detail_data) && $cart_detail_data}
|
||||
{assign var=curr_id value=$cart->id_currency|intval}
|
||||
{foreach from=$cart_detail_data item=data}
|
||||
<tr>
|
||||
<tr data-id-booking-data="{$data.id}" data-id-product="{$data.id_product}" data-id-room="{$data.id_room}" data-date-from="{$data.date_from}" data-date-to="{$data.date_to}" >
|
||||
<td>{$data.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td><img src="{$data.image_link|escape:'html':'UTF-8'}" title="Room image" /></td>
|
||||
<td>
|
||||
@@ -58,13 +61,71 @@
|
||||
{/if}
|
||||
</td>
|
||||
<td>{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}</td>
|
||||
{if $occupancy_required_for_booking}
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button class="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">
|
||||
<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 selected" 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>
|
||||
</div>
|
||||
<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 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{/if}
|
||||
<td id="cart_detail_data_unit_price_{$data.id|escape:'html':'UTF-8'}">
|
||||
{if $data.feature_price_diff != 0}
|
||||
{assign var=shown_room_type_price value=$data.feature_price_tax_excl}
|
||||
{else}
|
||||
{assign var=shown_room_type_price value=$data.product_price_tax_excl}
|
||||
{/if}
|
||||
<input type="text" class="room_unit_price" data-id-booking-data="{$data.id}" data-id-product="{$data.id_product}" data-id-room="{$data.id_room}" data-date-from="{$data.date_from}" data-date-to="{$data.date_to}" value="{$shown_room_type_price|escape:'html':'UTF-8'}">
|
||||
<input type="text" class="room_unit_price" value="{$shown_room_type_price|escape:'html':'UTF-8'}">
|
||||
</td>
|
||||
<td>
|
||||
{if isset($data.extra_demands) && $data.extra_demands}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
{if !isset($document->is_delivery)}
|
||||
|
||||
{if $document->getRestPaid()}
|
||||
<a href="#formAddPaymentPanel" class="js-set-payment btn btn-default anchor" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}">
|
||||
<a href="#form_add_payment_panel" class="js-set-payment btn btn-default anchor" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}">
|
||||
<i class="icon-money"></i>
|
||||
{l s='Enter payment'}
|
||||
</a>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
</div>
|
||||
</center>
|
||||
</td>
|
||||
<td style="display:none;" class="text-center" colspan="2">
|
||||
<td style="display:none;" class="text-center">
|
||||
<center>
|
||||
<div class="row">
|
||||
<div class="input-group fixed-width-xl">
|
||||
@@ -83,17 +83,66 @@
|
||||
</div>
|
||||
</center>
|
||||
</td>
|
||||
<td style="display:none;" class="productQuantity text-center">
|
||||
<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>
|
||||
|
||||
<td style="display:none;" class="productQuantity text-center" colspan="2">
|
||||
{if $order->with_occupancy}
|
||||
<div class="booking_occupancy">
|
||||
<div class="dropdown">
|
||||
<button class="booking_guest_occupancy 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">
|
||||
<input type="hidden" class="max_adults" value="">
|
||||
<input type="hidden" class="max_children" value="">
|
||||
<input type="hidden" class="max_guests" value="">
|
||||
<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" {if $max_child_in_room}max="{$max_child_in_room}"{/if}>
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<hr class="occupancy-info-separator col-sm-12">
|
||||
</div>
|
||||
<div class="add_occupancy_block">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></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>
|
||||
{*{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;" colspan="2" class="text-center">
|
||||
<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'}">
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="fixed-width-xl room_check_in_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check In'}</div>
|
||||
<input type="text" class="form-control add_product_date_from" name="add_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}" readonly/>
|
||||
<input type="text" class="form-control edit_product_date_from" name="edit_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="fixed-width-xl room_check_out_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check Out'}</div>
|
||||
<input type="text" class="form-control add_product_date_to" name="add_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}" readonly/>
|
||||
<input type="text" class="form-control edit_product_date_to" name="edit_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,6 +78,87 @@
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{if $order->with_occupancy && $data['children']}
|
||||
<div class="dropdown booking_occupancy_show">
|
||||
<button class="btn btn-default btn-left btn-block" data-toggle="dropdown" type="button">
|
||||
<span>{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu well well-sm">
|
||||
<label>{l s='Children Ages'}</label>
|
||||
{if isset($data['child_ages']) && $data['child_ages']}
|
||||
{foreach $data['child_ages'] as $childAge}
|
||||
<p class="">
|
||||
{l s='Child %s : %s years' sprintf=[$childAge@iteration, $childAge]}
|
||||
</p>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="booking_occupancy_show">{if $data['adults']}{$data['adults']}{/if} {if $data['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}</span>
|
||||
{/if}
|
||||
{if $order->with_occupancy}
|
||||
<div class="booking_occupancy_edit" style="display:none;">
|
||||
<div class="dropdown">
|
||||
<button class="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>
|
||||
</div>
|
||||
<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 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="occupancy-info-separator">
|
||||
</div>
|
||||
</div>
|
||||
</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}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="room_unit_price_show">
|
||||
|
||||
@@ -241,12 +241,13 @@
|
||||
e.preventDefault();
|
||||
var cart_row = $(this).closest('tr');
|
||||
var params = {
|
||||
id_booking_data: parseInt($(this).attr('data-id-booking-data')),
|
||||
id_product: parseInt($(this).attr('data-id-product')),
|
||||
id_room: parseInt($(this).attr('data-id-room')),
|
||||
date_from: $(this).attr('data-date-from'),
|
||||
date_to: $(this).attr('data-date-to'),
|
||||
price: $(this).val(),
|
||||
id_booking_data: parseInt($(cart_row).attr('data-id-booking-data')),
|
||||
id_product: parseInt($(cart_row).attr('data-id-product')),
|
||||
id_room: parseInt($(cart_row).attr('data-id-room')),
|
||||
date_from: $(cart_row).attr('data-date-from'),
|
||||
date_to: $(cart_row).attr('data-date-to'),
|
||||
price: new Number($(this).val().replace(",",".")).toFixed(4).toString(),
|
||||
id_cart: id_cart
|
||||
};
|
||||
updateProductPrice(params, cart_row);
|
||||
})
|
||||
@@ -272,6 +273,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
resetBind();
|
||||
|
||||
$('#customer').focus();
|
||||
@@ -332,6 +334,205 @@
|
||||
$('#search-customer-form-group').show();
|
||||
$(this).blur();
|
||||
});
|
||||
|
||||
{literal}
|
||||
$(document).on('click', '.booking_occupancy_wrapper .remove-room-link', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
booking_occupancy_inner = $(this).closest('.booking_occupancy_inner');
|
||||
$(this).closest('.occupancy_info_block').remove();
|
||||
$(booking_occupancy_inner).find('.room_num_wrapper').each(function(key, val) {
|
||||
$(this).text(room_txt + ' - '+ (key+1) );
|
||||
});
|
||||
setRoomTypeGuestOccupancy($(booking_occupancy_inner).closest('.booking_occupancy_wrapper'));
|
||||
});
|
||||
|
||||
$(document).on('change', '.num_occupancy', function(e) {
|
||||
let current_room_occupancy = 0;
|
||||
$(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){
|
||||
current_room_occupancy += parseInt($(this).val());
|
||||
});
|
||||
let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val();
|
||||
let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val());
|
||||
if ($(this).val() > $(this).attr('max')) {
|
||||
$(this).val($(this).attr('max'));
|
||||
}
|
||||
if ($(this).val() > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
}
|
||||
if ($(this).hasClass('num_children')) {
|
||||
var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
if (totalChilds < max_child_in_room) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
|
||||
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
|
||||
var childAgeSelect = '<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
childAgeSelect += '<option value="0">' + under_1_age + '</option>';
|
||||
for (let age = 1; age < max_child_age; age++) {
|
||||
childAgeSelect += '<option value="'+age+'">'+age+'</option>';
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</p>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.booking_guest_occupancy', function(e) {
|
||||
$(this).parent().toggleClass('open');
|
||||
});
|
||||
|
||||
$(document).on('click', function(e) {
|
||||
if ($('.booking_occupancy_wrapper:visible').length) {
|
||||
var occupancy_wrapper = $('.booking_occupancy_wrapper:visible');
|
||||
$(occupancy_wrapper).find(".occupancy_info_block").addClass('selected');
|
||||
if (!($(e.target).closest(".booking_occupancy_wrapper").length || $(e.target).closest(".booking_guest_occupancy").length || $(e.target).closest(".ajax_add_to_cart_button").length || $(e.target).closest(".exclusive.book_now_submit").length)) {
|
||||
let hasErrors = 0;
|
||||
|
||||
let adults = $(occupancy_wrapper).find(".num_adults").map(function(){return $(this).val();}).get();
|
||||
let children = $(occupancy_wrapper).find(".num_children").map(function(){return $(this).val();}).get();
|
||||
let child_ages = $(occupancy_wrapper).find(".guest_child_age").map(function(){return $(this).val();}).get();
|
||||
|
||||
// start validating above values
|
||||
if (!adults.length || (adults.length != children.length)) {
|
||||
hasErrors = 1;
|
||||
showErrorMessage(invalid_occupancy_txt);
|
||||
} else {
|
||||
$(occupancy_wrapper).find('.occupancy_count').removeClass('error_border');
|
||||
|
||||
// validate values of adults and children
|
||||
adults.forEach(function (item, index) {
|
||||
if (isNaN(item) || parseInt(item) < 1) {
|
||||
hasErrors = 1;
|
||||
$(occupancy_wrapper).find(".num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
if (isNaN(children[index])) {
|
||||
hasErrors = 1;
|
||||
$(occupancy_wrapper).find(".num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
});
|
||||
|
||||
// validate values of selected child ages
|
||||
$(occupancy_wrapper).find('.guest_child_age').parent().removeClass('has-error');
|
||||
child_ages.forEach(function (age, index) {
|
||||
age = parseInt(age);
|
||||
if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) {
|
||||
hasErrors = 1;
|
||||
$(occupancy_wrapper).find(".guest_child_age").eq(index).parent().addClass('has-error');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (hasErrors == 0) {
|
||||
$(occupancy_wrapper).parent().removeClass('open');
|
||||
$(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('QloApps:updateRoomOccupancy', function (e, occupancy_wrapper) {
|
||||
e.preventDefault();
|
||||
let cart_row = $(occupancy_wrapper).closest('tr');
|
||||
let occupancy = getBookingOccupancyDetails(cart_row);
|
||||
let params = {
|
||||
id_cart: id_cart,
|
||||
id_booking_data: parseInt($(cart_row).attr('data-id-booking-data')),
|
||||
occupancy : occupancy.shift(),
|
||||
};
|
||||
updateRoomOccupancy(params, cart_row);
|
||||
});
|
||||
|
||||
function getBookingOccupancyDetails(bookingform)
|
||||
{
|
||||
let occupancy = [];
|
||||
let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
|
||||
if (selected_occupancy.length) {
|
||||
$(selected_occupancy).each(function(ind, element) {
|
||||
if (parseInt($(element).find('.num_adults').val())) {
|
||||
let child_ages = [];
|
||||
$(element).find('.guest_child_age').each(function(index) {
|
||||
if ($(this).val() > -1) {
|
||||
child_ages.push($(this).val());
|
||||
}
|
||||
});
|
||||
if ($(element).find('.num_children').val()) {
|
||||
if (child_ages.length != $(element).find('.num_children').val()) {
|
||||
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
|
||||
}
|
||||
}
|
||||
occupancy.push({
|
||||
'adults': $(element).find('.num_adults').val(),
|
||||
'children': $(element).find('.num_children').val(),
|
||||
'child_ages': child_ages
|
||||
});
|
||||
} else {
|
||||
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
|
||||
}
|
||||
|
||||
return occupancy;
|
||||
}
|
||||
|
||||
function setRoomTypeGuestOccupancy(booking_occupancy_wrapper)
|
||||
{
|
||||
var adults = 0;
|
||||
var children = 0;
|
||||
var rooms = $(booking_occupancy_wrapper).find('.occupancy_info_block').length;
|
||||
|
||||
$(booking_occupancy_wrapper).find(".num_adults" ).each(function(key, val) {
|
||||
adults += parseInt($(this).val());
|
||||
});
|
||||
$(booking_occupancy_wrapper).find(".num_children" ).each(function(key, val) {
|
||||
children += parseInt($(this).val());
|
||||
});
|
||||
|
||||
var guestButtonVal = parseInt(adults) + ' ';
|
||||
if (parseInt(adults) > 1) {
|
||||
guestButtonVal += adults_txt;
|
||||
} else {
|
||||
guestButtonVal += adult_txt;
|
||||
}
|
||||
if (parseInt(children) > 0) {
|
||||
if (parseInt(children) > 1) {
|
||||
guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt;
|
||||
} else {
|
||||
guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt;
|
||||
}
|
||||
}
|
||||
// if (parseInt(rooms) > 1) {
|
||||
// guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt;
|
||||
// } else {
|
||||
// guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt;
|
||||
// }
|
||||
// console.log($(booking_occupancy_wrapper).siblings('.booking_guest_occupancy > span'));
|
||||
$(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(guestButtonVal);
|
||||
}
|
||||
{/literal}
|
||||
});
|
||||
|
||||
function resetBind()
|
||||
@@ -389,12 +590,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
function updateProductPrice(params, cart_row) {
|
||||
$.extend(params, {
|
||||
id_cart: id_cart,
|
||||
price: new Number(params.price.replace(",",".")).toFixed(4).toString(),
|
||||
});
|
||||
|
||||
function updateProductPrice(params, cart_row)
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
@@ -414,6 +611,29 @@
|
||||
});
|
||||
}
|
||||
|
||||
function updateRoomOccupancy(params, cart_row)
|
||||
{
|
||||
debugger;
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "JSON",
|
||||
data: {
|
||||
ajax: "1",
|
||||
token: "{getAdminToken tab='AdminCarts'}",
|
||||
tab: "AdminCarts",
|
||||
action: "updateRoomOccupancy",
|
||||
params: params,
|
||||
},
|
||||
success : function(response) {
|
||||
updateCartLine(response.curr_booking_info, cart_row);
|
||||
updateCartSummaryData(response.cart_info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function updateCartLine(data, cart_row) {
|
||||
$(cart_row).find('.cart_line_total_rooms_price').html(data.amt_with_qty);
|
||||
$(cart_row).find('.cart_line_total_price').html(data.total_price);
|
||||
@@ -1807,6 +2027,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{strip}
|
||||
{addJsDef max_child_age=$max_child_age}
|
||||
{addJsDef max_child_in_room=$max_child_in_room}
|
||||
{addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
|
||||
{addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
|
||||
{addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
|
||||
{addJsDefL name='rooms_txt'}{l s='Rooms' js=1}{/addJsDefL}
|
||||
{addJsDefL name='remove_txt'}{l s='Remove' js=1}{/addJsDefL}
|
||||
{addJsDefL name='adult_txt'}{l s='Adult' js=1}{/addJsDefL}
|
||||
{addJsDefL name='adults_txt'}{l s='Adults' js=1}{/addJsDefL}
|
||||
{addJsDefL name='child_txt'}{l s='Child' js=1}{/addJsDefL}
|
||||
{addJsDefL name='children_txt'}{l s='Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
|
||||
{addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
|
||||
{addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL}
|
||||
{/strip}
|
||||
|
||||
<div id="loader_container">
|
||||
<div id="loader"></div>
|
||||
|
||||
@@ -470,7 +470,7 @@
|
||||
</script>
|
||||
</div>
|
||||
<!-- Payments block -->
|
||||
<div id="formAddPaymentPanel" class="panel">
|
||||
<div id="form_add_payment_panel" class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-money"></i>
|
||||
{l s="Payment"} <span class="badge">{$order->getOrderPayments()|@count}</span>
|
||||
@@ -495,13 +495,14 @@
|
||||
{/foreach} *}
|
||||
</p>
|
||||
{/if}
|
||||
<form id="formAddPayment" method="post" action="{$current_index}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'html':'UTF-8'}">
|
||||
<div class="form-group">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box ">{l s='Date'}</span></th>
|
||||
<th><span class="title_box ">{l s='Payment method'}</span></th>
|
||||
<th><span class="title_box ">{l s='Payment source'}</span></th>
|
||||
<th><span class="title_box ">{l s='Transaction ID'}</span></th>
|
||||
<th><span class="title_box ">{l s='Amount'}</span></th>
|
||||
<th><span class="title_box ">{l s='Invoice'}</span></th>
|
||||
@@ -513,6 +514,7 @@
|
||||
<tr>
|
||||
<td>{dateFormat date=$payment['date_add'] full=true}</td>
|
||||
<td>{$payment['payment_method']|escape:'html':'UTF-8'}</td>
|
||||
<td>{$payment_types[$payment['payment_type']]['name']|escape:'html':'UTF-8'}</td>
|
||||
<td>{$payment['transaction_id']|escape:'html':'UTF-8'}</td>
|
||||
<td>{displayPrice price=$payment['real_paid_amount'] currency=$payment['id_currency']}</td>
|
||||
<td>
|
||||
@@ -569,57 +571,91 @@
|
||||
<td class="list-empty hidden-print" colspan="6">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No payment methods are available'}
|
||||
{l s='No payment records'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr class="current-edit hidden-print">
|
||||
<td>
|
||||
<div class="input-group fixed-width-xl">
|
||||
<input type="text" name="payment_date" class="datepicker" value="{date('Y-m-d')}" />
|
||||
<div class="input-group-addon">
|
||||
<i class="icon-calendar-o"></i>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input name="payment_method" list="payment_method" class="payment_method">
|
||||
<datalist id="payment_method">
|
||||
{foreach from=$payment_methods item=payment_method}
|
||||
<option value="{$payment_method}">
|
||||
{/foreach}
|
||||
</datalist>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="payment_transaction_id" value="" class="form-control fixed-width-sm"/>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="payment_amount" value="" class="form-control fixed-width-sm pull-left" />
|
||||
<select name="payment_currency" class="payment_currency form-control fixed-width-xs pull-left">
|
||||
{foreach from=$currencies item=current_currency}
|
||||
<option value="{$current_currency['id_currency']}"{if $current_currency['id_currency'] == $currency->id} selected="selected"{/if}>{$current_currency['sign']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
{if count($invoices_collection) > 0}
|
||||
<select name="payment_invoice" id="payment_invoice">
|
||||
{foreach from=$invoices_collection item=invoice}
|
||||
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-primary" type="submit" name="submitAddPayment">
|
||||
{l s='Add'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary add_new_payment" id="add_new_payment">
|
||||
{l s='Add new payment'}
|
||||
</button>
|
||||
</div>
|
||||
<form id="form_add_payment" class="well" method="post" action="{$current_index}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'html':'UTF-8'}" style="display:none">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">{l s='Date'}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group fixed-width-xl">
|
||||
<input type="text" name="payment_date" class="datepicker" value="{date('Y-m-d')}" />
|
||||
<div class="input-group-addon">
|
||||
<i class="icon-calendar-o"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">{l s='Payment method'}</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="payment_method" list="payment_method" class="form-control payment_method fixed-width-xl">
|
||||
<datalist id="payment_method">
|
||||
{foreach from=$payment_methods item=payment_method}
|
||||
<option value="{$payment_method}">
|
||||
{/foreach}
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">{l s='Payment source'}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="payment_type" class="payment_type form-control fixed-width-xl">
|
||||
{foreach from=$payment_types item=payment_type}
|
||||
<option value="{$payment_type['value']}">{$payment_type['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">{l s='Transaction ID'}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_transaction_id" value="" class="form-control fixed-width-xl"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">{l s='Amount'}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_amount" value="" class="form-control fixed-width-xl pull-left" />
|
||||
<select name="payment_currency" class="payment_currency form-control fixed-width-xs pull-left">
|
||||
{foreach from=$currencies item=current_currency}
|
||||
<option value="{$current_currency['id_currency']}"{if $current_currency['id_currency'] == $currency->id} selected="selected"{/if}>{$current_currency['sign']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{if count($invoices_collection) > 0}
|
||||
<label class="control-label col-sm-2">{l s='Invoice'}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="payment_invoice" id="payment_invoice">
|
||||
{foreach from=$invoices_collection item=invoice}
|
||||
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<button class="btn btn-primary pull-right" type="submit" name="submitAddPayment">
|
||||
{l s='Add payment'}
|
||||
</button>
|
||||
<button class="btn btn-default" id="cancle_add_payment">
|
||||
{l s='Cancel'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{if (!$order->valid && sizeof($currencies) > 1)}
|
||||
<form class="form-horizontal well" method="post" action="{$currentIndex|escape:'html':'UTF-8'}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'html':'UTF-8'}">
|
||||
@@ -1022,6 +1058,64 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{if is_array($returns) && count($returns)}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-undo"></i> {l s='Refunds'}
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">{l s='Refund ID'}</th>
|
||||
<th class="text-left">{l s='Status'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$returns item=return_info}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{$link->getAdminLink('AdminOrderRefundRequests')}&vieworder_return&id_order_return={$return_info.id_order_return}" target="_blank">#{$return_info.id_order_return}</a>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
{capture name=refund_status}
|
||||
{if isset($return_info.payment_mode) && $return_info.payment_mode != ''}{l s='Payment Mode: '}{$return_info.payment_mode}<br/>{/if}
|
||||
{if isset($return_info.id_transaction) && $return_info.id_transaction != ''}{l s='Transaction ID: '}{$return_info.id_transaction}<br/>{/if}
|
||||
{if isset($return_info.id_return_type) && isset($return_info.return_type) && $return_info.id_return_type && $return_info.return_type}
|
||||
{if $return_info.return_type == OrderReturn::RETURN_TYPE_CART_RULE}
|
||||
{l s='Voucher ID: '}
|
||||
<a href="{$link->getAdminLink('AdminCartRules')}&updatecart_rule&id_cart_rule={$return_info.id_return_type}" target="_blank">
|
||||
#{$return_info.id_return_type}
|
||||
</a>
|
||||
{elseif $return_info.return_type == OrderReturn::RETURN_TYPE_ORDER_SLIP}
|
||||
{l s='Credit Slip ID: '}
|
||||
#{$return_info.id_return_type}
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateOrderSlipPDF&id_order_slip={$return_info.id_return_type}" title="#{Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{$return_info.id_return_type|string_format:'%06d'}">
|
||||
{l s='Download' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
{/if}
|
||||
<br/>
|
||||
{/if}
|
||||
{if isset($return_info.id_cart_rule) && $return_info.id_cart_rule}
|
||||
{l s='Voucher ID: '}
|
||||
<a href="{$link->getAdminLink('AdminCartRules')}&updatecart_rule&id_cart_rule={$return_info.id_cart_rule}" target="_blank">
|
||||
#{$return_info.id_cart_rule}
|
||||
</a>
|
||||
<br/>
|
||||
{/if}
|
||||
{/capture}
|
||||
|
||||
{if $smarty.capture.refund_status|trim != ''}
|
||||
{$smarty.capture.refund_status}
|
||||
{else}
|
||||
{$return_info.state_name}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{hook h="displayAdminOrderRight" id_order=$order->id}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1034,7 +1128,7 @@
|
||||
<input type="hidden" value="{$order->getWarehouseList()|implode}" id="warehouse_list" />
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel" id="refundForm">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
{l s='Rooms In This Order'} <span class="badge">{$order_detail_data|@count}</span>
|
||||
@@ -1054,6 +1148,7 @@
|
||||
<th class="text-center"><span class="title_box">{l s='Room Type'}</span></th>
|
||||
<th class="text-center"><span class="title_box">{l s='Hotel Name'}</span></th>
|
||||
<th class="text-center"><span class="title_box">{l s='Duration'}</span></th>
|
||||
<th class="text-center fixed-width-lg"><span class="title_box">{l s='Occupancy'}</span></th>
|
||||
<th class="text-center"><span class="title_box">{l s='Unit Price (Tax excl.)'}</span></th>
|
||||
<th class="text-center"><span class="title_box">{l s='Total Price (Tax incl.)'}</span></th>
|
||||
{if isset($refundReqBookings) && $refundReqBookings}
|
||||
@@ -1113,9 +1208,14 @@
|
||||
</button>
|
||||
|
||||
{if $refund_allowed && !$hasCompletelyRefunded}
|
||||
<button style="display: none;" type="submit" name="initiateRefund" class="btn btn-success standard_refund_fields pull-right" id="initiateRefund">
|
||||
{if $order->hasBeenPaid()}<i class="icon-undo"></i> {l s='Initiate Refund'}{else}{l s='Cancel bookings'}{/if}
|
||||
</button>
|
||||
<div class="pull-right">
|
||||
<button style="display: none;" type="button" class="btn btn-default standard_refund_fields" id="cancelRefund">
|
||||
{l s='Cancel'}
|
||||
</button>
|
||||
<button style="display: none;" type="submit" name="initiateRefund" class="btn btn-success standard_refund_fields" id="initiateRefund">
|
||||
{if $order->hasBeenPaid()}<i class="icon-undo"></i> {l s='Initiate Refund'}{else}{l s='Submit'}{/if}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1485,6 +1585,21 @@
|
||||
{addJsDefL name=txtSomeErr}{l s='Some error occurred. Please try again.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtDeleteSucc}{l s='Deleted successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtInvalidDemandVal}{l s='Invalid demand value found' js=1}{/addJsDefL}
|
||||
{addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
|
||||
{addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
|
||||
{addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
|
||||
{addJsDefL name='rooms_txt'}{l s='Rooms' js=1}{/addJsDefL}
|
||||
{addJsDefL name='remove_txt'}{l s='Remove' js=1}{/addJsDefL}
|
||||
{addJsDefL name='adult_txt'}{l s='Adult' js=1}{/addJsDefL}
|
||||
{addJsDefL name='adults_txt'}{l s='Adults' js=1}{/addJsDefL}
|
||||
{addJsDefL name='child_txt'}{l s='Child' js=1}{/addJsDefL}
|
||||
{addJsDefL name='children_txt'}{l s='Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
|
||||
{addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
|
||||
{addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' 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'}
|
||||
{/strip}
|
||||
|
||||
{* Apply javascript for the page *}
|
||||
|
||||
@@ -24,27 +24,25 @@
|
||||
<h3 class="tab"> <i class="icon-users"></i> {l s='Occupancy'}</h3>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{l s='Set the occupancy of this room type. Enter how much adults and children this room type can accomodate.'}
|
||||
<br /><br />
|
||||
<b>{l s='Note'} : {l s='These occupancy settings will not affect "ROOM TYPE ADDITIONAL FACILITIES" any way. It will work separately.'}</b>
|
||||
{l s='Below, enter the base occupancy of this room type.'}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="base_adults">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s=''}">
|
||||
{l s='Adults'}
|
||||
{l s='Base adults'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input id="base_adults" type="text" name="base_adults" class="form-control" {if isset($roomTypeInfo)}value="{$roomTypeInfo['adult']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input id="base_adults" type="text" name="base_adults" class="form-control" {if isset($roomTypeInfo)}value="{$roomTypeInfo['adults']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="base_children">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s=''}">
|
||||
{l s='Children'}
|
||||
{l s='Base children'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
@@ -53,6 +51,46 @@
|
||||
</div>
|
||||
<input id="is_occupancy_submit" type="hidden" name="is_occupancy_submit" class="form-control" value="0">
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{l s='Below, enter the maximum of adults or children which can be accommodated in a room of this room type. Also, enter maximum number of guests for this room type.'}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="max_adults">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Enter maximum number of adults can be accommodated in a room of this room type.'}">
|
||||
{l s='Maximum adults'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input id="max_adults" type="text" name="max_adults" class="form-control" {if isset($roomTypeInfo)}value="{$roomTypeInfo['max_adults']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="max_children">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Enter maximum number of children can be accommodated in a room of this room type.'}">
|
||||
{l s='Maximum children'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input id="max_children" type="text" name="max_children" class="form-control" {if isset($roomTypeInfo)}value="{$roomTypeInfo['max_children']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="max_guests">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Enter maximum number of guests can be accommodated in a room of this room type.'}">
|
||||
{l s='Maximum room occupancy'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input id="max_guests" type="text" name="max_guests" class="form-control" {if isset($roomTypeInfo)}value="{$roomTypeInfo['max_guests']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{**
|
||||
* 2010-2023 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* 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 CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<a class="btn btn-link" href="{$link->getAdminLink('AdminCartRules')|escape:'html':'UTF-8'}&updatecart_rule&id_cart_rule={$id_cart_rule}" target="_blank">
|
||||
#{$id_cart_rule}
|
||||
</a>
|
||||
@@ -0,0 +1,24 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* 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 CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
{if $redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED}
|
||||
<span class="badge badge-danger">{l s='Redeemed'}</span>
|
||||
{else}
|
||||
<span class="badge badge-success">{l s='Active'}</span>
|
||||
{/if}
|
||||
@@ -0,0 +1,23 @@
|
||||
{**
|
||||
* 2010-2023 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* 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 CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<a href="{$status_change_link|escape:'html':'UTF-8'}" title="{l s='Change Status'}">
|
||||
<i class="icon-refresh"></i>
|
||||
{l s='Change Status'}
|
||||
</a>
|
||||
@@ -31,6 +31,6 @@
|
||||
<label class="tree-toggler">{$node['name']|escape:'html':'UTF-8'}</label>
|
||||
</span>
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -1731,6 +1731,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$order_total_discount = 0;
|
||||
$order_shipping_discount = 0;
|
||||
$advance_payment_products_discount = 0;
|
||||
if (!in_array($type, array(Cart::ONLY_SHIPPING, Cart::ONLY_PRODUCTS, Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS)) && CartRule::isFeatureActive()) {
|
||||
// First, retrieve the cart rules associated to this "getOrderTotal"
|
||||
if ($with_shipping || $type == Cart::ONLY_DISCOUNTS) {
|
||||
@@ -1787,10 +1788,28 @@ class CartCore extends ObjectModel
|
||||
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
||||
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0) {
|
||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), $compute_precision);
|
||||
|
||||
if ($type == Cart::ADVANCE_PAYMENT) {
|
||||
$advance_payment_products_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache, true), $compute_precision);
|
||||
}
|
||||
}
|
||||
}
|
||||
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), (float)$order_total_products) + (float)$order_shipping_discount;
|
||||
$order_total -= $order_total_discount;
|
||||
if ($type == Cart::ADVANCE_PAYMENT) {
|
||||
// get order total without discount
|
||||
$total_without_discount = $this->getOrderTotal() + $order_total_discount;
|
||||
// to find due amount substract advance payment without discuount from order total without discount
|
||||
// Due Amount = order total - advance payment (without discount)
|
||||
$due_amount = $total_without_discount - $order_total;
|
||||
// if discount for advance payment products is greater than due amount then only decrease the price of advance payment amount
|
||||
// otherwise discount will be applied on due amount not advance payment amount
|
||||
if ($advance_payment_products_discount > $due_amount) {
|
||||
$order_total -= ($advance_payment_products_discount - $due_amount);
|
||||
}
|
||||
$order_total -= $order_total_discount - $advance_payment_products_discount;
|
||||
} else {
|
||||
$order_total -= $order_total_discount;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == Cart::BOTH || $type == Cart::ADVANCE_PAYMENT) {
|
||||
@@ -4370,7 +4389,7 @@ class CartCore extends ObjectModel
|
||||
// lets validate the cart booking data first
|
||||
if (isset($bookingRows) && count($bookingRows)) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
$objBookingDtl = new HotelBookingDetail();
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$errors = array();
|
||||
$idCustomer = $objCart->id_customer;
|
||||
$idCurrency = $objCart->id_currency;
|
||||
@@ -4412,24 +4431,20 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
if (!count($errors)) {
|
||||
$numDays = $objBookingDtl->getNumberOfDays($dateFrom, $dateTo);
|
||||
$numDays = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
|
||||
$prodQty = $prodQty * (int) $numDays;
|
||||
$reqRooms = 1;
|
||||
|
||||
if ($hotelRoomData = $objBookingDtl->DataForFrontSearch(
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$idHotel,
|
||||
$idProduct,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
$idCart,
|
||||
$idGuest
|
||||
)) {
|
||||
$bookingParams = array(
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'hotel_id' => $idHotel,
|
||||
'id_room_type' => $idProduct,
|
||||
'only_search_data' => 1,
|
||||
'id_cart' => $idCart,
|
||||
'id_guest' => $idGuest,
|
||||
);
|
||||
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
|
||||
if (isset($hotelRoomData['stats']['num_avail'])) {
|
||||
$totalAvailRooms = $hotelRoomData['stats']['num_avail'];
|
||||
if ($totalAvailRooms < $reqRooms) {
|
||||
@@ -4470,7 +4485,7 @@ class CartCore extends ObjectModel
|
||||
if (!$hasErrors) {
|
||||
$update_quantity = $objCart->updateQty($prodQty, $idProduct, 0, 0, Tools::getValue('op', 'up'), $this->id_address_delivery);
|
||||
$chkQty = 0;
|
||||
if ($hotelAvailRomms = $hotelRoomData['rm_data'][0]['data']['available']) {
|
||||
if ($hotelAvailRomms = $hotelRoomData['rm_data'][$idProduct]['data']['available']) {
|
||||
foreach ($hotelAvailRomms as $key_hotel_room_info => $val_hotel_room_info) {
|
||||
if ($chkQty < $reqRooms) {
|
||||
$objCartBooking = new HotelCartBookingData();
|
||||
|
||||
@@ -875,9 +875,10 @@ class CartRuleCore extends ObjectModel
|
||||
* @param bool $use_tax
|
||||
* @param Context $context
|
||||
* @param bool $use_cache Allow using cache to avoid multiple free gift using multishipping
|
||||
* @param bool $only_advance_payment_products to calculate discount applied only on products that have advance payment
|
||||
* @return float|int|string
|
||||
*/
|
||||
public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true)
|
||||
public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true, $only_advance_payment_products = false)
|
||||
{
|
||||
if (!CartRule::isFeatureActive()) {
|
||||
return 0;
|
||||
@@ -890,15 +891,34 @@ class CartRuleCore extends ObjectModel
|
||||
}
|
||||
|
||||
$all_products = $context->cart->getProducts();
|
||||
$package_products = (is_null($package) ? $all_products : $package['products']);
|
||||
if (is_null($package)) {
|
||||
$package = array(
|
||||
'products' => $all_products,
|
||||
'id_carrier' => null,
|
||||
'id_address' => 0
|
||||
);
|
||||
}
|
||||
|
||||
$reduction_value = 0;
|
||||
|
||||
$cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$filter;
|
||||
foreach ($package_products as $product) {
|
||||
$objHotelAdvancePayment = new HotelAdvancedPayment();
|
||||
$cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$filter.'_'.(int)$only_advance_payment_products;
|
||||
foreach ($package['products'] as $key => $product) {
|
||||
if ($only_advance_payment_products) {
|
||||
if ($advancePaymentInfo = $objHotelAdvancePayment->getIdAdvPaymentByIdProduct($product['id_product'])) {
|
||||
if (!$advancePaymentInfo['active']) {
|
||||
unset($package['products'][$key]);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
unset($package['products'][$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$cache_id .= '_'.(int)$product['id_product'].'_'.(int)$product['id_product_attribute'].(isset($product['in_stock']) ? '_'.(int)$product['in_stock'] : '');
|
||||
}
|
||||
|
||||
$package_products = $package['products'];
|
||||
|
||||
if (Cache::isStored($cache_id)) {
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
@@ -1001,7 +1021,7 @@ class CartRuleCore extends ObjectModel
|
||||
$reduction_value += $selected_products_reduction * $this->reduction_percent / 100;
|
||||
}
|
||||
|
||||
// Discount (¤)
|
||||
// Discount (by amount)
|
||||
if ((float)$this->reduction_amount > 0) {
|
||||
$prorata = 1;
|
||||
if (!is_null($package) && count($all_products)) {
|
||||
@@ -1011,7 +1031,31 @@ class CartRuleCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
$restricted_product = null;
|
||||
$reduction_amount = $this->reduction_amount;
|
||||
// If the cart rule is restricted to one room type it can't exceed this room type price
|
||||
if ($this->reduction_product > 0) {
|
||||
foreach ($package_products as $product) {
|
||||
if ($product['id_product'] == $this->reduction_product) {
|
||||
$restricted_product = $product;
|
||||
|
||||
$prorata = 1; // do not split this cart rule
|
||||
if ($this->reduction_tax) {
|
||||
$max_reduction_amount = (int) $restricted_product['cart_quantity'] * (float) $restricted_product['price_wt'];
|
||||
} else {
|
||||
$max_reduction_amount = (int) $restricted_product['cart_quantity'] * (float) $restricted_product['price'];
|
||||
}
|
||||
$reduction_amount = min($reduction_amount, $max_reduction_amount);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($this->reduction_product > 0) && !$restricted_product) {
|
||||
$reduction_amount = 0;
|
||||
}
|
||||
|
||||
// If we need to convert the voucher value to the cart currency
|
||||
if (isset($context->currency) && $this->reduction_currency != $context->currency->id) {
|
||||
$voucherCurrency = new Currency($this->reduction_currency);
|
||||
@@ -1058,7 +1102,7 @@ class CartRuleCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
// Discount (¤) on the whole order
|
||||
// Discount (by amount) on the whole order
|
||||
elseif ($this->reduction_product == 0) {
|
||||
$cart_amount_te = null;
|
||||
$cart_amount_ti = null;
|
||||
|
||||
@@ -638,7 +638,7 @@ class HookCore extends ObjectModel
|
||||
$order = new Order((int)$id_order);
|
||||
$new_os = new OrderState((int)$new_order_status_id, $order->id_lang);
|
||||
|
||||
$return = ((int)$new_os->id == Configuration::get('PS_OS_PAYMENT')) ? Hook::exec('paymentConfirm', array('id_order' => (int)($order->id))) : true;
|
||||
$return = ((int)$new_os->id == Configuration::get('PS_OS_PAYMENT_ACCEPTED')) ? Hook::exec('paymentConfirm', array('id_order' => (int)($order->id))) : true;
|
||||
$return = Hook::exec('updateOrderStatus', array('newOrderStatus' => $new_os, 'id_order' => (int)($order->id))) && $return;
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -26,12 +26,13 @@
|
||||
|
||||
abstract class PaymentModuleCore extends Module
|
||||
{
|
||||
const DEBUG_MODE = false;
|
||||
|
||||
/** @var int Current order's id */
|
||||
public $currentOrder;
|
||||
public $currencies = true;
|
||||
public $currencies_mode = 'checkbox';
|
||||
|
||||
const DEBUG_MODE = false;
|
||||
public $payment_type = OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT;
|
||||
|
||||
public function install()
|
||||
{
|
||||
@@ -305,6 +306,7 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($this->context->customer->secure_key));
|
||||
$order->payment = $payment_method;
|
||||
$order->payment_type = $this->payment_type;
|
||||
if (isset($this->name)) {
|
||||
$order->module = $this->name;
|
||||
}
|
||||
@@ -354,6 +356,20 @@ abstract class PaymentModuleCore extends Module
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
if ($this->name == 'wsorder') {
|
||||
$order->with_occupancy = 0;
|
||||
} else {
|
||||
if (defined('_PS_ADMIN_DIR_')) {
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$order->with_occupancy = 1;
|
||||
}
|
||||
} else {
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$order->with_occupancy = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// advance payment information
|
||||
$order->is_advance_payment = $this->context->cart->is_advance_payment;
|
||||
if ($order->is_advance_payment) {
|
||||
@@ -466,7 +482,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$transaction_id = null;
|
||||
}
|
||||
|
||||
if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id, null, null, null, false)) {
|
||||
if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id, null, null, null, $this->payment_type, false)) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('Can\'t save Order Payment');
|
||||
}
|
||||
@@ -587,9 +603,11 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
|
||||
$cart_rules_list = array();
|
||||
$total_reduction_value_ti = 0;
|
||||
$total_reduction_value_tex = 0;
|
||||
foreach ($cart_rules as $cart_rule) {
|
||||
if ($cart_rule['obj']->reduction_product > 0 && !$order->orderContainProduct($cart_rule['obj']->reduction_product)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list);
|
||||
$values = array(
|
||||
'tax_incl' => $cart_rule['obj']->getContextualValue(true, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package),
|
||||
@@ -602,13 +620,25 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
|
||||
// IF
|
||||
// This is not multi-shipping
|
||||
// The value of the voucher is greater than the total of the order
|
||||
// Partial use is allowed
|
||||
// This is an "amount" reduction, not a reduction in % or a gift
|
||||
// THEN
|
||||
// The voucher is cloned with a new value corresponding to the remainder
|
||||
if (count($order_list) == 1 && $values['tax_incl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0) {
|
||||
$reduction_amount_converted = $cart_rule['obj']->reduction_amount;
|
||||
if ((int) $cart_rule['obj']->reduction_currency !== (int) $cart->id_currency) {
|
||||
$reduction_amount_converted = Tools::convertPriceFull(
|
||||
$cart_rule['obj']->reduction_amount,
|
||||
new Currency($cart_rule['obj']->reduction_currency),
|
||||
new Currency($cart->id_currency)
|
||||
);
|
||||
}
|
||||
if ($cart_rule['obj']->reduction_tax) {
|
||||
$remaining_amount = $reduction_amount_converted - $values['tax_incl'];
|
||||
} else {
|
||||
$remaining_amount = $reduction_amount_converted - $values['tax_excl'];
|
||||
}
|
||||
if ($remaining_amount > 0 && $cart_rule['obj']->partial_use == 1 && $reduction_amount_converted > 0) {
|
||||
// Create a new voucher from the original
|
||||
$voucher = new CartRule((int)$cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
|
||||
unset($voucher->id);
|
||||
@@ -620,16 +650,13 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
|
||||
// Set the new voucher value
|
||||
$voucher->reduction_amount = $remaining_amount;
|
||||
if ($voucher->reduction_tax) {
|
||||
$voucher->reduction_amount = ($total_reduction_value_ti + $values['tax_incl']) - $order->total_products_wt;
|
||||
|
||||
// Add total shipping amout only if reduction amount > total shipping
|
||||
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_incl) {
|
||||
$voucher->reduction_amount -= $order->total_shipping_tax_incl;
|
||||
}
|
||||
} else {
|
||||
$voucher->reduction_amount = ($total_reduction_value_tex + $values['tax_excl']) - $order->total_products;
|
||||
|
||||
// Add total shipping amout only if reduction amount > total shipping
|
||||
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_excl) {
|
||||
$voucher->reduction_amount -= $order->total_shipping_tax_excl;
|
||||
@@ -671,12 +698,7 @@ abstract class PaymentModuleCore extends Module
|
||||
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
$values['tax_incl'] = $order->total_products_wt - $total_reduction_value_ti;
|
||||
$values['tax_excl'] = $order->total_products - $total_reduction_value_tex;
|
||||
}
|
||||
$total_reduction_value_ti += $values['tax_incl'];
|
||||
$total_reduction_value_tex += $values['tax_excl'];
|
||||
|
||||
$order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values, 0, $cart_rule['obj']->free_shipping);
|
||||
|
||||
@@ -783,6 +805,9 @@ abstract class PaymentModuleCore extends Module
|
||||
$objBookingDetail->date_to = $objCartBookingData->date_to;
|
||||
$objBookingDetail->total_price_tax_excl = Tools::ps_round($total_price['total_price_tax_excl'], 6);
|
||||
$objBookingDetail->total_price_tax_incl = Tools::ps_round($total_price['total_price_tax_incl'], 6);
|
||||
$objBookingDetail->adults = $objCartBookingData->adults;
|
||||
$objBookingDetail->children = $objCartBookingData->children;
|
||||
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
|
||||
|
||||
// Save hotel information/location/contact
|
||||
if (Validate::isLoadedObject($objRoom = new HotelRoomInformation($objCartBookingData->id_room))) {
|
||||
@@ -805,10 +830,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$objBookingDetail->phone = $hotelAddress['phone'];
|
||||
}
|
||||
}
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($idProduct)) {
|
||||
$objBookingDetail->adult = $roomTypeInfo['adult'];
|
||||
$objBookingDetail->children = $roomTypeInfo['children'];
|
||||
}
|
||||
|
||||
/*for saving details of the advance payment product wise*/
|
||||
$objBookingDetail->total_paid_amount = Tools::ps_round($total_price['total_price_tax_incl'], 5);
|
||||
@@ -892,14 +913,6 @@ abstract class PaymentModuleCore extends Module
|
||||
// delete cart feature prices after booking creation success
|
||||
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
|
||||
|
||||
if (isset($_COOKIE['wk_id_cart'])) {
|
||||
setcookie('wk_id_cart', ' ', time() - 86400, '/');
|
||||
setcookie('wk_id_guest', ' ', time() - 86400, '/');
|
||||
|
||||
unset($_COOKIE['wk_id_cart']);
|
||||
unset($_COOKIE['wk_id_guest']);
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
@@ -1433,8 +1446,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
|
||||
$cart_htl_data[$type_key]['name'] = $product->name;
|
||||
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
|
||||
$cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
|
||||
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
|
||||
|
||||
foreach ($cart_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
@@ -1444,6 +1455,9 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl'];
|
||||
@@ -1483,6 +1497,8 @@ abstract class PaymentModuleCore extends Module
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'];
|
||||
|
||||
@@ -218,7 +218,8 @@ class PrestaShopBackupCore
|
||||
$this->id = realpath($backupfile);
|
||||
|
||||
fwrite($fp, '/* Backup for '.Tools::getHttpHost(false, false).__PS_BASE_URI__."\n * at ".date($date)."\n */\n");
|
||||
fwrite($fp, "\n".'SET NAMES \'utf8\';'."\n\n");
|
||||
fwrite($fp, "\n".'SET NAMES \'utf8\';');
|
||||
fwrite($fp, "\n".'SET SQL_MODE=\'ALLOW_INVALID_DATES\';'."\n\n");
|
||||
|
||||
// Find all tables
|
||||
$tables = Db::getInstance()->executeS('SHOW TABLES');
|
||||
|
||||
@@ -5623,7 +5623,7 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
|
||||
// save room type info adult, child, hotel info
|
||||
// save room type info adults, child, hotel info
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
@@ -5631,7 +5631,7 @@ class ProductCore extends ObjectModel
|
||||
$roomtypeData = json_decode(json_encode($xml), true);
|
||||
|
||||
// set room map info for the hotel from request
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_room_type` (`id_product`, `id_hotel`, `adult`, `children`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int) $roomtypeData['room_type']['id_hotel'].', '.(int) $roomtypeData['room_type']['adults'].', '.(int) $roomtypeData['room_type']['children'].', \''.date('Y-m-d h:i:s').'\', \''.date('Y-m-d h:i:s').'\')');
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_room_type` (`id_product`, `id_hotel`, `adults`, `children`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int) $roomtypeData['room_type']['id_hotel'].', '.(int) $roomtypeData['room_type']['adults'].', '.(int) $roomtypeData['room_type']['children'].', \''.date('Y-m-d h:i:s').'\', \''.date('Y-m-d h:i:s').'\')');
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -6060,7 +6060,7 @@ class ProductCore extends ObjectModel
|
||||
public function getWsAdults()
|
||||
{
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT `adult` FROM `'._DB_PREFIX_.'htl_room_type` WHERE `id_product` = '.(int)$this->id.' ORDER BY `id` ASC'
|
||||
'SELECT `adults` FROM `'._DB_PREFIX_.'htl_room_type` WHERE `id_product` = '.(int)$this->id.' ORDER BY `id` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3312,6 +3312,20 @@ exit;
|
||||
return preg_replace('/\\\[px]\{[a-z]{1,2}\}|(\/[a-z]*)u([a-z]*)$/i', '$1$2', $pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param int $timeout
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFresh($file, $timeout = _TIME_1_WEEK_)
|
||||
{
|
||||
if (($time = @filemtime(_PS_ROOT_DIR_.$file)) && filesize(_PS_ROOT_DIR_.$file) > 0) {
|
||||
return ((time() - $time) < $timeout);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static $is_addons_up = true;
|
||||
public static function addonsRequest($request, $params = array())
|
||||
{
|
||||
@@ -3421,6 +3435,20 @@ exit;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file_to_refresh
|
||||
* @param string $external_file
|
||||
* @return bool
|
||||
*/
|
||||
public static function refresh($file_to_refresh, $external_file)
|
||||
{
|
||||
if (self::$is_addons_up && $content = Tools::file_get_contents($external_file)) {
|
||||
return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content);
|
||||
}
|
||||
self::$is_addons_up = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing information about
|
||||
* HTTP file upload variable ($_FILES)
|
||||
|
||||
@@ -126,7 +126,7 @@ class TranslateCore
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
public static function getModuleTranslation($module, $string, $source, $sprintf = null, $js = false)
|
||||
public static function getModuleTranslation($module, $string, $source, $sprintf = null, $js = false, $language = null)
|
||||
{
|
||||
global $_MODULES, $_MODULE, $_LANGADM;
|
||||
|
||||
@@ -135,11 +135,18 @@ class TranslateCore
|
||||
// $translations_merged is a cache of wether a specific module's translations have already been added to $_MODULES
|
||||
static $translations_merged = array();
|
||||
|
||||
// inialize $force_refresh as false and use only when $lang is provided to load new language translations
|
||||
$force_refresh = false;
|
||||
|
||||
$name = $module instanceof Module ? $module->name : $module;
|
||||
|
||||
$language = Context::getContext()->language;
|
||||
if (!($language !== null && Validate::isLoadedObject($language))) {
|
||||
$language = Context::getContext()->language;
|
||||
} else {
|
||||
$force_refresh = true;
|
||||
}
|
||||
|
||||
if (!isset($translations_merged[$name]) && isset(Context::getContext()->language)) {
|
||||
if ((!isset($translations_merged[$name]) && isset(Context::getContext()->language)) || $force_refresh) {
|
||||
$files_by_priority = array(
|
||||
// Translations in theme
|
||||
_PS_THEME_DIR_.'modules/'.$name.'/translations/'.$language->iso_code.'.php',
|
||||
@@ -149,10 +156,14 @@ class TranslateCore
|
||||
// PrestaShop 1.4 translations
|
||||
_PS_MODULE_DIR_.$name.'/'.$language->iso_code.'.php'
|
||||
);
|
||||
// if force_refresh is set reverse the list because array_merge will overrite the previous file with new file
|
||||
if ($force_refresh) {
|
||||
$files_by_priority = array_reverse($files_by_priority);
|
||||
}
|
||||
foreach ($files_by_priority as $file) {
|
||||
if (file_exists($file)) {
|
||||
include_once($file);
|
||||
$_MODULES = !empty($_MODULES) ? $_MODULES + $_MODULE : $_MODULE; //we use "+" instead of array_merge() because array merge erase existing values.
|
||||
$_MODULES = !empty($_MODULES) ? ($force_refresh ? array_merge($_MODULES, $_MODULE) : $_MODULES + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values.
|
||||
$translations_merged[$name] = true;
|
||||
}
|
||||
}
|
||||
@@ -220,11 +231,15 @@ class TranslateCore
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function getPdfTranslation($string, $sprintf = null)
|
||||
public static function getPdfTranslation($string, $sprintf = null, $language = null)
|
||||
{
|
||||
global $_LANGPDF;
|
||||
|
||||
$iso = Context::getContext()->language->iso_code;
|
||||
if (!($language !== null && Validate::isLoadedObject($language))) {
|
||||
$iso = Context::getContext()->language->iso_code;
|
||||
} else {
|
||||
$iso = $language->iso_code;
|
||||
}
|
||||
|
||||
if (!Validate::isLangIsoCode($iso)) {
|
||||
Tools::displayError(sprintf('Invalid iso lang (%s)', Tools::safeOutput($iso)));
|
||||
|
||||
@@ -2147,7 +2147,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$tab_modules_list = $this->filterTabModuleList($tab_modules_list);
|
||||
|
||||
if ((is_array($tab_modules_list['slider_list']) && count($tab_modules_list['slider_list']))
|
||||
if (!empty($tab_modules_list) && (is_array($tab_modules_list['slider_list']) && count($tab_modules_list['slider_list']))
|
||||
|| !Tab::isTabModuleListAvailable()
|
||||
) {
|
||||
$this->page_header_toolbar_btn['modules-list'] = array(
|
||||
@@ -2214,36 +2214,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function ajaxProcessRefreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, _TIME_1_WEEK_)) {
|
||||
if ($this->refresh(Module::CACHE_FILE_TAB_MODULES_LIST, _QLO_TAB_MODULE_LIST_URL_)) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
Module::generateTrustedXml();
|
||||
$this->status = Module::refreshModuleList($force_reload_cache);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2451,8 +2422,6 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$helper = new HelperList();
|
||||
|
||||
unset($this->toolbar_btn);
|
||||
$this->initToolbar();
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper').'<br />'.htmlspecialchars($this->_list_error));
|
||||
@@ -2837,7 +2806,7 @@ class AdminControllerCore extends Controller
|
||||
));
|
||||
|
||||
// get upgrade available info
|
||||
if (!$this->isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE, Tools::addonsRequest('check-version'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE)) {
|
||||
@@ -4077,28 +4046,24 @@ class AdminControllerCore extends Controller
|
||||
* @param string $file
|
||||
* @param int $timeout
|
||||
* @return bool
|
||||
* @deprecated Deprecated 1.6.0.0 Use Tools::isFresh instead
|
||||
*/
|
||||
public function isFresh($file, $timeout = _TIME_1_WEEK_)
|
||||
{
|
||||
if (($time = @filemtime(_PS_ROOT_DIR_.$file)) && filesize(_PS_ROOT_DIR_.$file) > 0) {
|
||||
return ((time() - $time) < $timeout);
|
||||
}
|
||||
|
||||
return false;
|
||||
Tools::displayAsDeprecated();
|
||||
return Tools::isFresh($file, $timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file_to_refresh
|
||||
* @param string $external_file
|
||||
* @return bool
|
||||
* @deprecated Deprecated 1.6.0.0 Use Tools::refresh instead
|
||||
*/
|
||||
public function refresh($file_to_refresh, $external_file)
|
||||
{
|
||||
if (self::$is_qloapps_up && $content = Tools::file_get_contents($external_file)) {
|
||||
return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content);
|
||||
}
|
||||
self::$is_qloapps_up = false;
|
||||
return false;
|
||||
Tools::displayAsDeprecated();
|
||||
return Tools::refresh($file_to_refresh, $external_file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -435,6 +435,15 @@ class FrontControllerCore extends Controller
|
||||
$compared_products = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
|
||||
}
|
||||
|
||||
$isOccupancyWiseSearch = false;
|
||||
if (Configuration::get('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
|
||||
$isOccupancyWiseSearch = true;
|
||||
}
|
||||
|
||||
$occupancyRequiredForBooking = false;
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
// Useful for layout.tpl
|
||||
'mobile_device' => $this->context->getMobileDevice(),
|
||||
@@ -482,6 +491,10 @@ class FrontControllerCore extends Controller
|
||||
'currencySign' => $currency->sign, // backward compat, see global.tpl
|
||||
'currencyFormat' => $currency->format, // backward compat
|
||||
'currencyBlank' => $currency->blank, // backward compat
|
||||
'is_occupancy_wise_search' => $isOccupancyWiseSearch,
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
));
|
||||
|
||||
// Add the tpl files directory for mobile
|
||||
@@ -1059,6 +1072,12 @@ class FrontControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$this->addJS(_PS_JS_DIR_.'daterangepicker/moment.min.js');
|
||||
$this->addjqueryPlugin('daterangepicker.min', _PS_JS_DIR_.'daterangepicker/');
|
||||
$this->addJS(_PS_JS_DIR_.'daterangepicker/qlodaterangepicker.js');
|
||||
|
||||
$this->addCSS(_THEME_CSS_DIR_.'daterangepicker.css');
|
||||
|
||||
if (Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee'))) {
|
||||
$this->addJqueryUI('ui.sortable');
|
||||
$this->addjqueryPlugin('fancybox');
|
||||
|
||||
@@ -1606,6 +1606,7 @@ abstract class ModuleCore
|
||||
array('type' => 'addonsMustHave', 'file' => _PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsNative', 'file' => _PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
);
|
||||
$modulesOnDisk = Module::getModulesDirOnDisk();
|
||||
$module_list = array();
|
||||
foreach ($files_list as $f) {
|
||||
$file = $f['file'];
|
||||
@@ -1642,18 +1643,21 @@ abstract class ModuleCore
|
||||
$item->url = isset($modaddons->url) ? $modaddons->url : null;
|
||||
$item->is_native = false;
|
||||
|
||||
if (isset($modaddons->img)) {
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg', Tools::file_get_contents($modaddons->img))) {
|
||||
copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg');
|
||||
if (!in_array($modaddons->name, $modulesOnDisk)) {
|
||||
if (isset($modaddons->img)) {
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg', Tools::file_get_contents($modaddons->img))) {
|
||||
copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
$item->image = '../img/tmp/'.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
$item->image = '../img/tmp/'.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($item->type == 'addonsMustHave') {
|
||||
$item->addons_buy_url = strip_tags((string)$modaddons->url);
|
||||
$prices = (array)$modaddons->price;
|
||||
@@ -1759,6 +1763,42 @@ abstract class ModuleCore
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public static function refreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
$status = false;
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'))) {
|
||||
$status = 'refresh';
|
||||
} else {
|
||||
$status = 'error';
|
||||
}
|
||||
} else {
|
||||
$status = 'cache';
|
||||
}
|
||||
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'))) {
|
||||
$status = 'refresh';
|
||||
} else {
|
||||
$status = 'error';
|
||||
}
|
||||
} else {
|
||||
$status = 'cache';
|
||||
}
|
||||
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, _TIME_1_WEEK_)) {
|
||||
if (Tools::refresh(Module::CACHE_FILE_TAB_MODULES_LIST, _QLO_TAB_MODULE_LIST_URL_)) {
|
||||
$status = 'refresh';
|
||||
} else {
|
||||
$status = 'error';
|
||||
}
|
||||
} else {
|
||||
$status = 'cache';
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the module is provided by addons.prestashop.com or not
|
||||
*
|
||||
@@ -1841,6 +1881,9 @@ abstract class ModuleCore
|
||||
$trusted = array();
|
||||
$untrusted = array();
|
||||
|
||||
// before generating list first check if file exists and are updated
|
||||
Module::refreshModuleList();
|
||||
|
||||
$trusted_modules_xml = array(
|
||||
// _PS_ROOT_DIR_.self::CACHE_FILE_ALL_COUNTRY_MODULES_LIST,
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST,
|
||||
|
||||
@@ -71,6 +71,9 @@ class OrderCore extends ObjectModel
|
||||
/** @var string Payment method */
|
||||
public $payment;
|
||||
|
||||
/** @var string Payment type */
|
||||
public $payment_type;
|
||||
|
||||
/** @var string Payment module */
|
||||
public $module;
|
||||
|
||||
@@ -190,6 +193,11 @@ class OrderCore extends ObjectModel
|
||||
*/
|
||||
public $advance_paid_amount;
|
||||
|
||||
/**
|
||||
* @var int is occupancy provided in this order
|
||||
*/
|
||||
public $with_occupancy;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -210,6 +218,7 @@ class OrderCore extends ObjectModel
|
||||
'current_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'secure_key' => array('type' => self::TYPE_STRING, 'validate' => 'isMd5'),
|
||||
'payment' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'payment_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'module' => array('type' => self::TYPE_STRING, 'validate' => 'isModuleName', 'required' => true),
|
||||
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
@@ -242,8 +251,9 @@ class OrderCore extends ObjectModel
|
||||
'source' => array('type' => self::TYPE_STRING),
|
||||
'valid' => array('type' => self::TYPE_BOOL),
|
||||
'reference' => array('type' => self::TYPE_STRING),
|
||||
'is_advance_payment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
|
||||
'advance_paid_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'is_advance_payment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
|
||||
'advance_paid_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'with_occupancy' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
@@ -296,7 +306,6 @@ class OrderCore extends ObjectModel
|
||||
'mobile_theme',
|
||||
'round_mode',
|
||||
'round_type',
|
||||
'reference',
|
||||
),
|
||||
'associations' => array(
|
||||
'bookings' => array(
|
||||
@@ -890,7 +899,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function isInPreparation()
|
||||
{
|
||||
return count($this->getHistory((int)$this->id_lang, Configuration::get('PS_OS_PREPARATION')));
|
||||
return count($this->getHistory((int)$this->id_lang, Configuration::get('PS_OS_PROCESSING')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1618,7 +1627,7 @@ class OrderCore extends ObjectModel
|
||||
$extraVars['transaction_id'] = $this->transaction_id;
|
||||
|
||||
if ($this->total_paid_real > 0) {
|
||||
$orderStatus = Configuration::get('PS_OS_WS_PAYMENT');
|
||||
$orderStatus = Configuration::get('PS_OS_REMOTE_PAYMENT_ACCEPTED');
|
||||
} else {
|
||||
$orderStatus = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
|
||||
}
|
||||
@@ -1766,7 +1775,7 @@ class OrderCore extends ObjectModel
|
||||
* @param bool $update_payment_detail :: if false, be sure to add payment detail in payment detail table
|
||||
* @return bool
|
||||
*/
|
||||
public function addOrderPayment($amount_paid, $payment_method = null, $payment_transaction_id = null, $currency = null, $date = null, $order_invoice = null, $update_payment_detail = true)
|
||||
public function addOrderPayment($amount_paid, $payment_method = null, $payment_transaction_id = null, $currency = null, $date = null, $order_invoice = null, $payment_type = null, $update_payment_detail = true)
|
||||
{
|
||||
$order_payment = new OrderPayment();
|
||||
$order_payment->order_reference = $this->reference;
|
||||
@@ -1775,6 +1784,7 @@ class OrderCore extends ObjectModel
|
||||
$order_payment->conversion_rate = ($currency ? $currency->conversion_rate : 1);
|
||||
// if payment_method is define, we used this
|
||||
$order_payment->payment_method = ($payment_method ? $payment_method : $this->payment);
|
||||
$order_payment->payment_type = ($payment_type ? $payment_type : $this->payment_type);
|
||||
$order_payment->transaction_id = $payment_transaction_id;
|
||||
$order_payment->amount = $amount_paid;
|
||||
$order_payment->date_add = ($date ? $date : null);
|
||||
|
||||
@@ -97,7 +97,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
$old_os = $order->getCurrentOrderState();
|
||||
|
||||
// executes hook
|
||||
if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_WS_PAYMENT')))) {
|
||||
if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT_ACCEPTED'), Configuration::get('PS_OS_WS_PAYMENT')))) {
|
||||
Hook::exec('actionPaymentConfirmation', array('id_order' => (int)$order->id), null, false, true, false, $order->id_shop);
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
public function sendEmail($order, $template_vars = false)
|
||||
{
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`
|
||||
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, o.`module` as `module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON oh.`id_order` = o.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON o.`id_customer` = c.`id_customer`
|
||||
@@ -419,13 +419,26 @@ class OrderHistoryCore extends ObjectModel
|
||||
'{lastname}' => $result['lastname'],
|
||||
'{firstname}' => $result['firstname'],
|
||||
'{id_order}' => (int)$this->id_order,
|
||||
'{order_name}' => $order->getUniqReference()
|
||||
'{order_name}' => $order->getUniqReference(),
|
||||
'{extra_mail_content_html}' => '',
|
||||
'{extra_mail_content_txt}' => '',
|
||||
'{payment_method}' => '',
|
||||
);
|
||||
|
||||
if ($result['module_name']) {
|
||||
$module = Module::getInstanceByName($result['module_name']);
|
||||
if (Validate::isLoadedObject($module) && isset($module->extra_mail_vars) && is_array($module->extra_mail_vars)) {
|
||||
$data = array_merge($data, $module->extra_mail_vars);
|
||||
if (Validate::isLoadedObject($module = Module::getInstanceByName($result['module_name']))) {
|
||||
$data['{payment_method}'] = $module->displayName;
|
||||
// if any modle need to send extra content in mail, that module need to implement this function
|
||||
// this function should return an array with content for both html and txt mail template
|
||||
// return array('{extra_mail_content_html}' => '', '{extra_mail_content_txt}' => '')
|
||||
if (method_exists($module, 'getExtraMailContent')) {
|
||||
if (is_array($extra_mail_content = $module->getExtraMailContent(
|
||||
$result['id_order_state'],
|
||||
$order
|
||||
))) {
|
||||
$data = array_merge($data, $extra_mail_content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,15 @@
|
||||
|
||||
class OrderPaymentCore extends ObjectModel
|
||||
{
|
||||
const PAYMENT_TYPE_ONLINE = 1;
|
||||
const PAYMENT_TYPE_PAY_AT_HOTEL = 2;
|
||||
const PAYMENT_TYPE_REMOTE_PAYMENT = 3;
|
||||
|
||||
public $order_reference;
|
||||
public $id_currency;
|
||||
public $amount;
|
||||
public $payment_method;
|
||||
public $payment_type;
|
||||
public $conversion_rate;
|
||||
public $transaction_id;
|
||||
public $card_number;
|
||||
@@ -49,6 +54,7 @@ class OrderPaymentCore extends ObjectModel
|
||||
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
|
||||
'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'payment_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'transaction_id' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
'card_number' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
class OrderReturnCore extends ObjectModel
|
||||
{
|
||||
/** @var int */
|
||||
public $id_order_return;
|
||||
|
||||
/** @var int */
|
||||
public $id_customer;
|
||||
|
||||
@@ -48,12 +51,22 @@ class OrderReturnCore extends ObjectModel
|
||||
/** @var int if request raised by the admin */
|
||||
public $by_admin;
|
||||
|
||||
/** @var int id_cart_rule or id_order_slip */
|
||||
public $id_return_type;
|
||||
|
||||
/** @var int whether $id_return_type is cart_rule or order_slip */
|
||||
public $return_type;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
|
||||
/** possible values for $return_type */
|
||||
const RETURN_TYPE_CART_RULE = 1;
|
||||
const RETURN_TYPE_ORDER_SLIP = 2;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -69,6 +82,8 @@ class OrderReturnCore extends ObjectModel
|
||||
'refunded_amount' => array('type' => self::TYPE_FLOAT),
|
||||
'state' => array('type' => self::TYPE_INT),
|
||||
'by_admin' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_return_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'return_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
@@ -232,14 +247,16 @@ class OrderReturnCore extends ObjectModel
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
$data = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return`
|
||||
WHERE `id_customer` = '.(int)$customer_id.
|
||||
($only_customer ? ' AND `by_admin` = 0' : '').
|
||||
($order_id ? ' AND `id_order` = '.(int)$order_id : '').
|
||||
($no_denied ? ' AND `state` != 4' : '').'
|
||||
ORDER BY `date_add` DESC');
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return` orr
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_slip` ors
|
||||
ON (ors.`id_order_slip` = orr.`id_return_type` AND orr.`return_type` = '.(int) self::RETURN_TYPE_ORDER_SLIP.')
|
||||
WHERE orr.`id_customer` = '.(int)$customer_id.
|
||||
($only_customer ? ' AND orr.`by_admin` = 0' : '').
|
||||
($order_id ? ' AND orr.`id_order` = '.(int)$order_id : '').
|
||||
($no_denied ? ' AND orr.`state` != 4' : '').'
|
||||
ORDER BY orr.`date_add` DESC';
|
||||
$data = Db::getInstance()->executeS($sql);
|
||||
foreach ($data as $k => $or) {
|
||||
$state = new OrderReturnState($or['state']);
|
||||
$data[$k]['state_name'] = $state->name[$context->language->id];
|
||||
@@ -373,144 +390,112 @@ class OrderReturnCore extends ObjectModel
|
||||
/**
|
||||
* Sets the new order return state
|
||||
* @param int $newOrderReturnState
|
||||
* @param int/object $idOrderReturn
|
||||
*/
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idOrderReturn, $idLang = 0)
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idLang = 0)
|
||||
{
|
||||
if (Validate::isLoadedObject($objOrderReturn = new OrderReturn((int)$idOrderReturn))) {
|
||||
$objOrder = new Order($objOrderReturn->id_order);
|
||||
$objOrder = new Order($this->id_order);
|
||||
if (!$idLang) {
|
||||
$idLang = $objOrder->id_lang;
|
||||
}
|
||||
if (Validate::isLoadedObject(
|
||||
$objOrderReturnState = new OrderReturnState((int)$newOrderReturnState, $idLang)
|
||||
)) {
|
||||
if ($this->state != $newOrderReturnState) {
|
||||
$this->state = $newOrderReturnState;
|
||||
$this->save();
|
||||
|
||||
if (!$idLang) {
|
||||
$idLang = $objOrder->id_lang;
|
||||
}
|
||||
if (Validate::isLoadedObject(
|
||||
$objOrderReturnState = new OrderReturnState((int)$newOrderReturnState, $idLang)
|
||||
)) {
|
||||
if ($objOrderReturn->state != $newOrderReturnState) {
|
||||
$objOrderReturn->state = $newOrderReturnState;
|
||||
$objOrderReturn->save();
|
||||
if ($objOrderReturnState->send_email_to_customer
|
||||
|| $objOrderReturnState->send_email_to_superadmin
|
||||
|| $objOrderReturnState->send_email_to_employee
|
||||
|| $objOrderReturnState->send_email_to_hotelier
|
||||
) {
|
||||
// Lets create data for the email templates
|
||||
$objMail = new Mail();
|
||||
$idHotel = 0;
|
||||
|
||||
if ($objOrderReturnState->send_email_to_customer
|
||||
|| $objOrderReturnState->send_email_to_superadmin
|
||||
|| $objOrderReturnState->send_email_to_employee
|
||||
|| $objOrderReturnState->send_email_to_hotelier
|
||||
) {
|
||||
// Lets create data for the email templates
|
||||
$objMail = new Mail();
|
||||
$idHotel = 0;
|
||||
$data = array (
|
||||
'{status_name}' => $objOrderReturnState->name,
|
||||
'{status_color}' => $objOrderReturnState->color,
|
||||
'{order_reference}' => $objOrder->reference,
|
||||
'{order_date}' => date('Y-m-d h:i:s', strtotime($objOrder->date_add)),
|
||||
'{refunded_amount}' => Tools::displayPrice($this->refunded_amount, new Currency($objOrder->id_currency)),
|
||||
'{payment_mode}' => $this->payment_mode,
|
||||
'{id_transaction}' => $this->id_transaction,
|
||||
);
|
||||
|
||||
$data = array (
|
||||
'{status_name}' => $objOrderReturnState->name,
|
||||
'{status_color}' => $objOrderReturnState->color,
|
||||
'{order_reference}' => $objOrder->reference,
|
||||
'{order_date}' => date('Y-m-d h:i:s', strtotime($objOrder->date_add)),
|
||||
'{refunded_amount}' => Tools::displayPrice($objOrderReturn->refunded_amount, new Currency($objOrder->id_currency)),
|
||||
'{payment_mode}' => $objOrderReturn->payment_mode,
|
||||
'{id_transaction}' => $objOrderReturn->id_transaction,
|
||||
);
|
||||
|
||||
// if mail is true for the customer then send mail to customer with selected template
|
||||
$objCustomer = new Customer($objOrderReturn->id_customer);
|
||||
if ($objOrderReturnState->send_email_to_customer && $objOrderReturnState->customer_template) {
|
||||
if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings(
|
||||
$objOrderReturn->id_order,
|
||||
$objOrderReturn->id,
|
||||
0,
|
||||
1
|
||||
)) {
|
||||
$idHotel = reset($refundReqBookings)['id_hotel'];
|
||||
}
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
// send customer information
|
||||
$link = new Link();
|
||||
$data['{refund_reqests_url}'] = $link->getPageLink('order-follow');
|
||||
$data['{firstname}'] = $objCustomer->firstname;
|
||||
$data['{lastname}'] = $objCustomer->lastname;
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->customer_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
// if mail is true for the customer then send mail to customer with selected template
|
||||
$objCustomer = new Customer($this->id_customer);
|
||||
if ($objOrderReturnState->send_email_to_customer && $objOrderReturnState->customer_template) {
|
||||
if ($refundReqBookings = $this->getOrderRefundRequestedBookings(
|
||||
$this->id_order,
|
||||
$this->id,
|
||||
0,
|
||||
1
|
||||
)) {
|
||||
$idHotel = reset($refundReqBookings)['id_hotel'];
|
||||
}
|
||||
|
||||
if ($objOrderReturnState->admin_template) {
|
||||
if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings(
|
||||
$objOrderReturn->id_order,
|
||||
$objOrderReturn->id
|
||||
)) {
|
||||
$idHotel = $refundReqBookings[0]['id_hotel'];
|
||||
}
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
$data['{cancelation_reason}'] = $objOrderReturn->question;
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
// send customer information
|
||||
$link = new Link();
|
||||
$data['{refund_reqests_url}'] = $link->getPageLink('order-follow');
|
||||
$data['{firstname}'] = $objCustomer->firstname;
|
||||
$data['{lastname}'] = $objCustomer->lastname;
|
||||
|
||||
// send mail to the super admin
|
||||
if ($objOrderReturnState->send_email_to_superadmin) {
|
||||
// send superadmin information
|
||||
if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) {
|
||||
if (Validate::isEmail($superAdmin->email)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = $superAdmin->firstname;
|
||||
$data['{lastname}'] = $superAdmin->lastname;
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->customer_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$superAdmin->email,
|
||||
$superAdmin->firstname.' '.$superAdmin->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotel
|
||||
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
|
||||
) {
|
||||
// send mail to the hotelier
|
||||
if ($objOrderReturnState->send_email_to_hotelier) {
|
||||
if ($objOrderReturnState->admin_template) {
|
||||
if ($refundReqBookings = $this->getOrderRefundRequestedBookings(
|
||||
$this->id_order,
|
||||
$this->id
|
||||
)) {
|
||||
$idHotel = $refundReqBookings[0]['id_hotel'];
|
||||
}
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$data['{cancelation_reason}'] = $this->question;
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
// send mail to the super admin
|
||||
if ($objOrderReturnState->send_email_to_superadmin) {
|
||||
// send superadmin information
|
||||
if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) {
|
||||
if (Validate::isEmail($superAdmin->email)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = '';
|
||||
$data['{lastname}'] = '';
|
||||
$data['{email}'] = $objHotel->email;
|
||||
$data['{firstname}'] = $superAdmin->firstname;
|
||||
$data['{lastname}'] = $superAdmin->lastname;
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objHotel->email,
|
||||
null,
|
||||
$superAdmin->email,
|
||||
$superAdmin->firstname.' '.$superAdmin->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
@@ -520,38 +505,66 @@ class OrderReturnCore extends ObjectModel
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotel
|
||||
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
|
||||
) {
|
||||
// send mail to the hotelier
|
||||
if ($objOrderReturnState->send_email_to_hotelier) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = '';
|
||||
$data['{lastname}'] = '';
|
||||
$data['{email}'] = $objHotel->email;
|
||||
|
||||
// send mail to the employee
|
||||
if ($objOrderReturnState->send_email_to_employee) {
|
||||
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
foreach ($htlAccesses as $access) {
|
||||
if ($access['id_profile'] != _PS_ADMIN_PROFILE_) {
|
||||
if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) {
|
||||
foreach ($htlEmployees as $empl) {
|
||||
if (Validate::isEmail($empl['email'])) {
|
||||
// send hotel manager (employee) have permission for this hotel
|
||||
$data['{firstname}'] = $empl['firstname'];
|
||||
$data['{lastname}'] = $empl['lastname'];
|
||||
$data['{email}'] = $empl['email'];
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objHotel->email,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$empl['email'],
|
||||
$empl['firstname'].' '.$empl['lastname'],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
// send mail to the employee
|
||||
if ($objOrderReturnState->send_email_to_employee) {
|
||||
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
foreach ($htlAccesses as $access) {
|
||||
if ($access['id_profile'] != _PS_ADMIN_PROFILE_) {
|
||||
if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) {
|
||||
foreach ($htlEmployees as $empl) {
|
||||
if (Validate::isEmail($empl['email'])) {
|
||||
// send hotel manager (employee) have permission for this hotel
|
||||
$data['{firstname}'] = $empl['firstname'];
|
||||
$data['{lastname}'] = $empl['lastname'];
|
||||
$data['{email}'] = $empl['email'];
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$empl['email'],
|
||||
$empl['firstname'].' '.$empl['lastname'],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -561,18 +574,21 @@ class OrderReturnCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// executes hook
|
||||
Hook::exec(
|
||||
'actionOrderReFundStatusPostUpdate',
|
||||
array(
|
||||
'new_order_return_status' => $newOrderReturnState,
|
||||
'id_order_return' => (int)$idOrderReturn
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// executes hook
|
||||
Hook::exec(
|
||||
'actionOrderReFundStatusPostUpdate',
|
||||
array(
|
||||
'new_order_return_status' => $newOrderReturnState,
|
||||
'id_order_return' => (int) $this->id_order_return,
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class OrderSlipCore extends ObjectModel
|
||||
{
|
||||
/** @var int */
|
||||
public $id;
|
||||
public $id_order_slip;
|
||||
|
||||
/** @var int */
|
||||
public $id_customer;
|
||||
@@ -62,6 +62,12 @@ class OrderSlipCore extends ObjectModel
|
||||
/** @var int */
|
||||
public $partial;
|
||||
|
||||
/** @var int */
|
||||
public $redeem_status = self::REDEEM_STATUS_ACTIVE;
|
||||
|
||||
/** @var int */
|
||||
public $id_cart_rule;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
@@ -71,6 +77,9 @@ class OrderSlipCore extends ObjectModel
|
||||
/** @var int */
|
||||
public $order_slip_type = 0;
|
||||
|
||||
const REDEEM_STATUS_ACTIVE = 1;
|
||||
const REDEEM_STATUS_REDEEMED = 2;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -90,6 +99,8 @@ class OrderSlipCore extends ObjectModel
|
||||
'shipping_cost_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'partial' => array('type' => self::TYPE_INT),
|
||||
'redeem_status' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'order_slip_type' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
@@ -336,6 +347,7 @@ class OrderSlipCore extends ObjectModel
|
||||
$order_slip->{'total_products_tax_'.$inc_or_ex_1} = 0;
|
||||
$order_slip->{'total_products_tax_'.$inc_or_ex_2} = 0;
|
||||
|
||||
$total_products = array();
|
||||
foreach ($booking_list as &$booking) {
|
||||
$objHtlBooking = new HotelBookingDetail($booking['id_htl_booking']);
|
||||
$order_detail = new OrderDetail((int)$objHtlBooking->id_order_detail);
|
||||
@@ -543,6 +555,95 @@ class OrderSlipCore extends ObjectModel
|
||||
return $ecotax_detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate voucher and return id of the created rule if successful, false otherwise
|
||||
*/
|
||||
public function generateVoucher($sendMail = true)
|
||||
{
|
||||
if (!Validate::isLoadedObject($this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->redeem_status != self::REDEEM_STATUS_ACTIVE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$objOrder = new Order($this->id_order);
|
||||
if (!Validate::isLoadedObject($objOrder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$objCustomer = new Customer($this->id_customer);
|
||||
if (!Validate::isLoadedObject($objCustomer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$context = Context::getContext();
|
||||
$objCartRule = new CartRule();
|
||||
$languages = Language::getLanguages();
|
||||
|
||||
$creditSlipPrefix = Configuration::get('PS_CREDIT_SLIP_PREFIX', $context->language->id);
|
||||
$creditSlipID = sprintf(('%1$s%2$06d'), $creditSlipPrefix, (int) $this->id_order_slip);
|
||||
|
||||
$dateFrom = $this->date_add;
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateFrom) + (3600 * 24 * 365.25)); /* 1 year */
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$objCartRule->name[$language['id_lang']] = sprintf('Voucher for credit slip #%s', $creditSlipID);
|
||||
}
|
||||
|
||||
$objCartRule->description = sprintf('Order: #%s', $objOrder->id);
|
||||
$objCartRule->code = 'CS'.(int) ($this->id_order_slip).'C'.(int) ($objCustomer->id).'O'.(int) ($objOrder->id);
|
||||
$objCartRule->quantity = 1;
|
||||
$objCartRule->quantity_per_user = 1;
|
||||
$objCartRule->id_customer = $objCustomer->id;
|
||||
$objCartRule->date_from = $dateFrom;
|
||||
$objCartRule->date_to = $dateTo;
|
||||
$objCartRule->highlight = 1;
|
||||
$objCartRule->active = 1;
|
||||
$objCartRule->reduction_amount = $this->amount;
|
||||
$objCartRule->reduction_tax = true;
|
||||
$objCartRule->minimum_amount_currency = $objOrder->id_currency;
|
||||
$objCartRule->reduction_currency = $objOrder->id_currency;
|
||||
|
||||
if (!$objCartRule->save()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->redeem_status = self::REDEEM_STATUS_REDEEMED;
|
||||
$this->id_cart_rule = (int) $objCartRule->id;
|
||||
$this->save();
|
||||
|
||||
if ($sendMail) {
|
||||
$objCartRule = new CartRule($this->id_cart_rule);
|
||||
$objCustomer = new Customer($objCartRule->id_customer);
|
||||
|
||||
$objCurrency = new Currency($objCartRule->reduction_currency, $context->language->id);
|
||||
$mailVars['{firstname}'] = $objCustomer->firstname;
|
||||
$mailVars['{lastname}'] = $objCustomer->lastname;
|
||||
$mailVars['{credit_slip_id}'] = $creditSlipID;
|
||||
$mailVars['{voucher_code}'] = $objCartRule->code;
|
||||
$mailVars['{voucher_amount}'] = Tools::displayPrice($objCartRule->reduction_amount, $objCurrency, false);
|
||||
|
||||
Mail::Send(
|
||||
$context->language->id,
|
||||
'credit_slip_voucher',
|
||||
sprintf(Mail::l('New voucher for your credit slip #%s', $context->language->id), $creditSlipID),
|
||||
$mailVars,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
return $this->id_cart_rule;
|
||||
}
|
||||
|
||||
public function getWsOrderSlipDetails()
|
||||
{
|
||||
$query = 'SELECT id_order_slip as id, id_order_detail, product_quantity, amount_tax_excl, amount_tax_incl
|
||||
|
||||
@@ -352,8 +352,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
|
||||
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
|
||||
$cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
|
||||
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
|
||||
$cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name'];
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
@@ -400,6 +398,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
|
||||
|
||||
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
|
||||
|
||||
@@ -446,6 +446,9 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
|
||||
@@ -385,8 +385,6 @@ class WebserviceOutputBuilderCore
|
||||
} else {
|
||||
$output .= $this->renderEntity($object, $depth);
|
||||
}
|
||||
} elseif ($key == 'empty' && $this->objectRender->getContentType() == 'application/json') {
|
||||
$output .= $this->renderEntity($object, $depth);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -240,21 +240,14 @@ $context->link = new Link($https_link, $https_link);
|
||||
* USE : Configuration::get() method in order to getting the id of order status
|
||||
*/
|
||||
|
||||
define('_PS_OS_CHEQUE_', Configuration::get('PS_OS_CHEQUE'));
|
||||
define('_PS_OS_PAYMENT_', Configuration::get('PS_OS_PAYMENT'));
|
||||
define('_PS_OS_PREPARATION_', Configuration::get('PS_OS_PREPARATION'));
|
||||
define('_PS_OS_SHIPPING_', Configuration::get('PS_OS_SHIPPING'));
|
||||
define('_PS_OS_DELIVERED_', Configuration::get('PS_OS_DELIVERED'));
|
||||
define('_PS_OS_AWAITING_PAYMENT_', Configuration::get('PS_OS_AWAITING_PAYMENT'));
|
||||
define('_PS_OS_PAYMENT_ACCEPTED_', Configuration::get('PS_OS_PAYMENT_ACCEPTED'));
|
||||
define('_PS_OS_PROCESSING_', Configuration::get('PS_OS_PROCESSING'));
|
||||
define('_PS_OS_CANCELED_', Configuration::get('PS_OS_CANCELED'));
|
||||
define('_PS_OS_REFUND_', Configuration::get('PS_OS_REFUND'));
|
||||
define('_PS_OS_ERROR_', Configuration::get('PS_OS_ERROR'));
|
||||
define('_PS_OS_OUTOFSTOCK_', Configuration::get('PS_OS_OUTOFSTOCK'));
|
||||
define('_PS_OS_OUTOFSTOCK_PAID_', Configuration::get('PS_OS_OUTOFSTOCK_PAID'));
|
||||
define('_PS_OS_OUTOFSTOCK_UNPAID_', Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'));
|
||||
define('_PS_OS_BANKWIRE_', Configuration::get('PS_OS_BANKWIRE'));
|
||||
define('_PS_OS_PAYPAL_', Configuration::get('PS_OS_PAYPAL'));
|
||||
define('_PS_OS_WS_PAYMENT_', Configuration::get('PS_OS_WS_PAYMENT'));
|
||||
define('_PS_OS_COD_VALIDATION_', Configuration::get('PS_OS_COD_VALIDATION'));
|
||||
define('_PS_OS_OVERBOOKING_', Configuration::get('PS_OS_OVERBOOKING_PAID'));
|
||||
define('_PS_OS_PARTIAL_PAYMENT_ACCEPTED_', Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'));
|
||||
|
||||
if (!defined('_MEDIA_SERVER_1_')) {
|
||||
define('_MEDIA_SERVER_1_', Configuration::get('PS_MEDIA_SERVER_1'));
|
||||
|
||||
@@ -40,15 +40,26 @@ function smartyTranslate($params, $smarty)
|
||||
$addslashes = (isset($params['slashes']) || isset($params['js']));
|
||||
$sprintf = isset($params['sprintf']) ? $params['sprintf'] : null;
|
||||
|
||||
if (!isset($params['lang'])) {
|
||||
$params['lang'] = null;
|
||||
} else {
|
||||
if (!is_object($params['lang'])) {
|
||||
$params['lang'] = new Language((int)$params['lang']);
|
||||
}
|
||||
if (!Validate::isLoadedObject($params['lang'])) {
|
||||
$params['lang'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf) {
|
||||
return Translate::smartyPostProcessTranslation(Translate::getPdfTranslation($params['s'], $sprintf), $params);
|
||||
return Translate::smartyPostProcessTranslation(Translate::getPdfTranslation($params['s'], $sprintf, $params['lang']), $params);
|
||||
}
|
||||
|
||||
$filename = ((!isset($smarty->compiler_object) || !is_object($smarty->compiler_object->template)) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath());
|
||||
|
||||
// If the template is part of a module
|
||||
if (!empty($params['mod'])) {
|
||||
return Translate::smartyPostProcessTranslation(Translate::getModuleTranslation($params['mod'], $params['s'], basename($filename, '.tpl'), $sprintf, isset($params['js'])), $params);
|
||||
return Translate::smartyPostProcessTranslation(Translate::getModuleTranslation($params['mod'], $params['s'], basename($filename, '.tpl'), $sprintf, isset($params['js']), $params['lang']), $params);
|
||||
}
|
||||
|
||||
// If the tpl is at the root of the template folder
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
use JetBrains\PhpStorm\Language;
|
||||
|
||||
global $smarty;
|
||||
$smarty->setTemplateDir(_PS_THEME_DIR_);
|
||||
|
||||
@@ -55,6 +57,17 @@ function smartyTranslate($params, $smarty)
|
||||
$params['d'] = null;
|
||||
}
|
||||
|
||||
if (!isset($params['lang'])) {
|
||||
$params['lang'] = null;
|
||||
} else {
|
||||
if (!is_object($params['lang'])) {
|
||||
$params['lang'] = new Language((int)$params['lang']);
|
||||
}
|
||||
if (!Validate::isLoadedObject($params['lang'])) {
|
||||
$params['lang'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($params['d'])) {
|
||||
if (isset($params['tags'])) {
|
||||
$backTrace = debug_backtrace();
|
||||
@@ -102,9 +115,9 @@ function smartyTranslate($params, $smarty)
|
||||
}
|
||||
|
||||
if ($params['mod']) {
|
||||
return Translate::smartyPostProcessTranslation(Translate::getModuleTranslation($params['mod'], $params['s'], $basename, $params['sprintf'], $params['js']), $params);
|
||||
return Translate::smartyPostProcessTranslation(Translate::getModuleTranslation($params['mod'], $params['s'], $basename, $params['sprintf'], $params['js'], $params['lang']), $params);
|
||||
} elseif ($params['pdf']) {
|
||||
return Translate::smartyPostProcessTranslation(Translate::getPdfTranslation($params['s'], $params['sprintf']), $params);
|
||||
return Translate::smartyPostProcessTranslation(Translate::getPdfTranslation($params['s'], $params['sprintf'], $params['lang']), $params);
|
||||
}
|
||||
|
||||
if ($_LANG != null && isset($_LANG[$key])) {
|
||||
|
||||
@@ -151,14 +151,15 @@
|
||||
<hook module="dashtrends" hook="actionOrderStatusPostUpdate" position="3"/>
|
||||
<hook module="dashtrends" hook="actionAdminControllerSetMedia" position="3"/>
|
||||
<hook module="dashtrends" hook="dashboardData" position="2"/>
|
||||
<hook module="dashtrends" hook="dashboardZoneTwo" position="1"/>
|
||||
<hook module="dashguestcycle" hook="dashboardZoneTwo" position="1"/>
|
||||
<hook module="dashtrends" hook="dashboardZoneTwo" position="2"/>
|
||||
<hook module="dashgoals" hook="actionAdminControllerSetMedia" position="4"/>
|
||||
<hook module="dashgoals" hook="dashboardData" position="3"/>
|
||||
<hook module="dashgoals" hook="dashboardZoneTwo" position="2"/>
|
||||
<hook module="dashgoals" hook="dashboardZoneTwo" position="3"/>
|
||||
<hook module="dashproducts" hook="actionSearch" position="1"/>
|
||||
<hook module="dashproducts" hook="dashboardData" position="4"/>
|
||||
<hook module="dashproducts" hook="actionObjectOrderAddAfter" position="2"/>
|
||||
<hook module="dashproducts" hook="dashboardZoneTwo" position="3"/>
|
||||
<hook module="dashproducts" hook="dashboardZoneTwo" position="4"/>
|
||||
<hook module="statsdata" hook="actionAuthentication" position="1"/>
|
||||
<hook module="statsdata" hook="displayFooter" position="7"/>
|
||||
<hook module="statsdata" hook="actionCustomerAccountAdd" position="2"/>
|
||||
|
||||
@@ -951,6 +951,79 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessupdateRoomOccupancy()
|
||||
{
|
||||
$params = Tools::getValue('params');
|
||||
$idBookingData = (int) $params['id_booking_data'];
|
||||
$idCart = (int) $params['id_cart'];
|
||||
$occupancy = $params['occupancy'];
|
||||
|
||||
$this->context->cart = new Cart($idCart);
|
||||
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
// validate occupancy is correct
|
||||
$hasError = false;
|
||||
if (is_array($occupancy)) {
|
||||
if (!$occupancy['adults'] || !Validate::isUnsignedInt($occupancy['adults'])) {
|
||||
$hasError = true;
|
||||
}
|
||||
if (!Validate::isUnsignedInt($occupancy['children'])) {
|
||||
$hasError = true;
|
||||
}
|
||||
if ($occupancy['children']) {
|
||||
if (!isset($occupancy['child_ages']) || $occupancy['children'] != count($occupancy['child_ages'])) {
|
||||
$hasError = true;
|
||||
} else {
|
||||
foreach($occupancy['child_ages'] as $age) {
|
||||
if (!Validate::isUnsignedInt($occupancy['adults'])) {
|
||||
$hasError = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$hasError = true;
|
||||
}
|
||||
|
||||
if (!$hasError) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idBookingData);
|
||||
$objRoomType = new HotelRoomType();
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($objHotelCartBookingData->id_product)) {
|
||||
if ($occupancy['adults'] > $roomTypeInfo['max_adults']) {
|
||||
$hasError = true;
|
||||
}
|
||||
if ($occupancy['children'] > $roomTypeInfo['max_children']) {
|
||||
$hasError = true;
|
||||
}
|
||||
if ($occupancy['adults'] + $occupancy['children'] > $roomTypeInfo['max_guests']) {
|
||||
$hasError = true;
|
||||
}
|
||||
if (!$hasError) {
|
||||
$objHotelCartBookingData->adults = $occupancy['adults'];
|
||||
$objHotelCartBookingData->children = $occupancy['children'];
|
||||
$objHotelCartBookingData->child_ages = json_encode($occupancy['child_ages']);
|
||||
$objHotelCartBookingData->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$bookingsInfo = $objHotelCartBookingData->getCartFormatedBookinInfoByIdCart($idCart);
|
||||
foreach ($bookingsInfo as &$bookingInfo) {
|
||||
if ($bookingInfo['id'] == $idBookingData) {
|
||||
$amtWithQty = $bookingInfo['amt_with_qty'];
|
||||
$bookingInfo['amt_with_qty'] = Tools::displayPrice($amtWithQty);
|
||||
$bookingInfo['total_price'] = Tools::displayPrice($amtWithQty + $bookingInfo['demand_price']);
|
||||
$response = array(
|
||||
'curr_booking_info' => $bookingInfo,
|
||||
'cart_info' => $this->ajaxReturnVars(),
|
||||
);
|
||||
|
||||
die(json_encode($response));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process to get extra demands of any room while order creation process form.tpl
|
||||
public function ajaxProcessGetRoomTypeCartDemands()
|
||||
{
|
||||
|
||||
@@ -398,8 +398,8 @@ class AdminDashboardControllerCore extends AdminController
|
||||
public function ajaxProcessGetBlogRss()
|
||||
{
|
||||
$return = array('has_errors' => false, 'rss' => array());
|
||||
if (!$this->isFresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _TIME_1_DAY_)) {
|
||||
if (!$this->refresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _PS_API_URL_.'/rss/blog/blog-'.$this->context->language->iso_code.'.xml')) {
|
||||
if (!Tools::isFresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _TIME_1_DAY_)) {
|
||||
if (!Tools::refresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _PS_API_URL_.'/rss/blog/blog-'.$this->context->language->iso_code.'.xml')) {
|
||||
$return['has_errors'] = true;
|
||||
}
|
||||
}
|
||||
@@ -506,7 +506,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
|
||||
public function getRecommendationContent()
|
||||
{
|
||||
if (!$this->isFresh(self::DASHBOARD_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(self::DASHBOARD_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT, Tools::addonsRequest('dashboard-recommendation'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT)) {
|
||||
|
||||
@@ -242,7 +242,7 @@ class AdminModulesCatalogControllerCore extends AdminController
|
||||
|
||||
public function getRecommendationContent()
|
||||
{
|
||||
if (!$this->isFresh(self::CATALOG_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(self::CATALOG_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT, Tools::addonsRequest('catalog-recommendation'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT)) {
|
||||
@@ -311,11 +311,11 @@ class AdminModulesCatalogControllerCore extends AdminController
|
||||
|
||||
protected function initSuggestedModulesList()
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,11 +172,11 @@ class AdminModulesControllerCore extends AdminController
|
||||
public function ajaxProcessRefreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
// Refresh modules_list.xml every week
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
$xml_modules_list = _QLO_API_DOMAIN_.'/xml/'.str_replace('.', '', _QLOAPPS_VERSION_).'.xml';
|
||||
if ($this->refresh(Module::CACHE_FILE_MODULES_LIST, 'https://'.$xml_modules_list)) {
|
||||
if (Tools::refresh(Module::CACHE_FILE_MODULES_LIST, 'https://'.$xml_modules_list)) {
|
||||
$this->status = 'refresh';
|
||||
} elseif ($this->refresh(Module::CACHE_FILE_MODULES_LIST, 'http://'.$xml_modules_list)) {
|
||||
} elseif (Tools::refresh(Module::CACHE_FILE_MODULES_LIST, 'http://'.$xml_modules_list)) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
@@ -187,7 +187,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
// If logged to Addons Webservices, refresh default country native modules list every day
|
||||
if ($this->status != 'error') {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -197,7 +197,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_ADDONS_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_ADDONS_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_ADDONS_MODULES_LIST, Tools::addonsRequest('addons-modules'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -207,7 +207,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -220,7 +220,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
// If logged to Addons Webservices, refresh customer modules list every 5 minutes
|
||||
if ($this->logged_on_addons && $this->status != 'error') {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 300) || $force_reload_cache) {
|
||||
if (!Tools::isFresh(Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 300) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_CUSTOMER_MODULES_LIST, Tools::addonsRequest('customer'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -230,7 +230,6 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->status = 'cache';
|
||||
}
|
||||
}
|
||||
Module::generateTrustedXml();
|
||||
}
|
||||
|
||||
public function displayAjaxRefreshModuleList()
|
||||
|
||||
@@ -219,6 +219,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$cart_detail_data = array();
|
||||
$cart_detail_data_obj = new HotelCartBookingData();
|
||||
if ($cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart)) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
foreach ($cart_detail_data as $key => $cart_data) {
|
||||
|
||||
$cart_detail_data[$key]['room_type_info'] = $objRoomType->getRoomTypeInfoByIdProduct($cart_data['id_product']);
|
||||
}
|
||||
$this->context->smarty->assign('cart_detail_data', $cart_detail_data);
|
||||
} else {
|
||||
// if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page
|
||||
@@ -233,14 +238,18 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
|
||||
|
||||
$defaults_order_state = array(
|
||||
'cheque' => (int)Configuration::get('PS_OS_CHEQUE'),
|
||||
'bankwire' => (int)Configuration::get('PS_OS_BANKWIRE'),
|
||||
'other' => (int)Configuration::get('PS_OS_PAYMENT'));
|
||||
'awaiting_payment' => (int)Configuration::get('PS_OS_AWAITING_PAYMENT'),
|
||||
'other' => (int)Configuration::get('PS_OS_PAYMENT_ACCEPTED'));
|
||||
$payment_modules = array();
|
||||
foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
|
||||
$payment_modules[] = Module::getInstanceById((int)$p_module['id_module']);
|
||||
}
|
||||
|
||||
$occupancyRequiredForBooking = false;
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'recyclable_pack' => (int)Configuration::get('PS_RECYCLABLE_PACK'),
|
||||
'gift_wrapping' => (int)Configuration::get('PS_GIFT_WRAPPING'),
|
||||
@@ -254,8 +263,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'toolbar_btn' => $this->toolbar_btn,
|
||||
'toolbar_scroll' => $this->toolbar_scroll,
|
||||
'PS_CATALOG_MODE' => Configuration::get('PS_CATALOG_MODE'),
|
||||
'title' => array($this->l('Orders'), $this->l('Create order'))
|
||||
|
||||
'title' => array($this->l('Orders'), $this->l('Create order')),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
));
|
||||
$this->content .= $this->createTemplate('form.tpl')->fetch();
|
||||
}
|
||||
@@ -455,8 +466,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$room_swapped = $obj_booking_dtl->reallocateRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $realloc_room_id);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$room_swapped = $objBookingDetail->reallocateRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $realloc_room_id);
|
||||
if (!$room_swapped) {
|
||||
$this->errors[] = Tools::displayError('Some error occured. Please try again.');
|
||||
} else {
|
||||
@@ -490,8 +501,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$room_swapped = $obj_booking_dtl->swapRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $swapped_room_id);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$room_swapped = $objBookingDetail->swapRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $swapped_room_id);
|
||||
if (!$room_swapped) {
|
||||
$this->errors[] = Tools::displayError('Some error occured. Please try again.');
|
||||
} else {
|
||||
@@ -747,7 +758,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$objOrderReturn = new OrderReturn();
|
||||
$objOrderReturn->id_customer = $order->id_customer;
|
||||
$objOrderReturn->id_order = $order->id;
|
||||
$objOrderReturn->state = 1;
|
||||
$objOrderReturn->state = Configuration::get('PS_ORS_PENDING');
|
||||
$objOrderReturn->by_admin = 1;
|
||||
$objOrderReturn->question = $refundReason;
|
||||
$objOrderReturn->save();
|
||||
@@ -781,6 +792,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$amount = str_replace(',', '.', Tools::getValue('payment_amount'));
|
||||
$currency = new Currency(Tools::getValue('payment_currency'));
|
||||
$payment_type = Tools::getValue('payment_type');
|
||||
$order_has_invoice = $order->hasInvoice();
|
||||
if ($order_has_invoice) {
|
||||
$order_invoice = new OrderInvoice(Tools::getValue('payment_invoice'));
|
||||
@@ -802,8 +814,18 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('The invoice is invalid.');
|
||||
} elseif (!Validate::isDate(Tools::getValue('payment_date'))) {
|
||||
$this->errors[] = Tools::displayError('The date is invalid');
|
||||
} elseif (!Validate::isUnsignedInt($payment_type)) {
|
||||
$this->errors[] = Tools::displayError('Payment source is invalid');
|
||||
} else {
|
||||
if (!$order->addOrderPayment($amount, Tools::getValue('payment_method'), Tools::getValue('payment_transaction_id'), $currency, Tools::getValue('payment_date'), $order_invoice)) {
|
||||
if (!$order->addOrderPayment(
|
||||
$amount,
|
||||
Tools::getValue('payment_method'),
|
||||
Tools::getValue('payment_transaction_id'),
|
||||
$currency,
|
||||
Tools::getValue('payment_date'),
|
||||
$order_invoice,
|
||||
$payment_type
|
||||
)) {
|
||||
if (!validate::isPrice($order->total_paid_real)) {
|
||||
$this->errors[] = Tools::displayError('Order total payments cannot be less than 0.');
|
||||
} else {
|
||||
@@ -869,13 +891,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
false,
|
||||
$cart->secure_key
|
||||
);
|
||||
/*
|
||||
setcookie('wk_id_cart', ' ', time() - 86400, '/');
|
||||
setcookie('wk_id_guest', ' ', time() - 86400, '/');
|
||||
|
||||
unset($_COOKIE['wk_id_cart']);
|
||||
unset($_COOKIE['wk_id_guest']);
|
||||
*/
|
||||
if (isset($this->context->cookie->id_cart)) {
|
||||
unset($this->context->cookie->id_cart);
|
||||
}
|
||||
if (isset($this->context->cookie->id_guest)) {
|
||||
unset($this->context->cookie->id_guest);
|
||||
}
|
||||
|
||||
if ($payment_module->currentOrder) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token.'&conf=3');
|
||||
}
|
||||
@@ -1449,6 +1472,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$totalDemandsPriceTI = 0;
|
||||
if ($order_detail_data = $objBookingDetail->getOrderFormatedBookinInfoByIdOrder($order->id)) {
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
foreach ($order_detail_data as $key => $value) {
|
||||
$order_detail_data[$key]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
@@ -1502,6 +1526,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_detail_data[$key]['unit_amt_tax_incl'] = $value['total_price_tax_incl']/$num_days;
|
||||
$order_detail_data[$key]['amt_with_qty_tax_excl'] = $value['total_price_tax_excl'];
|
||||
$order_detail_data[$key]['amt_with_qty_tax_incl'] = $value['total_price_tax_incl'];
|
||||
$order_detail_data[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1517,7 +1543,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// hotel booking statuses
|
||||
$htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus();
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
// refund info
|
||||
'refund_allowed' => (int) $order->isReturnable(),
|
||||
@@ -1533,6 +1558,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'htl_booking_order_data' => $bookingOrderInfo,
|
||||
'hotel_order_status' => $htlOrderStatus,
|
||||
'order_detail_data' => $order_detail_data,
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
/*END*/
|
||||
'order' => $order,
|
||||
'cart' => new Cart($order->id_cart),
|
||||
@@ -1574,6 +1601,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'invoices_collection' => $order->getInvoicesCollection(),
|
||||
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
|
||||
'payment_methods' => $payment_methods,
|
||||
'payment_types' => $this->getPaymentsTypes(),
|
||||
'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop),
|
||||
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
|
||||
'HOOK_CONTENT_ORDER' => Hook::exec(
|
||||
@@ -1667,7 +1695,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search')), null, $idHotel)) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
foreach ($products as &$product) {
|
||||
// get product room type informatin
|
||||
if ($roomTypeDetail = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) {
|
||||
$product['room_type_info'] = $roomTypeDetail;
|
||||
}
|
||||
|
||||
// Formatted price
|
||||
$product['formatted_price'] = Tools::displayPrice(Tools::convertPrice($product['price_tax_incl'], $currency), $currency);
|
||||
// Concret price
|
||||
@@ -1800,6 +1834,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$date_from = date('Y-m-d', strtotime($product_informations['date_from']));
|
||||
$date_to = date('Y-m-d', strtotime($product_informations['date_to']));
|
||||
$curr_date = date('Y-m-d');
|
||||
$occupancy = Tools::getValue('occupancy');
|
||||
/*Validations*/
|
||||
if ($date_from == '') {
|
||||
die(json_encode(array(
|
||||
@@ -1831,6 +1866,45 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
)));
|
||||
}
|
||||
if ($order->with_occupancy) {
|
||||
if ($occupancy) {
|
||||
foreach($occupancy as $key =>$roomOccupancy) {
|
||||
if (!$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1)),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($roomOccupancy['children'])) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1)),
|
||||
)));
|
||||
}
|
||||
if ($roomOccupancy['children'] > 0) {
|
||||
if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages']))) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1)),
|
||||
)));
|
||||
} else {
|
||||
foreach($roomOccupancy['child_ages'] as $childAge) {
|
||||
if (!Validate::isUnsignedInt($childAge)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1)),
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid occupancy.'),
|
||||
)));
|
||||
}
|
||||
} elseif (!Validate::isUnsignedInt($product_informations['product_quantity'])) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
@@ -1838,8 +1912,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
if ($order->with_occupancy) {
|
||||
$req_rm = count($occupancy);
|
||||
} else {
|
||||
$req_rm = $product_informations['product_quantity'];
|
||||
}
|
||||
$obj_booking_detail = new HotelBookingDetail();
|
||||
$req_rm = $product_informations['product_quantity'];
|
||||
$num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to);
|
||||
$product_informations['product_quantity'] = $product_informations['product_quantity'] * (int) $num_days;
|
||||
|
||||
@@ -1850,9 +1929,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$id_hotel = $room_info_by_id_product['id_hotel'];
|
||||
|
||||
if ($id_hotel) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$hotel_room_data = $obj_booking_dtl->DataForFrontSearch($date_from, $date_to, $id_hotel, $product_informations['product_id'], 1, 0, 0, -1, 0, 0, $id_cart, $id_guest);
|
||||
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$bookingParams = array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'hotel_id' => $id_hotel,
|
||||
'id_room_type' => $product_informations['product_id'],
|
||||
'only_search_data' => 1,
|
||||
'id_cart' => $id_cart,
|
||||
'id_guest' => $id_guest,
|
||||
);
|
||||
$hotel_room_data = $objBookingDetail->dataForFrontSearch($bookingParams);
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
@@ -1923,54 +2010,40 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->context->cart = $cart;
|
||||
$this->context->customer = new Customer($order->id_customer);
|
||||
|
||||
// always add taxes even if there are not displayed to the customer
|
||||
$use_taxes = true;
|
||||
$initial_product_price_tax_incl = Product::getPriceStatic(
|
||||
$product->id,
|
||||
$use_taxes,
|
||||
isset($combination) ? $combination->id : null,
|
||||
2,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
1,
|
||||
false,
|
||||
$order->id_customer,
|
||||
$cart->id,
|
||||
$order->{Configuration::get('PS_TAX_ADDRESS_TYPE', null, null, $order->id_shop)}
|
||||
);
|
||||
|
||||
// create feature price if needed
|
||||
$createFeaturePrice = $product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl;
|
||||
$featurePriceParams = array();
|
||||
if ($createFeaturePrice) {
|
||||
$featurePriceParams = array(
|
||||
'id_cart' => $this->context->cart->id,
|
||||
'id_guest' => $this->context->cookie->id_guest,
|
||||
'price' => $product_informations['product_price_tax_excl'],
|
||||
'id_product' => $product->id,
|
||||
);
|
||||
if ($order->with_occupancy) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
$roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product);
|
||||
}
|
||||
|
||||
/*By Webkul to make entries in HotelCartBookingData */
|
||||
$hotel_room_info_arr = $hotel_room_data['rm_data'][0]['data']['available'];
|
||||
$hotel_room_info_arr = $hotel_room_data['rm_data'][$idProduct]['data']['available'];
|
||||
$chkQty = 0;
|
||||
if ($hotel_room_info_arr) {
|
||||
foreach ($hotel_room_info_arr as $room_info) {
|
||||
foreach ($hotel_room_info_arr as $key => $room_info) {
|
||||
if ($chkQty < $req_rm) {
|
||||
$obj_htl_cart_booking_data = new HotelCartBookingData();
|
||||
$obj_htl_cart_booking_data->id_cart = $this->context->cart->id;
|
||||
$obj_htl_cart_booking_data->id_guest = $this->context->cookie->id_guest;
|
||||
$obj_htl_cart_booking_data->id_customer = $this->context->customer->id;
|
||||
$obj_htl_cart_booking_data->id_currency = $order->id_currency;
|
||||
$obj_htl_cart_booking_data->id_product = $room_info['id_product'];
|
||||
$obj_htl_cart_booking_data->id_room = $room_info['id_room'];
|
||||
$obj_htl_cart_booking_data->id_hotel = $room_info['id_hotel'];
|
||||
$obj_htl_cart_booking_data->booking_type = HotelBookingDetail::ALLOTMENT_AUTO;
|
||||
$obj_htl_cart_booking_data->quantity = $num_days;
|
||||
$obj_htl_cart_booking_data->date_from = $date_from;
|
||||
$obj_htl_cart_booking_data->date_to = $date_to;
|
||||
$obj_htl_cart_booking_data->save();
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$objCartBookingData->id_cart = $this->context->cart->id;
|
||||
$objCartBookingData->id_guest = $this->context->cookie->id_guest;
|
||||
$objCartBookingData->id_customer = $this->context->customer->id;
|
||||
$objCartBookingData->id_currency = $order->id_currency;
|
||||
$objCartBookingData->id_product = $room_info['id_product'];
|
||||
$objCartBookingData->id_room = $room_info['id_room'];
|
||||
$objCartBookingData->id_hotel = $room_info['id_hotel'];
|
||||
$objCartBookingData->booking_type = HotelBookingDetail::ALLOTMENT_AUTO;
|
||||
$objCartBookingData->quantity = $num_days;
|
||||
$objCartBookingData->date_from = $date_from;
|
||||
$objCartBookingData->date_to = $date_to;
|
||||
|
||||
if ($order->with_occupancy) {
|
||||
$room_occupancy = array_shift($occupancy);
|
||||
$objCartBookingData->adults = $room_occupancy['adults'];
|
||||
$objCartBookingData->children = $room_occupancy['children'];
|
||||
$objCartBookingData->child_ages = $room_occupancy['children'] ? json_encode($room_occupancy['child_ages']) : json_encode(array());
|
||||
} else {
|
||||
$objCartBookingData->adults = $roomTypeInfo['adults'];
|
||||
$objCartBookingData->children = $roomTypeInfo['children'];
|
||||
$objCartBookingData->child_ages = json_encode(array());
|
||||
}
|
||||
$objCartBookingData->save();
|
||||
++$chkQty;
|
||||
|
||||
// create feature price if needed
|
||||
@@ -1985,10 +2058,52 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
/*END*/
|
||||
// always add taxes even if there are not displayed to the customer
|
||||
$use_taxes = true;
|
||||
|
||||
$initial_product_price_tax_incl = Product::getPriceStatic(
|
||||
$product->id,
|
||||
$use_taxes,
|
||||
isset($combination) ? $combination->id : null,
|
||||
2,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
1,
|
||||
false,
|
||||
$order->id_customer,
|
||||
$cart->id,
|
||||
$order->id_address_tax
|
||||
);
|
||||
|
||||
// Creating specific price if needed
|
||||
if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl) {
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_shop = 0;
|
||||
$specific_price->id_shop_group = 0;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
$specific_price->id_customer = $order->id_customer;
|
||||
$specific_price->id_product = $product->id;
|
||||
if (isset($combination)) {
|
||||
$specific_price->id_product_attribute = $combination->id;
|
||||
} else {
|
||||
$specific_price->id_product_attribute = 0;
|
||||
}
|
||||
$specific_price->price = $product_informations['product_price_tax_excl'];
|
||||
$specific_price->from_quantity = 1;
|
||||
$specific_price->reduction = 0;
|
||||
$specific_price->reduction_type = 'amount';
|
||||
$specific_price->reduction_tax = 0;
|
||||
$specific_price->from = '0000-00-00 00:00:00';
|
||||
$specific_price->to = '0000-00-00 00:00:00';
|
||||
$specific_price->add();
|
||||
}
|
||||
|
||||
// Add product to cart
|
||||
$update_quantity = $cart->updateQty(
|
||||
$product_informations['product_quantity'],
|
||||
($req_rm * $num_days),
|
||||
$product->id,
|
||||
isset($product_informations['product_attribute_id']) ? $product_informations['product_attribute_id'] : null,
|
||||
isset($combination) ? $combination->id : null,
|
||||
@@ -2215,76 +2330,79 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
/*By Webkul Entry into table HotelbookingDetail*/
|
||||
$objRoomType = new HotelRoomType();
|
||||
$objHtlBkDtl = new HotelBookingDetail();
|
||||
$inserted_id_order_detail = $objHtlBkDtl->getLastInsertedIdOrderDetail($order->id);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$inserted_id_order_detail = $objBookingDetail->getLastInsertedIdOrderDetail($order->id);
|
||||
$idLang = (int)$this->context->cart->id_lang;
|
||||
$obj_cart_bk_data = new HotelCartBookingData();
|
||||
if ($cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData(
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartBookingData = $objCartBookingData->getOnlyCartBookingData(
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest,
|
||||
$idProduct
|
||||
)) {
|
||||
foreach ($cart_bk_data as $cb_k => $cb_v) {
|
||||
$obj_cart_bk_data = new HotelCartBookingData($cb_v['id']);
|
||||
$obj_cart_bk_data->id_order = $order->id;
|
||||
$obj_cart_bk_data->save();
|
||||
foreach ($cartBookingData as $cb_k => $cb_v) {
|
||||
$objCartBookingData = new HotelCartBookingData($cb_v['id']);
|
||||
$objCartBookingData->id_order = $order->id;
|
||||
$objCartBookingData->save();
|
||||
|
||||
$objHtlBkDtl = new HotelBookingDetail();
|
||||
$objHtlBkDtl->id_product = $idProduct;
|
||||
$objHtlBkDtl->id_order = $order->id;
|
||||
$objHtlBkDtl->id_order_detail = $inserted_id_order_detail;
|
||||
$objHtlBkDtl->id_cart = $this->context->cart->id;
|
||||
$objHtlBkDtl->id_room = $obj_cart_bk_data->id_room;
|
||||
$objHtlBkDtl->id_hotel = $obj_cart_bk_data->id_hotel;
|
||||
$objHtlBkDtl->id_customer = $this->context->customer->id;
|
||||
$objHtlBkDtl->booking_type = $obj_cart_bk_data->booking_type;
|
||||
$objHtlBkDtl->id_status = 1;
|
||||
$objHtlBkDtl->comment = $obj_cart_bk_data->comment;
|
||||
$objHtlBkDtl->room_type_name = Product::getProductName($idProduct, null, $order->id_lang);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$objBookingDetail->id_product = $idProduct;
|
||||
$objBookingDetail->id_order = $order->id;
|
||||
$objBookingDetail->id_order_detail = $inserted_id_order_detail;
|
||||
$objBookingDetail->id_cart = $this->context->cart->id;
|
||||
$objBookingDetail->id_room = $objCartBookingData->id_room;
|
||||
$objBookingDetail->id_hotel = $objCartBookingData->id_hotel;
|
||||
$objBookingDetail->id_customer = $this->context->customer->id;
|
||||
$objBookingDetail->booking_type = $objCartBookingData->booking_type;
|
||||
$objBookingDetail->id_status = 1;
|
||||
$objBookingDetail->comment = $objCartBookingData->comment;
|
||||
$objBookingDetail->room_type_name = Product::getProductName($idProduct, null, $order->id_lang);
|
||||
|
||||
$objHtlBkDtl->date_from = $obj_cart_bk_data->date_from;
|
||||
$objHtlBkDtl->date_to = $obj_cart_bk_data->date_to;
|
||||
$objBookingDetail->date_from = $objCartBookingData->date_from;
|
||||
$objBookingDetail->date_to = $objCartBookingData->date_to;
|
||||
$objBookingDetail->adults = $objCartBookingData->adults;
|
||||
$objBookingDetail->children = $objCartBookingData->children;
|
||||
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
|
||||
|
||||
$total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idProduct,
|
||||
$obj_cart_bk_data->date_from,
|
||||
$obj_cart_bk_data->date_to,
|
||||
$objCartBookingData->date_from,
|
||||
$objCartBookingData->date_to,
|
||||
0,
|
||||
Group::getCurrent()->id,
|
||||
$this->context->cart->id,
|
||||
$this->context->cookie->id_guest,
|
||||
$obj_cart_bk_data->id_room
|
||||
$objCartBookingData->id_room
|
||||
);
|
||||
|
||||
$objHtlBkDtl->total_price_tax_excl = $total_price['total_price_tax_excl'];
|
||||
$objHtlBkDtl->total_price_tax_incl = $total_price['total_price_tax_incl'];
|
||||
$objHtlBkDtl->total_paid_amount = Tools::ps_round($total_price['total_price_tax_incl'], 5);
|
||||
$objBookingDetail->total_price_tax_excl = $total_price['total_price_tax_excl'];
|
||||
$objBookingDetail->total_price_tax_incl = $total_price['total_price_tax_incl'];
|
||||
$objBookingDetail->total_paid_amount = Tools::ps_round($total_price['total_price_tax_incl'], 5);
|
||||
|
||||
// Save hotel information/location/contact
|
||||
if (Validate::isLoadedObject($objRoom = new HotelRoomInformation($obj_cart_bk_data->id_room))) {
|
||||
$objHtlBkDtl->room_num = $objRoom->room_num;
|
||||
if (Validate::isLoadedObject($objRoom = new HotelRoomInformation($objCartBookingData->id_room))) {
|
||||
$objBookingDetail->room_num = $objRoom->room_num;
|
||||
}
|
||||
if (Validate::isLoadedObject($objHotelBranch = new HotelBranchInformation(
|
||||
$obj_cart_bk_data->id_hotel,
|
||||
$objCartBookingData->id_hotel,
|
||||
$idLang
|
||||
))) {
|
||||
$addressInfo = $objHotelBranch->getAddress($obj_cart_bk_data->id_hotel);
|
||||
$objHtlBkDtl->hotel_name = $objHotelBranch->hotel_name;
|
||||
$objHtlBkDtl->city = $addressInfo['city'];
|
||||
$objHtlBkDtl->state = State::getNameById($addressInfo['id_state']);
|
||||
$objHtlBkDtl->country = Country::getNameById($idLang, $addressInfo['id_country']);
|
||||
$objHtlBkDtl->zipcode = $addressInfo['postcode'];;
|
||||
$objHtlBkDtl->phone = $addressInfo['phone'];
|
||||
$objHtlBkDtl->email = $objHotelBranch->email;
|
||||
$objHtlBkDtl->check_in_time = $objHotelBranch->check_in;
|
||||
$objHtlBkDtl->check_out_time = $objHotelBranch->check_out;
|
||||
$addressInfo = $objHotelBranch->getAddress($objCartBookingData->id_hotel);
|
||||
$objBookingDetail->hotel_name = $objHotelBranch->hotel_name;
|
||||
$objBookingDetail->city = $addressInfo['city'];
|
||||
$objBookingDetail->state = State::getNameById($addressInfo['id_state']);
|
||||
$objBookingDetail->country = Country::getNameById($idLang, $addressInfo['id_country']);
|
||||
$objBookingDetail->zipcode = $addressInfo['postcode'];;
|
||||
$objBookingDetail->phone = $addressInfo['phone'];
|
||||
$objBookingDetail->email = $objHotelBranch->email;
|
||||
$objBookingDetail->check_in_time = $objHotelBranch->check_in;
|
||||
$objBookingDetail->check_out_time = $objHotelBranch->check_out;
|
||||
}
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($idProduct)) {
|
||||
$objHtlBkDtl->adult = $roomTypeInfo['adult'];
|
||||
$objHtlBkDtl->children = $roomTypeInfo['children'];
|
||||
$objBookingDetail->adults = $objCartBookingData->adults;
|
||||
$objBookingDetail->children = $objCartBookingData->children;
|
||||
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
|
||||
}
|
||||
|
||||
$objHtlBkDtl->save();
|
||||
$objBookingDetail->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2395,7 +2513,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
/*By webkul To edit Order and cart entries when edit rooms from the orderLine when editing the order*/
|
||||
$product_informations = $_POST['add_product'];
|
||||
$product_informations = $_POST['edit_product'];
|
||||
$new_date_from = trim(date('Y-m-d', strtotime($product_informations['date_from'])));
|
||||
$new_date_to = trim(date('Y-m-d', strtotime($product_informations['date_to'])));
|
||||
$old_date_from = trim(Tools::getValue('date_from'));
|
||||
@@ -2408,6 +2526,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_quantity = (int) $obj_booking_detail->getNumberOfDays($new_date_from, $new_date_to);
|
||||
$old_product_quantity = (int) $obj_booking_detail->getNumberOfDays($old_date_from, $old_date_to);
|
||||
$qty_diff = $product_quantity - $old_product_quantity;
|
||||
$occupancy = array_shift(Tools::getValue('occupancy'));
|
||||
$adults = $occupancy['adults'];
|
||||
$children = $occupancy['children'];
|
||||
$child_ages = $occupancy['child_ages'];
|
||||
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
@@ -2465,6 +2587,33 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
} elseif (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid number of adults.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($children)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid number of children.'),
|
||||
)));
|
||||
}
|
||||
if ($children > 0) {
|
||||
if (!isset($child_ages) || ($children != count($child_ages))) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please provide all children age.'),
|
||||
)));
|
||||
} else {
|
||||
foreach($child_ages as $childAge) {
|
||||
if (!Validate::isUnsignedInt($childAge)) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid children age.'),
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rooms_booked = $obj_booking_detail->getRoomBookinInformationForDateRangeByOrder($id_room, $old_date_from, $old_date_to, $new_date_from, $new_date_to);
|
||||
@@ -2693,6 +2842,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$old_date_to
|
||||
);
|
||||
|
||||
// set occupancy details
|
||||
$occupancy = array(
|
||||
'adults' => $adults,
|
||||
'children' => $children,
|
||||
'child_ages' => $child_ages
|
||||
);
|
||||
|
||||
/*By webkul to edit the Hotel Cart and Hotel Order tables when editing the room for the order detail page*/
|
||||
$new_total_price = array(
|
||||
'tax_excl' => $totalRoomPriceAfterTE,
|
||||
@@ -2705,6 +2861,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$old_date_to,
|
||||
$new_date_from,
|
||||
$new_date_to,
|
||||
$occupancy,
|
||||
$new_total_price
|
||||
)) {
|
||||
// update extra demands total prices if dates are changes (price calc method for each day)
|
||||
@@ -3124,6 +3281,27 @@ class AdminOrdersControllerCore extends AdminController
|
||||
return $products;
|
||||
}
|
||||
|
||||
protected function getPaymentsTypes()
|
||||
{
|
||||
return array(
|
||||
OrderPayment::PAYMENT_TYPE_ONLINE => array(
|
||||
'key' => 'PAYMENT_TYPE_ONLINE',
|
||||
'value' => OrderPayment::PAYMENT_TYPE_ONLINE,
|
||||
'name' => $this->l('Online')
|
||||
),
|
||||
OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL => array(
|
||||
'key' => 'PAYMENT_TYPE_PAY_AT_HOTEL',
|
||||
'value' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL,
|
||||
'name' => $this->l('Pay at hotel')
|
||||
),
|
||||
OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT => array(
|
||||
'key' => 'PAYMENT_TYPE_REMOTE_PAYMENT',
|
||||
'value' => OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT,
|
||||
'name' => $this->l('Remote payment')
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderDetail $order_detail
|
||||
* @param int $qty_cancel_product
|
||||
|
||||
@@ -109,15 +109,91 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
'cast' => 'intval',
|
||||
'required' => false,
|
||||
'type' => 'bool'
|
||||
)
|
||||
),
|
||||
'submit' => array('title' => $this->l('Save'))
|
||||
),
|
||||
'search' => array(
|
||||
'title' => $this->l('Search'),
|
||||
'fields' => array(
|
||||
'PS_FRONT_SEARCH_TYPE' => array(
|
||||
'title' => $this->l('Front end search type'),
|
||||
'hint' => $this->l('Select search type for frontend. In "Occupancy wise search", occupancy field will be shown in the search panel and search will be based on required occupancy by the guest. In "Search without occupancy", All available room types will be shown for the search dates without any occupancy filter.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::SEARCH_TYPE_OWS, 'name' => $this->l('Occupancy wise search')),
|
||||
array('id' => HotelBookingDetail::SEARCH_TYPE_NORMAL, 'name' => $this->l('Search without occupancy'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
'desc' => $this->l('Choose "Occupancy wise search" or "Search without occupancy". Occupancy search restriction will depend on this option selection at front end.'),
|
||||
),
|
||||
'PS_FRONT_OWS_SEARCH_ALGO_TYPE' => array(
|
||||
'title' => $this->l('Front end occupancy wise search algorithm'),
|
||||
'hint' => $this->l('In occupancy wise search at front end, you want to display only room types which are fully satisfying searched occupancy or you want to display all the available room types for the dates searched'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::SEARCH_EXACT_ROOM_TYPE_ALGO, 'name' => $this->l('Show room types satisfying required occupancy')),
|
||||
array('id' => HotelBookingDetail::SEARCH_ALL_ROOM_TYPE_ALGO, 'name' => $this->l('Show all available room types'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
'desc' => $this->l('This option is only for fully available rooms. For partially available rooms, always all possible rooms will be displayed.'),
|
||||
),
|
||||
'PS_FRONT_ROOM_UNIT_SELECTION_TYPE' => array(
|
||||
'title' => $this->l('In front-end, add rooms to cart with'),
|
||||
'hint' => $this->l('In Room occupancy, while adding rooms in cart customer has to select per room occupancy and in room quantity customer only has to select number of rooms.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
|
||||
array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
),
|
||||
'PS_BACKOFFICE_SEARCH_TYPE' => array(
|
||||
'title' => $this->l('Back-office search type'),
|
||||
'hint' => $this->l('Select search type for Back-office. In "Occupancy wise search", occupancy field will be shown in the search panel and search will be based on required occupancy by the employee. In "Search without occupancy", All available room types will be shown for the search dates without any occupancy filter.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::SEARCH_TYPE_OWS, 'name' => $this->l('Occupancy wise search')),
|
||||
array('id' => HotelBookingDetail::SEARCH_TYPE_NORMAL, 'name' => $this->l('Search without occupancy'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
'desc' => $this->l('Choose "Occupancy wise search" or "Search without occupancy". Occupancy search restriction will depend on this option selection at back-office.'),
|
||||
),
|
||||
'PS_BACKOFFICE_OWS_SEARCH_ALGO_TYPE' => array(
|
||||
'title' => $this->l('Back-office occupancy wise search algorithm'),
|
||||
'hint' => $this->l('In occupancy wise search at back-office, you want to display only room types which are fully satisfying searched occupancy or you want to display all the available room types for the dates searched.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::SEARCH_EXACT_ROOM_TYPE_ALGO, 'name' => $this->l('Show room types satisfying required occupancy')),
|
||||
array('id' => HotelBookingDetail::SEARCH_ALL_ROOM_TYPE_ALGO, 'name' => $this->l('Show all available room types'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
'desc' => $this->l('This option is only for fully available rooms. For partially available rooms, always all possible rooms will be displayed.'),
|
||||
),
|
||||
'PS_BACKOFFICE_ROOM_BOOKING_TYPE' => array(
|
||||
'title' => $this->l('In back-office, add rooms to cart with'),
|
||||
'hint' => $this->l('In Room occupancy, while adding rooms in cart customer has to select per room occupancy and in room quantity customer only has to select number of rooms.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')),
|
||||
array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)'))
|
||||
),
|
||||
'identifier' => 'id',
|
||||
),
|
||||
'PS_LOS_RESTRICTION_BO' => array(
|
||||
'title' => $this->l('Apply Min and Max lenght of stay restrictions for back-office bookings'),
|
||||
'hint' => $this->l('While creating bookings from back-office, apply minimum and maximum lenght of stay restrictions'),
|
||||
'title' => $this->l('Apply Min and Max lenght of stay restrictions for back-office search'),
|
||||
'hint' => $this->l('While searching for available rooms from back-office, apply minimum and maximum lenght of stay restrictions'),
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'required' => false,
|
||||
'type' => 'bool'
|
||||
)
|
||||
),
|
||||
),
|
||||
'submit' => array('title' => $this->l('Save'))
|
||||
),
|
||||
@@ -356,9 +432,28 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
if (Tools::getValue('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
|
||||
$_POST['PS_FRONT_ROOM_UNIT_SELECTION_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
|
||||
}
|
||||
|
||||
if (Tools::getValue('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
|
||||
$_POST['PS_BACKOFFICE_ROOM_BOOKING_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY;
|
||||
}
|
||||
|
||||
if (Tools::getIsset('PS_CATALOG_MODE')) {
|
||||
Tools::clearSmartyCache();
|
||||
Media::clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
|
||||
Media::addJsDef(array(
|
||||
'SEARCH_TYPE_OWS' => HotelBookingDetail::SEARCH_TYPE_OWS
|
||||
));
|
||||
|
||||
$this->addJS(_PS_JS_DIR_.'admin/ppreferences.js');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)';
|
||||
|
||||
$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 .= 'hrt.`adult`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, ';
|
||||
$this->_select .= 'hrt.`adults`, hrt.`children`, 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`';
|
||||
|
||||
@@ -255,9 +255,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
'callback' => 'getHotelName',
|
||||
);
|
||||
}
|
||||
$this->fields_list['adult'] = array(
|
||||
$this->fields_list['adults'] = array(
|
||||
'title' => $this->l('Adults'),
|
||||
'filter_key' => 'hrt!adult',
|
||||
'filter_key' => 'hrt!adults',
|
||||
'align' => 'center',
|
||||
);
|
||||
$this->fields_list['child'] = array(
|
||||
@@ -3438,6 +3438,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
} else {
|
||||
$this->displayWarning($this->l('You must save this room type before managing occupancy.'));
|
||||
}
|
||||
$smartyVars['currency'] = $this->context->currency;
|
||||
$data->assign($smartyVars);
|
||||
$this->tpl_form_vars['custom_form'] = $data->fetch();
|
||||
}
|
||||
@@ -3454,16 +3455,48 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($objRoomType = new HotelRoomType($idHtlRoomType))) {
|
||||
$baseAdults = Tools::getValue('base_adults');
|
||||
$baseChildren = Tools::getValue('base_children');
|
||||
$maxAdults = Tools::getValue('max_adults');
|
||||
$maxChildren = Tools::getValue('max_children');
|
||||
$maxGuests = Tools::getValue('max_guests');
|
||||
|
||||
if (!$baseAdults || !Validate::isUnsignedInt($baseAdults)) {
|
||||
$this->errors[] = Tools::displayError('Invalid base adults');
|
||||
}
|
||||
if (!Validate::isUnsignedInt($baseChildren)) {
|
||||
if ($baseChildren == '' || !Validate::isUnsignedInt($baseChildren)) {
|
||||
$this->errors[] = Tools::displayError('Invalid base children');
|
||||
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
if ($baseChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Base children cannot be greater than max childern allowed on your website (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
|
||||
}
|
||||
}
|
||||
if (!$maxAdults || !Validate::isUnsignedInt($maxAdults)) {
|
||||
$this->errors[] = Tools::displayError('Invalid maximum number of adults');
|
||||
} elseif ($maxAdults < $baseAdults) {
|
||||
$this->errors[] = Tools::displayError('Maximum number of adults cannot be less than base adults');
|
||||
}
|
||||
if ($maxChildren == '' || !Validate::isUnsignedInt($maxChildren)) {
|
||||
$this->errors[] = Tools::displayError('Invalid maximum number of children');
|
||||
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
if ($maxChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Maximum number of children cannot be greater than max childern allowed on your website (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
|
||||
}
|
||||
} elseif ($maxChildren < $baseChildren) {
|
||||
$this->errors[] = Tools::displayError('Maximum number of children cannot be less than base children');
|
||||
}
|
||||
if (!$maxGuests || !Validate::isUnsignedInt($maxGuests)) {
|
||||
$this->errors[] = Tools::displayError('Invalid maximum number of guests');
|
||||
} elseif ($maxGuests < ($baseAdults + $baseChildren)) {
|
||||
$this->errors[] = Tools::displayError('Maximum number of guests cannot be less than base occupancy of adults and children');
|
||||
} elseif ($maxGuests > ($maxChildren + $maxAdults)) {
|
||||
$this->errors[] = Tools::displayError('Maximum number of guests cannot be more than max occupancy of adults and children');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objRoomType->adult = $baseAdults;
|
||||
$objRoomType->adults = $baseAdults;
|
||||
$objRoomType->children = $baseChildren;
|
||||
$objRoomType->max_adults = $maxAdults;
|
||||
$objRoomType->max_children = $maxChildren;
|
||||
$objRoomType->max_guests = $maxGuests;
|
||||
$objRoomType->save();
|
||||
}
|
||||
} else {
|
||||
@@ -3474,7 +3507,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// send information for the length of stay tab
|
||||
public function initFormLengthOfStay($product)
|
||||
{
|
||||
|
||||
@@ -34,11 +34,14 @@ class AdminSlipControllerCore extends AdminController
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'order_slip';
|
||||
$this->className = 'OrderSlip';
|
||||
$this->list_no_link = true;
|
||||
|
||||
$this->_select = ' o.`id_shop`';
|
||||
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = a.`id_order`)';
|
||||
$this->_group = ' GROUP BY a.`id_order_slip`';
|
||||
|
||||
$this->addRowAction('statusChange');
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_order_slip' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -63,7 +66,26 @@ class AdminSlipControllerCore extends AdminController
|
||||
'callback' => 'printPDFIcons',
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
'remove_onclick' => true)
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'redeem_status' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
OrderSlip::REDEEM_STATUS_ACTIVE => $this->l('Active'),
|
||||
OrderSlip::REDEEM_STATUS_REDEEMED => $this->l('Redeemed'),
|
||||
),
|
||||
'align' => 'center',
|
||||
'filter_key' => 'a!redeem_status',
|
||||
'callback' => 'displayRedeemStatus',
|
||||
'class' => 'fixed-width-md',
|
||||
),
|
||||
'id_cart_rule' => array(
|
||||
'title' => $this->l('Voucher'),
|
||||
'align' => 'center',
|
||||
'callback' => 'displayVoucherLink',
|
||||
'class' => 'fixed-width-lg',
|
||||
),
|
||||
);
|
||||
|
||||
$this->_select = 'a.id_order_slip AS id_pdf';
|
||||
@@ -162,6 +184,38 @@ class AdminSlipControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function processStatusChange()
|
||||
{
|
||||
$idOrderSlip = Tools::getValue('id_order_slip');
|
||||
$objOrderSlip = new OrderSlip($idOrderSlip);
|
||||
|
||||
if (!Validate::isLoadedObject($objOrderSlip)) {
|
||||
$this->errors[] = $this->l('The credit slip can not be loaded.');
|
||||
} elseif ($objOrderSlip->redeem_status != OrderSlip::REDEEM_STATUS_ACTIVE) {
|
||||
$this->errors[] = $this->l('The status for this credit slip can not be changed.');
|
||||
} else {
|
||||
$objOrder = new Order($objOrderSlip->id_order);
|
||||
$objCustomer = new Customer($objOrderSlip->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($objOrder)) {
|
||||
$this->errors[] = $this->l('The related order for this credit slip can not be loaded.');
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($objCustomer)) {
|
||||
$this->errors[] = $this->l('The related customer for this credit slip can not be loaded.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objOrderSlip->redeem_status = OrderSlip::REDEEM_STATUS_REDEEMED;
|
||||
if ($objOrderSlip->save()) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
|
||||
}
|
||||
|
||||
$this->errors[] = $this->l('Something went wrong while changing status.');
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->initTabModuleList();
|
||||
@@ -202,4 +256,43 @@ class AdminSlipControllerCore extends AdminController
|
||||
|
||||
return $this->createTemplate('_print_pdf_icon.tpl')->fetch();
|
||||
}
|
||||
|
||||
public function displayRedeemStatus($redeemStatus, $row)
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'redeem_status' => $redeemStatus,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_redeem_status.tpl')->fetch();
|
||||
}
|
||||
|
||||
public function displayVoucherLink($idCartRule, $row)
|
||||
{
|
||||
if ($row['redeem_status'] == OrderSlip::REDEEM_STATUS_REDEEMED && $idCartRule) {
|
||||
$this->context->smarty->assign(array(
|
||||
'id_cart_rule' => (int) $idCartRule,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_display_voucher_link.tpl')->fetch();
|
||||
}
|
||||
|
||||
return '--';
|
||||
}
|
||||
|
||||
public function displayStatusChangeLink($token = null, $id)
|
||||
{
|
||||
$objOrderSlip = new OrderSlip($id);
|
||||
if ($objOrderSlip->redeem_status != OrderSlip::REDEEM_STATUS_REDEEMED) {
|
||||
$statusChangeLink = self::$currentIndex.'&'.$this->identifier.'='.$id.'&action=statusChange'.
|
||||
'&token='.($token != null ? $token : $this->token);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'status_change_link' => $statusChangeLink,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_status_change_link.tpl')->fetch();
|
||||
}
|
||||
|
||||
return '--';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -842,7 +842,9 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
$totalDepartures = Db::getInstance()->getValue(
|
||||
'SELECT COUNT(hbd.`id_room`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND ((hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.') OR
|
||||
(hbd.`check_in` != "0000:00:00 00:00:00" AND hbd.`check_out` != "0000:00:00 00:00:00"))
|
||||
AND hbd.`date_to` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
|
||||
HotelBranchInformation::addHotelRestriction($idHotel, 'hbd')
|
||||
);
|
||||
@@ -850,9 +852,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
$departed = Db::getInstance()->getValue(
|
||||
'SELECT COUNT(hbd.`id_room`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`date_to` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"
|
||||
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
|
||||
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.'
|
||||
AND hbd.`check_in` != "0000:00:00 00:00:00"'.
|
||||
HotelBranchInformation::addHotelRestriction($idHotel, 'hbd')
|
||||
);
|
||||
|
||||
@@ -900,7 +903,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
public static function getGuestsByDate($date, $idHotel = false)
|
||||
{
|
||||
return Db::getInstance()->getRow(
|
||||
'SELECT SUM(hbd.`adult`) AS `adults`, SUM(hbd.`children`) AS `children`
|
||||
'SELECT SUM(hbd.`adults`) AS `adults`, SUM(hbd.`children`) AS `children`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
|
||||
AND hbd.`date_from` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
|
||||
@@ -1136,6 +1139,87 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
);
|
||||
}
|
||||
|
||||
public static function getArrivalsInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`date_from` = "'.pSQL($date).' 00:00:00"
|
||||
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
|
||||
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getDeparturesInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`date_to` = "'.pSQL($date).' 00:00:00"
|
||||
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getInHousesInfo($idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getNewBookingsInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT hbd.`id_customer`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
COUNT(hbd.`id`) AS total_rooms, SUM(hbd.`adult` + hbd.`children`) AS total_guests,
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, hbd.`id_order`, o.`total_paid_tax_excl`, o.`id_currency`, osl.`name` AS `state_name`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
|
||||
ON (osl.`id_order_state` = o.`current_state` AND osl.`id_lang` = '.(int) Context::getContext()->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
|
||||
GROUP BY hbd.`id_order`';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getCancellationsInfoByDate($date, $idHotel = null)
|
||||
{
|
||||
$sql = 'SELECT orr.`id_order_return`, orr.`id_customer`, hbd.`room_num`, hbd.`id_product`, hbd.`room_type_name`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, SUM(hbd.`adult` + hbd.`children`) AS total_guests,
|
||||
hbd.`date_from`, hbd.`date_to`, orr.`id_order`
|
||||
FROM `'._DB_PREFIX_.'order_return` orr
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = orr.`id_order_return`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = orr.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = ord.`id_htl_booking`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = orr.`id_customer`)
|
||||
WHERE orr.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"
|
||||
AND orr.`state` = '.(int) OrderReturnState::ORDER_RETRUN_FIRST_STATUS.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
|
||||
GROUP BY ord.`id_htl_booking`
|
||||
ORDER BY orr.`date_add` DESC';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getOccupiedRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true)
|
||||
{
|
||||
$dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo;
|
||||
|
||||
@@ -506,7 +506,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->isFresh(Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, _TIME_1_DAY_)) {
|
||||
if (!Tools::isFresh(Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, Tools::addonsRequest('customer_themes'));
|
||||
}
|
||||
|
||||
|
||||
@@ -176,15 +176,16 @@ class CartControllerCore extends FrontController
|
||||
$result = $objCartBooking->deleteCartBookingData($id_cart, $id_product, 0, 0, 0, 0);
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product)) {
|
||||
if ($id_hotel = $roomTypeInfo['id_hotel']) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
if ($hotel_room_data = $obj_booking_dtl->DataForFrontSearch(
|
||||
$date_from,
|
||||
$date_to,
|
||||
$id_hotel,
|
||||
$id_product,
|
||||
1
|
||||
)) {
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$bookingParams = array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'hotel_id' => $id_hotel,
|
||||
'id_room_type' => $id_product,
|
||||
'only_search_data' => 1,
|
||||
);
|
||||
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
|
||||
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,11 +268,27 @@ class CartControllerCore extends FrontController
|
||||
$date_to = Tools::getValue('dateTo');
|
||||
$date_from = date("Y-m-d", strtotime($date_from));
|
||||
$date_to = date("Y-m-d", strtotime($date_to));
|
||||
$operator = Tools::getValue('op', 'up');
|
||||
|
||||
$occupancyRequiredForBooking = false;
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
|
||||
if ($occupancyRequiredForBooking) {
|
||||
if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) {
|
||||
$this->qty = count($occupancy);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Invalid occupnacy.');
|
||||
}
|
||||
} else {
|
||||
$occupancy = Tools::getValue('qty');
|
||||
$this->qty = $occupancy;
|
||||
}
|
||||
|
||||
$id_cart = $this->context->cart->id;
|
||||
$id_guest = $this->context->cart->id_guest;
|
||||
|
||||
|
||||
|
||||
if ($this->qty == 0) {
|
||||
$this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax'));
|
||||
} elseif (!$this->id_product) {
|
||||
@@ -284,71 +301,106 @@ class CartControllerCore extends FrontController
|
||||
return;
|
||||
}
|
||||
|
||||
$qty_to_check = $this->qty;
|
||||
$cart_products = $this->context->cart->getProducts();
|
||||
|
||||
// By Webkul : This code is to check available quantity of Room before adding it to cart.
|
||||
// only check availability if qty is increasing
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
$objRoomType = new HotelRoomType();
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
|
||||
if ($id_hotel = $roomTypeInfo['id_hotel']) {
|
||||
if (strtotime($date_from) < strtotime(date('Y-m-d'))) {
|
||||
$this->errors[] = Tools::displayError('You can\'t book room before current date');
|
||||
} elseif (strtotime($date_from) >= strtotime($date_to)) {
|
||||
$this->errors[] = Tools::displayError('Check-out date must be after check-in date');
|
||||
} elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) {
|
||||
// Check Order restrict condition before adding in to cart
|
||||
if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from)
|
||||
|| strtotime($maxOrdDate) < strtotime($date_to)
|
||||
) {
|
||||
$maxOrdDate = date('d-m-Y', strtotime($maxOrdDate));
|
||||
$this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate);
|
||||
}
|
||||
// valdiate occupancy if providede
|
||||
if ($operator == 'up') {
|
||||
if ($occupancyRequiredForBooking) {
|
||||
foreach($occupancy as $key => $roomOccupancy) {
|
||||
if (!isset($roomOccupancy['adults']) || !$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1));
|
||||
}
|
||||
if (isset($roomOccupancy['children'])) {
|
||||
if (!Validate::isUnsignedInt($roomOccupancy['children'])) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1));
|
||||
}
|
||||
if (!$this->errors) {
|
||||
$objBookingDtl = new HotelBookingDetail();
|
||||
$num_days = $objBookingDtl->getNumberOfDays($date_from, $date_to);
|
||||
$req_rm = $this->qty;
|
||||
$this->qty = $this->qty * (int) $num_days;
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
if ($hotel_room_data = $obj_booking_dtl->DataForFrontSearch(
|
||||
$date_from,
|
||||
$date_to,
|
||||
$id_hotel,
|
||||
$this->id_product,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
$id_cart,
|
||||
$id_guest
|
||||
)) {
|
||||
if (isset($hotel_room_data['stats']['num_avail'])) {
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
if (Tools::getValue('op', 'up') == 'up') {
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
if ($roomOccupancy['children'] > 0) {
|
||||
if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages'])) || !is_array($roomOccupancy['child_ages'])) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1));
|
||||
} else {
|
||||
if (is_array($roomOccupancy['child_ages'])) {
|
||||
foreach($roomOccupancy['child_ages'] as $childAge) {
|
||||
if (!Validate::isUnsignedInt($childAge)) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// By Webkul : This code is to check available quantity of Room before adding it to cart.
|
||||
// only check availability if qty is increasing
|
||||
if (!$this->errors) {
|
||||
$objRoomType = new HotelRoomType();
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
|
||||
if ($id_hotel = $roomTypeInfo['id_hotel']) {
|
||||
if (strtotime($date_from) < strtotime(date('Y-m-d'))) {
|
||||
$this->errors[] = Tools::displayError('You can\'t book room before current date');
|
||||
} elseif (strtotime($date_from) >= strtotime($date_to)) {
|
||||
$this->errors[] = Tools::displayError('Check-out date must be after check-in date');
|
||||
} elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) {
|
||||
// Check Order restrict condition before adding in to cart
|
||||
if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from)
|
||||
|| strtotime($maxOrdDate) < strtotime($date_to)
|
||||
) {
|
||||
$maxOrdDate = date('d-m-Y', strtotime($maxOrdDate));
|
||||
$this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate);
|
||||
}
|
||||
}
|
||||
if ($occupancyRequiredForBooking) {
|
||||
foreach($occupancy as $key => $roomOccupancy) {
|
||||
if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']);
|
||||
}
|
||||
if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']);
|
||||
}
|
||||
if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$this->errors) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to);
|
||||
$req_rm = $this->qty;
|
||||
$this->qty = $this->qty * (int) $num_days;
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$bookingParams = array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'hotel_id' => $id_hotel,
|
||||
'id_room_type' => $this->id_product,
|
||||
'only_search_data' => 1,
|
||||
'id_cart' => $id_cart,
|
||||
'id_guest' => $id_guest,
|
||||
);
|
||||
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
|
||||
if (isset($hotelRoomData['stats']['num_avail'])) {
|
||||
$total_available_rooms = $hotelRoomData['stats']['num_avail'];
|
||||
if (Tools::getValue('op', 'up') == 'up') {
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
|
||||
}
|
||||
} else {
|
||||
die(json_encode(array('status' => 'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(json_encode(array('status' => 'failed4')));
|
||||
die(json_encode(array('status' => 'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(json_encode(array('status' => 'failed4')));
|
||||
}
|
||||
}
|
||||
|
||||
$cart_products = $this->context->cart->getProducts();
|
||||
$qty_to_check = $this->qty;
|
||||
if (is_array($cart_products)) {
|
||||
foreach ($cart_products as $cart_product) {
|
||||
if ((!isset($this->id_product_attribute) || $cart_product['id_product_attribute'] == $this->id_product_attribute) &&
|
||||
@@ -411,54 +463,37 @@ class CartControllerCore extends FrontController
|
||||
/*
|
||||
* To add Rooms in hotel cart
|
||||
*/
|
||||
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
|
||||
if (Tools::getValue('op', 'up') == 'up') {
|
||||
$update_quantity = $this->context->cart->updateQty($this->qty, $this->id_product, $this->id_product_attribute, $this->customization_id, Tools::getValue('op', 'up'), $this->id_address_delivery);
|
||||
$this->availQty = false;
|
||||
$id_customer = $this->context->cart->id_customer;
|
||||
$id_currency = $this->context->cart->id_currency;
|
||||
|
||||
$hotel_room_info_arr = $hotel_room_data['rm_data'][0]['data']['available'];
|
||||
$chkQty = 0;
|
||||
foreach ($hotel_room_info_arr as $key_hotel_room_info => $val_hotel_room_info) {
|
||||
if ($chkQty < $req_rm) {
|
||||
$roomDemand = Tools::getValue('roomDemands');
|
||||
$roomDemand = json_decode($roomDemand, true);
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
$obj_htl_cart_booking_data = new HotelCartBookingData();
|
||||
$obj_htl_cart_booking_data->id_cart = $this->context->cart->id;
|
||||
$obj_htl_cart_booking_data->id_guest = $this->context->cart->id_guest;
|
||||
$obj_htl_cart_booking_data->id_customer = $id_customer;
|
||||
$obj_htl_cart_booking_data->id_currency = $id_currency;
|
||||
$obj_htl_cart_booking_data->id_product = $val_hotel_room_info['id_product'];
|
||||
$obj_htl_cart_booking_data->id_room = $val_hotel_room_info['id_room'];
|
||||
$obj_htl_cart_booking_data->id_hotel = $val_hotel_room_info['id_hotel'];
|
||||
$obj_htl_cart_booking_data->booking_type = HotelBookingDetail::ALLOTMENT_AUTO;
|
||||
$obj_htl_cart_booking_data->quantity = $num_days;
|
||||
$obj_htl_cart_booking_data->extra_demands = $roomDemand;
|
||||
$obj_htl_cart_booking_data->date_from = $date_from;
|
||||
$obj_htl_cart_booking_data->date_to = $date_to;
|
||||
$obj_htl_cart_booking_data->save();
|
||||
++$chkQty;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->availQty = $total_available_rooms - $req_rm;
|
||||
} else {
|
||||
$objCartBooking = new HotelCartBookingData();
|
||||
$update_quantity = $objCartBooking->deleteCartBookingData(
|
||||
$id_cart,
|
||||
$this->id_product,
|
||||
0,
|
||||
$date_from,
|
||||
$date_to
|
||||
);
|
||||
$this->availQty = $total_available_rooms + $req_rm;
|
||||
|
||||
}
|
||||
$this->context->cookie->avail_rooms = $this->availQty;
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$roomDemand = json_decode(Tools::getValue('roomDemands'), true);
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
$this->availQty = $total_available_rooms;
|
||||
$update_quantity = $objHotelCartBookingData->updateRoomCartBookingData(
|
||||
$this->id_product,
|
||||
$occupancy,
|
||||
$operator,
|
||||
$id_hotel,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$roomDemand,
|
||||
$id_cart,
|
||||
$id_guest
|
||||
);
|
||||
if ($operator == 'up') {
|
||||
$this->availQty = $total_available_rooms - $req_rm;
|
||||
$this->context->cookie->currentAddedProduct = json_encode(array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'id_product' => $this->id_product,
|
||||
'occupancy' => $occupancy,
|
||||
'room_demand' => $roomDemand,
|
||||
'req_rm' => $req_rm
|
||||
));
|
||||
} else {
|
||||
$this->availQty = $total_available_rooms + $req_rm;
|
||||
}
|
||||
$this->context->cookie->avail_rooms = $this->availQty;
|
||||
|
||||
/*------ BY Webkul ------*/
|
||||
|
||||
if ($update_quantity < 0) {
|
||||
|
||||
@@ -57,6 +57,9 @@ 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');
|
||||
@@ -99,11 +102,15 @@ class CategoryControllerCore extends FrontController
|
||||
$dateFrom = Tools::getValue('date_from');
|
||||
$dateTo = Tools::getValue('date_to');
|
||||
|
||||
if ($dateFrom != '' && !Validate::isDate($dateFrom)) {
|
||||
$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 != '' && !Validate::isDate($dateTo)) {
|
||||
if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
|
||||
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
|
||||
}
|
||||
|
||||
@@ -150,6 +157,9 @@ class CategoryControllerCore extends FrontController
|
||||
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
|
||||
}
|
||||
|
||||
// get occupancy of the search
|
||||
$occupancy = Tools::getValue('occupancy');
|
||||
|
||||
$currency = new Currency($this->context->currency->id);
|
||||
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
@@ -160,8 +170,18 @@ class CategoryControllerCore extends FrontController
|
||||
$id_cart = $this->context->cart->id;
|
||||
$id_guest = $this->context->cookie->id_guest;
|
||||
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$booking_data = $obj_booking_dtl->DataForFrontSearch($date_from, $date_to, $id_hotel, 0, 0, 0, 0, -1, 0, 0, $id_cart, $id_guest);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$bookingParams = array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'occupancy' => $occupancy,
|
||||
'hotel_id' => $id_hotel,
|
||||
'get_total_rooms' => 0,
|
||||
'id_cart' => $id_cart,
|
||||
'id_guest' => $id_guest,
|
||||
);
|
||||
|
||||
$booking_data = $objBookingDetail->dataForFrontSearch($bookingParams);
|
||||
|
||||
$feat_img_dir = _PS_IMG_.'rf/';
|
||||
$ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png';
|
||||
@@ -239,21 +259,24 @@ class CategoryControllerCore extends FrontController
|
||||
$date_to = Tools::getValue('date_to');
|
||||
$htl_id_category = Tools::getValue('id_category');
|
||||
|
||||
// occupancy of the search
|
||||
$occupancy = Tools::getValue('occupancy');
|
||||
|
||||
$sort_by = Tools::getValue('sort_by');
|
||||
$sort_value = Tools::getValue('sort_value');
|
||||
$filter_data = Tools::getValue('filter_data');
|
||||
|
||||
$adult = 0;
|
||||
$child = 0;
|
||||
$adults = 0;
|
||||
$children = 0;
|
||||
$amenities = 0;
|
||||
$price = 0;
|
||||
|
||||
if (!empty($filter_data)) {
|
||||
foreach ($filter_data as $key => $value) {
|
||||
if ($key == 'adult') {
|
||||
$adult = min($value);
|
||||
if ($key == 'adults') {
|
||||
$adults = min($value);
|
||||
} elseif ($key == 'children') {
|
||||
$child = min($value);
|
||||
$children = min($value);
|
||||
} elseif ($key == 'amenities') {
|
||||
$amenities = array();
|
||||
foreach ($value as $a_k => $a_v) {
|
||||
@@ -272,11 +295,21 @@ class CategoryControllerCore extends FrontController
|
||||
|
||||
$id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category);
|
||||
|
||||
$id_cart = $this->context->cart->id;
|
||||
$id_guest = $this->context->cookie->id_guest;
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$booking_data = $obj_booking_dtl->DataForFrontSearch($date_from, $date_to, $id_hotel, 0, 0, $adult, $child, -1, $amenities, $price, $id_cart, $id_guest);
|
||||
$bookingParams = array(
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'hotel_id' => $id_hotel,
|
||||
'occupancy' => $occupancy,
|
||||
'amenities' => $amenities,
|
||||
'price' => $price,
|
||||
'get_total_rooms' => 0,
|
||||
'id_cart' => $this->context->cart->id,
|
||||
'id_guest' => $this->context->cookie->id_guest,
|
||||
);
|
||||
|
||||
$booking_data = $objBookingDetail->dataForFrontSearch($bookingParams);
|
||||
// reset array keys from 0
|
||||
$booking_data['rm_data'] = array_values($booking_data['rm_data']);
|
||||
if ($sort_by && $sort_value) {
|
||||
|
||||
@@ -250,7 +250,7 @@ class GuestTrackingControllerCore extends FrontController
|
||||
|
||||
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cartHotelData[$type_key]['cover_img'] = $cover_img;
|
||||
$cartHotelData[$type_key]['adult'] = $rm_dtl['adult'];
|
||||
$cartHotelData[$type_key]['adults'] = $rm_dtl['adults'];
|
||||
$cartHotelData[$type_key]['children'] = $rm_dtl['children'];
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
|
||||
@@ -155,8 +155,9 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
|
||||
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
|
||||
$cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
|
||||
$cart_htl_data[$type_key]['adults'] = $rm_dtl['adults'];
|
||||
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
|
||||
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
/*Product price when order was created*/
|
||||
@@ -176,6 +177,9 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
|
||||
$var_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'];
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
|
||||
|
||||
//// By webkul New way to calculate product prices with feature Prices
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
@@ -195,6 +199,10 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
|
||||
// By webkul New way to calculate product prices with feature Prices
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
|
||||
@@ -246,7 +246,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(OrderReturnState::ORDER_RETRUN_FIRST_STATUS, $objOrderReturn->id);
|
||||
$objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING'));
|
||||
|
||||
die(json_encode(array('status' => 1)));
|
||||
}
|
||||
@@ -321,8 +321,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
$rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($type_value['product_id']);
|
||||
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cartHotelData[$type_key]['cover_img'] = $cover_img;
|
||||
$cartHotelData[$type_key]['adult'] = $rm_dtl['adult'];
|
||||
$cartHotelData[$type_key]['children'] = $rm_dtl['children'];
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
@@ -339,6 +337,9 @@ class OrderDetailControllerCore extends FrontController
|
||||
|
||||
$num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'];
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'];
|
||||
@@ -355,6 +356,8 @@ class OrderDetailControllerCore extends FrontController
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
|
||||
@@ -428,7 +431,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
|
||||
$redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'id_cms_refund_policy' => Configuration::get('WK_GLOBAL_REFUND_POLICY_CMS'),
|
||||
|
||||
@@ -53,4 +53,34 @@ class OrderSlipControllerCore extends FrontController
|
||||
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)$this->context->cookie->id_customer));
|
||||
$this->setTemplate(_PS_THEME_DIR_.'order-slip.tpl');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('generateVoucher')) {
|
||||
$idOrderSlip = Tools::getValue('id_order_slip');
|
||||
$objOrderSlip = new OrderSlip($idOrderSlip);
|
||||
if (!Validate::isLoadedObject($objOrderSlip)) {
|
||||
$this->errors[] = Tools::displayError('The credit slip is invalid.');
|
||||
} elseif ($objOrderSlip->redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED) {
|
||||
$this->errors[] = Tools::displayError('The credit slip has already been redeemed.');
|
||||
} elseif ($objOrderSlip->id_customer != $this->context->customer->id) {
|
||||
$this->errors[] = Tools::displayError('Invalid request.');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($objOrderSlip->generateVoucher()) {
|
||||
Tools::redirect($this->context->link->getPageLink(
|
||||
$this->php_self,
|
||||
$this->ssl,
|
||||
$this->context->language->id,
|
||||
'confirmation=1'
|
||||
));
|
||||
}
|
||||
|
||||
$this->errors[] = Tools::displayError('The voucher code for this credit slip could not be generated.');
|
||||
}
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +182,9 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
// order status payment accepted if no amount is pending for the booking
|
||||
if ($dueAmount > 0) {
|
||||
$orderStatus = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
|
||||
$orderStatus = Configuration::get('PS_OS_AWAITING_PAYMENT');
|
||||
} else {
|
||||
$orderStatus = Configuration::get('PS_OS_PAYMENT');
|
||||
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
|
||||
}
|
||||
|
||||
$order->validateOrder($this->context->cart->id, $orderStatus, 0, Tools::displayError('Free order', false), null, array(), null, false, $this->context->cart->secure_key);
|
||||
|
||||
@@ -46,10 +46,10 @@ class ProductControllerCore extends FrontController
|
||||
$this->addCSS(_THEME_CSS_DIR_.'product.css');
|
||||
$this->addCSS(_THEME_CSS_DIR_.'print.css', 'print');
|
||||
$this->addJqueryPlugin(array('fancybox', 'idTabs', 'scrollTo', 'serialScroll', 'bxslider'));
|
||||
$this->addCSS(_THEME_CSS_DIR_.'datepicker.css');
|
||||
|
||||
$this->addJS(array(
|
||||
_THEME_JS_DIR_.'tools.js', // retro compat themes 1.5
|
||||
_THEME_JS_DIR_.'product.js'
|
||||
_THEME_JS_DIR_.'product.js',
|
||||
));
|
||||
} else {
|
||||
$this->addJqueryPlugin(array('scrollTo', 'serialScroll'));
|
||||
@@ -60,6 +60,9 @@ class ProductControllerCore extends FrontController
|
||||
));
|
||||
}
|
||||
|
||||
$this->addCSS(_THEME_CSS_DIR_.'occupancy.css');
|
||||
$this->addJS(_THEME_JS_DIR_.'occupancy.js');
|
||||
|
||||
if (Configuration::get('PS_DISPLAY_JQZOOM') == 1) {
|
||||
$this->addJqueryPlugin('jqzoom');
|
||||
}
|
||||
@@ -92,11 +95,15 @@ class ProductControllerCore extends FrontController
|
||||
$dateFrom = Tools::getValue('date_from');
|
||||
$dateTo = Tools::getValue('date_to');
|
||||
|
||||
if ($dateFrom != '' && !Validate::isDate($dateFrom)) {
|
||||
$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 != '' && !Validate::isDate($dateTo)) {
|
||||
if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
|
||||
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
|
||||
}
|
||||
|
||||
@@ -287,7 +294,7 @@ class ProductControllerCore extends FrontController
|
||||
$obj_hotel_room_type = new HotelRoomType();
|
||||
$room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id);
|
||||
$productCapacity = array();
|
||||
$productCapacity['adult'] = $room_info_by_product_id['adult'];
|
||||
$productCapacity['adults'] = $room_info_by_product_id['adults'];
|
||||
$productCapacity['children'] = $room_info_by_product_id['children'];
|
||||
$this->product->capacity = $productCapacity;
|
||||
$hotel_id = $room_info_by_product_id['id_hotel'];
|
||||
@@ -359,6 +366,7 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'room_type_info' => $room_info_by_product_id,
|
||||
'isHotelRefundable' => $hotel_branch_obj->isRefundable(),
|
||||
'max_order_date' => $max_order_date,
|
||||
'preparation_time' => $preparationTime,
|
||||
@@ -471,7 +479,7 @@ class ProductControllerCore extends FrontController
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$quantity = 1,
|
||||
$occupancy = array(),
|
||||
$jsonDemands = ''
|
||||
) {
|
||||
$objProduct = new Product($idProduct, true, $this->context->language->id, $this->context->shop->id);
|
||||
@@ -509,23 +517,27 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
|
||||
$numDays = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
|
||||
|
||||
$hotelRoomData = $objBookingDetail->DataForFrontSearch(
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$idHotel,
|
||||
$idProduct,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
$idCart,
|
||||
$idGuest
|
||||
$bookingParams = array(
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'hotel_id' => $idHotel,
|
||||
'id_room_type' => $idProduct,
|
||||
'id_cart' => $idCart,
|
||||
'id_guest' => $idGuest,
|
||||
);
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$bookingParams['occupancy'] = $occupancy;
|
||||
$quantity = count($occupancy);
|
||||
} else {
|
||||
// when room selection is done using qty, occupancy parameter will contain the number of rooms.
|
||||
$quantity = $occupancy;
|
||||
}
|
||||
|
||||
if ($hotelRoomData) {
|
||||
if ($quantity <= 0) {
|
||||
$quantity = 1;
|
||||
}
|
||||
|
||||
if ($hotelRoomData = $objBookingDetail->DataForFrontSearch($bookingParams)) {
|
||||
$totalAvailableRooms = $hotelRoomData['stats']['num_avail'];
|
||||
$quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity;
|
||||
}
|
||||
@@ -580,6 +592,13 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
// calculate total price
|
||||
$totalPrice = $totalRoomPrice + $demandsPrice;
|
||||
// send occupancy information searched by the user
|
||||
if ($this->ajax && $occupancy && is_array($occupancy)) {
|
||||
$smartyVars['occupancies'] = $occupancy;
|
||||
$smartyVars['occupancy_adults'] = array_sum(array_column($occupancy, 'adults'));
|
||||
$smartyVars['occupancy_children'] = array_sum(array_column($occupancy, 'children'));
|
||||
$smartyVars['occupancy_child_ages'] = array_sum(array_column($occupancy, 'child_ages'));
|
||||
}
|
||||
|
||||
$smartyVars['hotel_location'] = $hotelLocation;
|
||||
$smartyVars['order_date_restrict'] = $orderDateRestrict;
|
||||
@@ -1070,7 +1089,7 @@ class ProductControllerCore extends FrontController
|
||||
$idProduct = (int) Tools::getValue('id_product');
|
||||
$dateFrom = Tools::getValue('date_from');
|
||||
$dateTo = Tools::getValue('date_to');
|
||||
$quantity = (int) Tools::getValue('quantity');
|
||||
$occupancy = Tools::getValue('occupancy');
|
||||
$roomTypeDemands = Tools::getValue('room_type_demands');
|
||||
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
@@ -1080,7 +1099,7 @@ class ProductControllerCore extends FrontController
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$quantity,
|
||||
$occupancy,
|
||||
$roomTypeDemands
|
||||
)) {
|
||||
$html = $this->context->smarty->fetch('_partials/booking-form.tpl');
|
||||
@@ -1091,102 +1110,6 @@ class ProductControllerCore extends FrontController
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function displayAjaxCheckRoomAvailabilityAndRate()
|
||||
{
|
||||
$result = array();
|
||||
if ($idProduct = Tools::getValue('id_product')) {
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($idProduct)) {
|
||||
$dateFrom = Tools::getValue('date_from');
|
||||
$dateTo = Tools::getValue('date_to');
|
||||
$quantity = Tools::getValue('qty');
|
||||
if ($idHotel = $roomTypeInfo['id_hotel']) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($hotelRoomData = $objBookingDetail->DataForFrontSearch(
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$idHotel,
|
||||
$idProduct,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest
|
||||
)) {
|
||||
$totalAvailRooms = $hotelRoomData['stats']['num_avail'];
|
||||
if ($totalAvailRooms >= $quantity) {
|
||||
$totalPrice = 0;
|
||||
$useTax = HotelBookingDetail::useTax();
|
||||
$product = new Product($idProduct);
|
||||
$productPriceWithoutReduction = $product->getPriceWithoutReduct(!$useTax);
|
||||
$numDays = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
|
||||
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo
|
||||
);
|
||||
if ($useTax) {
|
||||
$priceProduct = Product::getPriceStatic($idProduct, true);
|
||||
$featurePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($idProduct, $dateFrom, $dateTo, true);
|
||||
$roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_incl'];
|
||||
} else {
|
||||
$priceProduct = Product::getPriceStatic($idProduct, false);
|
||||
$featurePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($idProduct, $dateFrom, $dateTo, false);
|
||||
$roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_excl'];
|
||||
}
|
||||
$featurePriceDiff = (float)($productPriceWithoutReduction - $featurePrice);
|
||||
|
||||
//$price_tax_incl = Product::getPriceStatic($idProduct, $price_tax);
|
||||
$totalRoomPrice = $roomTypeDateRangePrice * $quantity;
|
||||
$totalPrice += $totalRoomPrice;
|
||||
$demandsPrice = 0;
|
||||
if ($roomDemand = Tools::getValue('room_demands')) {
|
||||
if ($roomDemand = json_decode($roomDemand, true)) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$demandsPrice = $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$idProduct,
|
||||
$roomDemand,
|
||||
$useTax,
|
||||
$dateFrom,
|
||||
$dateTo
|
||||
);
|
||||
$demandsPrice *= $quantity;
|
||||
$totalPrice += $demandsPrice;
|
||||
}
|
||||
}
|
||||
$result['msg'] = 'success';
|
||||
$result['quantity'] = (int)$quantity;
|
||||
$result['total_price'] = $totalPrice;
|
||||
$result['total_room_price'] = $totalRoomPrice;
|
||||
$result['extra_demand_price'] = $demandsPrice;
|
||||
$result['num_days'] = $numDays;
|
||||
$result['avail_rooms'] = $totalAvailRooms;
|
||||
$result['original_product_price'] = $priceProduct;
|
||||
$result['feature_price'] = $featurePrice;
|
||||
$result['feature_price_diff'] = $featurePriceDiff;
|
||||
} else {
|
||||
$result['msg'] = 'unavailable_quantity';
|
||||
$result['avail_rooms'] = $totalAvailRooms;
|
||||
}
|
||||
} else {
|
||||
$result['msg'] = 'failed1';
|
||||
$result['avail_rooms'] = $totalAvailRooms;
|
||||
}
|
||||
} else {
|
||||
$result['msg'] = 'failed2';
|
||||
$result['avail_rooms'] = $totalAvailRooms;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result['msg'] = 'failed3';
|
||||
$result['avail_rooms'] = 0;
|
||||
}
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
public function displayAjaxGetHotelImages()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
|
||||
@@ -1132,6 +1132,7 @@ CREATE TABLE `PREFIX_orders` (
|
||||
`current_state` int(10) unsigned NOT NULL,
|
||||
`secure_key` varchar(32) NOT NULL DEFAULT '-1',
|
||||
`payment` varchar(255) NOT NULL,
|
||||
`payment_type` tinyint(10) UNSIGNED NOT NULL,
|
||||
`conversion_rate` decimal(13,6) NOT NULL DEFAULT 1,
|
||||
`module` varchar(255) DEFAULT NULL,
|
||||
`recyclable` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
@@ -1165,6 +1166,7 @@ CREATE TABLE `PREFIX_orders` (
|
||||
`valid` int(1) unsigned NOT NULL DEFAULT '0',
|
||||
`is_advance_payment` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`advance_paid_amount` decimal(20,6) NOT NULL DEFAULT '0.00',
|
||||
`with_occupancy` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_order`),
|
||||
@@ -1329,6 +1331,8 @@ CREATE TABLE `PREFIX_order_return` (
|
||||
`refunded_amount` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`question` text NOT NULL,
|
||||
`by_admin` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`id_return_type` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`return_type` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_order_return`),
|
||||
@@ -1383,6 +1387,8 @@ CREATE TABLE `PREFIX_order_slip` (
|
||||
`amount` DECIMAL(10,2) NOT NULL,
|
||||
`shipping_cost_amount` DECIMAL(10,2) NOT NULL,
|
||||
`partial` TINYINT(1) NOT NULL,
|
||||
`redeem_status` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`id_cart_rule` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`order_slip_type` TINYINT(1) unsigned NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
@@ -1472,6 +1478,7 @@ CREATE TABLE `PREFIX_order_payment` (
|
||||
`id_currency` INT UNSIGNED NOT NULL,
|
||||
`amount` DECIMAL(10,2) NOT NULL,
|
||||
`payment_method` varchar(255) NOT NULL,
|
||||
`payment_type` INT UNSIGNED NOT NULL,
|
||||
`conversion_rate` decimal(13,6) NOT NULL DEFAULT 1,
|
||||
`transaction_id` VARCHAR(254) NULL,
|
||||
`card_number` VARCHAR(254) NULL,
|
||||
|
||||
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 356 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
install/data/img/os/Awaiting_payment.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
BIN
install/data/img/os/Overbooking_paid.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
install/data/img/os/Overbooking_unpaid.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
BIN
install/data/img/os/Processing_in_progress.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 356 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 390 B |
|
Before Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -383,13 +383,13 @@
|
||||
<configuration id="PS_BACKUP_DROP_TABLE" name="PS_BACKUP_DROP_TABLE">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_CHEQUE" name="PS_OS_CHEQUE">
|
||||
<configuration id="PS_OS_AWAITING_PAYMENT" name="PS_OS_AWAITING_PAYMENT">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_PAYMENT" name="PS_OS_PAYMENT">
|
||||
<configuration id="PS_OS_PAYMENT_ACCEPTED" name="PS_OS_PAYMENT_ACCEPTED">
|
||||
<value>2</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_PREPARATION" name="PS_OS_PREPARATION">
|
||||
<configuration id="PS_OS_PROCESSING" name="PS_OS_PROCESSING">
|
||||
<value>3</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_CANCELED" name="PS_OS_CANCELED">
|
||||
@@ -404,29 +404,47 @@
|
||||
<configuration id="PS_OS_OUTOFSTOCK" name="PS_OS_OUTOFSTOCK">
|
||||
<value>7</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_BANKWIRE" name="PS_OS_BANKWIRE">
|
||||
<configuration id="PS_OS_OUTOFSTOCK_PAID" name="PS_OS_OUTOFSTOCK_PAID">
|
||||
<value>7</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_OVERBOOKING_PAID" name="PS_OS_OVERBOOKING_PAID">
|
||||
<value>7</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_PARTIAL_PAYMENT_ACCEPTED" name="PS_OS_PARTIAL_PAYMENT_ACCEPTED">
|
||||
<value>8</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_PAYPAL" name="PS_OS_PAYPAL">
|
||||
<!-- <configuration id="PS_OS_BANKWIRE" name="PS_OS_BANKWIRE">
|
||||
<value>8</value>
|
||||
</configuration> -->
|
||||
<!-- <configuration id="PS_OS_PAYPAL" name="PS_OS_PAYPAL">
|
||||
<value>9</value>
|
||||
</configuration> -->
|
||||
<configuration id="PS_OS_AWAITING_REMOTE_PAYMENT" name="PS_OS_AWAITING_REMOTE_PAYMENT">
|
||||
<value>9</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_WS_PAYMENT" name="PS_OS_WS_PAYMENT">
|
||||
<value>10</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_OUTOFSTOCK_PAID" name="PS_OS_OUTOFSTOCK_PAID">
|
||||
<value>7</value>
|
||||
<configuration id="PS_OS_REMOTE_PAYMENT_ACCEPTED" name="PS_OS_REMOTE_PAYMENT_ACCEPTED">
|
||||
<value>10</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_OUTOFSTOCK_UNPAID" name="PS_OS_OUTOFSTOCK_UNPAID">
|
||||
<value>11</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_AWAITING_REMOTE_PAYMENT" name="PS_OS_AWAITING_REMOTE_PAYMENT">
|
||||
<value>12</value>
|
||||
<configuration id="PS_OS_OVERBOOKING_UNPAID" name="PS_OS_OVERBOOKING_UNPAID">
|
||||
<value>11</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_AWAITING_PARTIAL_PAYMENT" name="PS_OS_AWAITING_PARTIAL_PAYMENT">
|
||||
<!-- <configuration id="PS_OS_AWAITING_PARTIAL_PAYMENT" name="PS_OS_AWAITING_PARTIAL_PAYMENT">
|
||||
<value>13</value>
|
||||
</configuration> -->
|
||||
<configuration id="PS_ORS_PENDING" name="PS_ORS_PENDING">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="PS_OS_PARTIAL_PAYMENT" name="PS_OS_PARTIAL_PAYMENT">
|
||||
<value>14</value>
|
||||
<configuration id="PS_ORS_DENIED" name="PS_ORS_DENIED">
|
||||
<value>2</value>
|
||||
</configuration>
|
||||
<configuration id="PS_ORS_REFUNDED" name="PS_ORS_REFUNDED">
|
||||
<value>3</value>
|
||||
</configuration>
|
||||
<configuration id="PS_LEGACY_IMAGES" name="PS_LEGACY_IMAGES">
|
||||
<value>0</value>
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<field name="color"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<order_return_state id="Waiting_for_confirmation" color="#4169E1" send_email_to_customer="1" send_email_to_superadmin="1" send_email_to_employee="1" send_email_to_hotelier="1" denied="0" refunded="0"/>
|
||||
<order_return_state id="Request_received" color="#32CD32" send_email_to_customer="1" send_email_to_superadmin="1" send_email_to_employee="1" send_email_to_hotelier="1" denied="0" refunded="0"/>
|
||||
<order_return_state id="Pending" color="#4169E1" send_email_to_customer="1" send_email_to_superadmin="1" send_email_to_employee="1" send_email_to_hotelier="1" denied="0" refunded="0"/>
|
||||
<order_return_state id="Refund_denied" color="#DC143C" send_email_to_customer="1" send_email_to_superadmin="1" send_email_to_employee="1" send_email_to_hotelier="1" denied="1" refunded="0"/>
|
||||
<order_return_state id="Refund_completed" color="#108510" send_email_to_customer="1" send_email_to_superadmin="1" send_email_to_employee="1" send_email_to_hotelier="1" denied="0" refunded="1"/>
|
||||
</entities>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<fields id="name" class="OrderState" image="os">
|
||||
<field name="invoice"/>
|
||||
<field name="send_email"/>
|
||||
<field name="module_name"/>
|
||||
<field name="color"/>
|
||||
<field name="unremovable"/>
|
||||
<field name="hidden"/>
|
||||
@@ -15,47 +14,27 @@
|
||||
<field name="pdf_invoice"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<order_state id="Awaiting_cheque_payment" invoice="0" send_email="1" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name>cheque</module_name>
|
||||
<order_state id="Awaiting_payment" invoice="0" send_email="1" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
<order_state id="Payment_accepted" invoice="1" send_email="1" color="#32CD32" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="1">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="Preparation_in_progress" invoice="1" send_email="1" color="#FF8C00" unremovable="1" hidden="0" logable="1" delivery="1" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
<order_state id="Processing_in_progress" invoice="1" send_email="1" color="#FF8C00" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
<order_state id="Canceled" invoice="0" send_email="1" color="#DC143C" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="Refund" invoice="1" send_email="1" color="#ec2e15" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="Payment_error" invoice="0" send_email="1" color="#8f0621" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_paid" invoice="1" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
<order_state id="Overbooking_paid" invoice="1" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
<order_state id="Awaiting_bank_wire_payment" invoice="0" send_email="1" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name>bankwire</module_name>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_PayPal_payment" invoice="0" send_email="0" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="Payment_remotely_accepted" invoice="1" send_email="1" color="#32CD32" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="1" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_unpaid" invoice="0" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
<order_state id="Partial_payment_accepted" invoice="1" send_email="1" color="#F0B656" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
<order_state id="Awaiting_remote_payment" invoice="0" send_email="0" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_partial_payment" invoice="0" send_email="0" color="#4169E1" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
<order_state id="Payment_remotely_accepted" invoice="1" send_email="0" color="#32CD32" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted" invoice="1" send_email="0" color="#9dffa9" unremovable="1" hidden="0" logable="1" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
<module_name/>
|
||||
<order_state id="Overbooking_unpaid" invoice="0" send_email="1" color="#FF69B4" unremovable="1" hidden="0" logable="0" delivery="0" shipped="0" paid="0" pdf_delivery="0" pdf_invoice="0">
|
||||
</order_state>
|
||||
</entities>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_return_state>
|
||||
<order_return_state id="Waiting_for_confirmation">
|
||||
<name>Waiting for confirmation</name>
|
||||
<customer_template>order_refund_waiting_customer</customer_template>
|
||||
<admin_template>order_refund_waiting_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Request_received">
|
||||
<name>Request received</name>
|
||||
<customer_template>order_refund_received_customer</customer_template>
|
||||
<admin_template>order_refund_received_admin</admin_template>
|
||||
<order_return_state id="Pending">
|
||||
<name>Pending</name>
|
||||
<customer_template>order_refund_pending_customer</customer_template>
|
||||
<admin_template>order_refund_pending_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Refund_denied">
|
||||
<name>Refund denied</name>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_state>
|
||||
<order_state id="Awaiting_cheque_payment">
|
||||
<name>Awaiting check payment</name>
|
||||
<template>cheque</template>
|
||||
<order_state id="Awaiting_payment">
|
||||
<name>Awaiting payment</name>
|
||||
<template>awaiting_payment</template>
|
||||
</order_state>
|
||||
<order_state id="Payment_accepted">
|
||||
<name>Payment accepted</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Preparation_in_progress">
|
||||
<order_state id="Processing_in_progress">
|
||||
<name>Processing in progress</name>
|
||||
<template>preparation</template>
|
||||
<template>processing</template>
|
||||
</order_state>
|
||||
<order_state id="Canceled">
|
||||
<name>Canceled</name>
|
||||
@@ -24,36 +24,24 @@
|
||||
<name>Payment error</name>
|
||||
<template>payment_error</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_paid">
|
||||
<name>On backorder (paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_unpaid">
|
||||
<name>On backorder (not paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_bank_wire_payment">
|
||||
<name>Awaiting bank wire payment</name>
|
||||
<template>bankwire</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_PayPal_payment">
|
||||
<name>Awaiting PayPal payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Payment_remotely_accepted">
|
||||
<name>Remote payment accepted</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_remote_payment">
|
||||
<name>Awaiting remote payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_partial_payment">
|
||||
<name>Awaiting partial payment</name>
|
||||
<order_state id="Overbooking_paid">
|
||||
<name>Overbooking (paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Overbooking_unpaid">
|
||||
<name>Overbooking (not paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template/>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_return_state>
|
||||
<order_return_state id="Waiting_for_confirmation">
|
||||
<name>Waiting for confirmation</name>
|
||||
<customer_template>order_refund_waiting_customer</customer_template>
|
||||
<admin_template>order_refund_waiting_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Request_received">
|
||||
<name>Request received</name>
|
||||
<customer_template>order_refund_received_customer</customer_template>
|
||||
<admin_template>order_refund_received_admin</admin_template>
|
||||
<order_return_state id="Pending">
|
||||
<name>Pending</name>
|
||||
<customer_template>order_refund_pending_customer</customer_template>
|
||||
<admin_template>order_refund_pending_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Refund_denied">
|
||||
<name>Refund denied</name>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version='1.0'?>
|
||||
<entity_order_state>
|
||||
<order_state id='Awaiting_cheque_payment'>
|
||||
<name>অপেক্ষমান চেক পেমেন্ট</name>
|
||||
<template>cheque</template>
|
||||
<order_state id='Awaiting_payment'>
|
||||
<name>অপেক্ষমান পেমেন্ট</name>
|
||||
<template>awaiting_payment</template>
|
||||
</order_state>
|
||||
<order_state id='Payment_accepted'>
|
||||
<name>পেমেন্ট গৃহীত </name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id='Preparation_in_progress'>
|
||||
<order_state id='Processing_in_progress'>
|
||||
<name>প্রস্তুতি আগাচ্ছে </name>
|
||||
<template>preparation</template>
|
||||
<template>processing</template>
|
||||
</order_state>
|
||||
<order_state id='Canceled'>
|
||||
<name>বাতিল </name>
|
||||
@@ -24,36 +24,24 @@
|
||||
<name>পরিশোধ ত্রুটি </name>
|
||||
<template>payment_error</template>
|
||||
</order_state>
|
||||
<order_state id='On_backorder_paid'>
|
||||
<name>অন ব্যাক অর্ডার </name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id='On_backorder_unpaid'>
|
||||
<name>অন ব্যাক অর্ডার </name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id='Awaiting_bank_wire_payment'>
|
||||
<name>ব্যাংক অয়্যার পেমেন্ট এর জন্য অপেক্ষমাণ</name>
|
||||
<template>bankwire</template>
|
||||
</order_state>
|
||||
<order_state id='Awaiting_PayPal_payment'>
|
||||
<name>পে পল পেমেন্ট এর জন্য অপেক্ষমান </name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id='Payment_remotely_accepted'>
|
||||
<name>পেমেন্ট স্থানিয় ভাবে গৃহীত</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_remote_payment">
|
||||
<name>Awaiting remote payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_partial_payment">
|
||||
<name>Awaiting partial payment</name>
|
||||
<order_state id="Overbooking_paid">
|
||||
<name>Overbooking (paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Overbooking_unpaid">
|
||||
<name>Overbooking (not paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template/>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_return_state>
|
||||
<order_return_state id="Waiting_for_confirmation">
|
||||
<name>Waiting for confirmation</name>
|
||||
<customer_template>order_refund_waiting_customer</customer_template>
|
||||
<admin_template>order_refund_waiting_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Request_received">
|
||||
<name>Request received</name>
|
||||
<customer_template>order_refund_received_customer</customer_template>
|
||||
<admin_template>order_refund_received_admin</admin_template>
|
||||
<order_return_state id="Pending">
|
||||
<name>Pending</name>
|
||||
<customer_template>order_refund_pending_customer</customer_template>
|
||||
<admin_template>order_refund_pending_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Refund_denied">
|
||||
<name>Refund denied</name>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version='1.0'?>
|
||||
<entity_order_state>
|
||||
<order_state id='Awaiting_cheque_payment'>
|
||||
<name>Aguardando o pagamento por cheque</name>
|
||||
<template>cheque</template>
|
||||
<order_state id='Awaiting_payment'>
|
||||
<name>Aguardando pagamento</name>
|
||||
<template>awaiting_payment</template>
|
||||
</order_state>
|
||||
<order_state id='Payment_accepted'>
|
||||
<name>Pagamento aceito</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id='Preparation_in_progress'>
|
||||
<order_state id='Processing_in_progress'>
|
||||
<name>Preparação em andamento</name>
|
||||
<template>preparation</template>
|
||||
<template>processing</template>
|
||||
</order_state>
|
||||
<order_state id='Canceled'>
|
||||
<name>Cancelado</name>
|
||||
@@ -24,36 +24,24 @@
|
||||
<name>Erro no pagamento</name>
|
||||
<template>payment_error</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_paid">
|
||||
<name>On backorder (paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_unpaid">
|
||||
<name>On backorder (not paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id='Awaiting_bank_wire_payment'>
|
||||
<name>Aguardando a transferência do pagamento pelo banco</name>
|
||||
<template>bankwire</template>
|
||||
</order_state>
|
||||
<order_state id='Awaiting_PayPal_payment'>
|
||||
<name>Aguardando o pagamento pelo Paypal</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id='Payment_remotely_accepted'>
|
||||
<name>Pagamento a distância aceito</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_remote_payment">
|
||||
<name>Awaiting remote payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_partial_payment">
|
||||
<name>Awaiting partial payment</name>
|
||||
<order_state id="Overbooking_paid">
|
||||
<name>Overbooking (paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Overbooking_unpaid">
|
||||
<name>Overbooking (not paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template/>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_return_state>
|
||||
<order_return_state id="Waiting_for_confirmation">
|
||||
<name>Waiting for confirmation</name>
|
||||
<customer_template>order_refund_waiting_customer</customer_template>
|
||||
<admin_template>order_refund_waiting_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Request_received">
|
||||
<name>Request received</name>
|
||||
<customer_template>order_refund_received_customer</customer_template>
|
||||
<admin_template>order_refund_received_admin</admin_template>
|
||||
<order_return_state id="Pending">
|
||||
<name>Pending</name>
|
||||
<customer_template>order_refund_pending_customer</customer_template>
|
||||
<admin_template>order_refund_pending_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Refund_denied">
|
||||
<name>Refund denied</name>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_state>
|
||||
<order_state id="Awaiting_cheque_payment">
|
||||
<name>Čeká se na platbu šekem</name>
|
||||
<template>cheque</template>
|
||||
<order_state id="Awaiting_payment">
|
||||
<name>Čeká se na platbu</name>
|
||||
<template>awaiting_payment</template>
|
||||
</order_state>
|
||||
<order_state id="Payment_accepted">
|
||||
<name>Platba byla přijata</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Preparation_in_progress">
|
||||
<order_state id="Processing_in_progress">
|
||||
<name>Probíhá příprava</name>
|
||||
<template>preparation</template>
|
||||
<template>processing</template>
|
||||
</order_state>
|
||||
<order_state id="Canceled">
|
||||
<name>Zrušeno</name>
|
||||
@@ -24,36 +24,24 @@
|
||||
<name>Chyba platby</name>
|
||||
<template>payment_error</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_paid">
|
||||
<name>On backorder (paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id="On_backorder_unpaid">
|
||||
<name>On backorder (not paid)</name>
|
||||
<template>outofstock</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_bank_wire_payment">
|
||||
<name>Awaiting bank wire payment</name>
|
||||
<template>bankwire</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_PayPal_payment">
|
||||
<name>Awaiting PayPal payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Payment_remotely_accepted">
|
||||
<name>Remote payment accepted</name>
|
||||
<template>payment</template>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_remote_payment">
|
||||
<name>Awaiting remote payment</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Awaiting_partial_payment">
|
||||
<name>Awaiting partial payment</name>
|
||||
<order_state id="Overbooking_paid">
|
||||
<name>Overbooking (paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Overbooking_unpaid">
|
||||
<name>Overbooking (not paid)</name>
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template/>
|
||||
<template>payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
</entity_order_state>
|
||||
@@ -1,14 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_order_return_state>
|
||||
<order_return_state id="Waiting_for_confirmation">
|
||||
<name>Waiting for confirmation</name>
|
||||
<customer_template>order_refund_waiting_customer</customer_template>
|
||||
<admin_template>order_refund_waiting_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Request_received">
|
||||
<name>Request received</name>
|
||||
<customer_template>order_refund_received_customer</customer_template>
|
||||
<admin_template>order_refund_received_admin</admin_template>
|
||||
<order_return_state id="Pending">
|
||||
<name>Pending</name>
|
||||
<customer_template>order_refund_pending_customer</customer_template>
|
||||
<admin_template>order_refund_pending_admin</admin_template>
|
||||
</order_return_state>
|
||||
<order_return_state id="Refund_denied">
|
||||
<name>Refund denied</name>
|
||||
|
||||