Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved: issue on free order and room reallocation #549

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions classes/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,23 @@ public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_
(float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, $order->product_list, $id_carrier),
_PS_PRICE_COMPUTE_PRECISION_
);
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, null, $id_carrier)),
_PS_PRICE_COMPUTE_PRECISION_
);
if ($totalOrder = $this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, null, $id_carrier)) {
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $totalOrder),
_PS_PRICE_COMPUTE_PRECISION_
);
}
} else {
$order->advance_paid_amount = (float)Tools::ps_round(
(float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier),
_PS_PRICE_COMPUTE_PRECISION_
);
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $this->context->cart->getOrderTotal(true, Cart::BOTH, null, $id_carrier)),
_PS_PRICE_COMPUTE_PRECISION_
);
if ($orderTotal = $this->context->cart->getOrderTotal(true, Cart::BOTH, null, $id_carrier)) {
$order->amount_paid = (float)Tools::ps_round(
(($order->advance_paid_amount * $amount_paid) / $orderTotal),
_PS_PRICE_COMPUTE_PRECISION_
);
}
}

// Creating order
Expand Down
59 changes: 0 additions & 59 deletions modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,65 +411,6 @@ $(document).ready(function() {
$(this).parents('.child_feature_row').remove();
});

/*For swaping rooms in the modal*/
$("#realloc_allocated_rooms").on('click', function(e) {
$(".error_text").text('');
if ($('#realloc_avail_rooms').val() == 0) {
$("#realloc_sel_rm_err_p").text(slct_rm_err);
return false;
}
});
$("#swap_allocated_rooms").on('click', function(e) {
$(".error_text").text('');
if ($('#swap_avail_rooms').val() == 0) {
$("#swap_sel_rm_err_p").text(slct_rm_err);
return false;
}
});

$('#mySwappigModal').on('hidden.bs.modal', function(e) {
$(".modal_date_from").val('');
$(".modal_date_to").val('');
$(".modal_id_room").val('');
$(".modal_curr_room_num").val('');
$(".cust_name").text('');
$(".cust_email").text('');
$(".swp_rm_opts").remove();
$(".realloc_rm_opts").remove();
});

$('#mySwappigModal').on('shown.bs.modal', function(e) {
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
html = '';
if (e.relatedTarget.dataset.avail_rm_realloc) {
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
$.each(json_arr_rm_swp, function(key, val) {
html += '<option class="swp_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
});
}
if (html != '') {
$("#swap_avail_rooms").append(html);
}

html = '';
if (e.relatedTarget.dataset.avail_rm_realloc) {
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
$.each(json_arr_rm_realloc, function(key, val) {
html += '<option class="realloc_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
});
}
if (html != '') {
$("#realloc_avail_rooms").append(html);
}
});

/* ---- Book Now page Admin ---- */

/* ---- HotelConfigurationSettingController Admin ---- */

if ($('#WK_SHOW_MSG_ON_BO_on').prop('checked') === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,4 +954,61 @@ $(document).ready(function() {
return [true, ""];
}
}

/*For swaping rooms in the modal*/
$("#realloc_allocated_rooms").on('click', function(e) {
$(".error_text").text('');
if ($('#realloc_avail_rooms').val() == 0) {
$("#realloc_sel_rm_err_p").text(slct_rm_err);
return false;
}
});
$("#swap_allocated_rooms").on('click', function(e) {
$(".error_text").text('');
if ($('#swap_avail_rooms').val() == 0) {
$("#swap_sel_rm_err_p").text(slct_rm_err);
return false;
}
});

$('#mySwappigModal').on('hidden.bs.modal', function(e) {
$(".modal_date_from").val('');
$(".modal_date_to").val('');
$(".modal_id_room").val('');
$(".modal_curr_room_num").val('');
$(".cust_name").text('');
$(".cust_email").text('');
$(".swp_rm_opts").remove();
$(".realloc_rm_opts").remove();
});

$('#mySwappigModal').on('shown.bs.modal', function(e) {
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
html = '';
if (e.relatedTarget.dataset.avail_rm_realloc) {
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
$.each(json_arr_rm_swp, function(key, val) {
html += '<option class="swp_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
});
}
if (html != '') {
$("#swap_avail_rooms").append(html);
}

html = '';
if (e.relatedTarget.dataset.avail_rm_realloc) {
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
$.each(json_arr_rm_realloc, function(key, val) {
html += '<option class="realloc_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
});
}
if (html != '') {
$("#realloc_avail_rooms").append(html);
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
</ul>
<div class="tab-content panel active">
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
<form method="post" action="{$formAction|escape:'htmlall':'UTF-8'}">
<form method="post" action="">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
Expand Down