From ac0de7b6f52ba281ef6b2361001daa65e9fd71cd Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 11 Jul 2024 13:19:11 +0530 Subject: [PATCH] set voucher expiry is required --- .../admin/AdminOrderRefundRequestsController.php | 8 ++++---- .../views/js/admin/wk_refund_request.js | 15 +++++++++++++++ .../order_refund_requests/helpers/view/view.tpl | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 5346dedae..c777cfa43 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -326,10 +326,10 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } else { $this->errors[] = $this->l('Invalid refund state.'); } - if ($voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { - if (!Validate::isDate($voucher_expiry_date)) { - $this->errors[] = $this->l('Invalid voucher expiry date.'); - } + if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { + $this->errors[] = $this->l('Voucher expiry date is required.'); + } elseif (!Validate::isDate($voucher_expiry_date)) { + $this->errors[] = $this->l('Invalid voucher expiry date.'); } } else { $this->errors[] = $this->l('Invalid refund information found.'); diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js index f87b8e3f5..c6e99a85b 100644 --- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js +++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js @@ -23,6 +23,21 @@ $(document).ready(function() { manageRefundOptions(); } + $('#order_return_form').on('submit', function() { + if ($("#id_refund_state option:selected").attr('refunded') == 1) { + if ($('#generateDiscount:checked').length) { + if ($('#voucher_expiry').val() == '') { + $('#voucher_expiry').parent().addClass('has-error'); + return false; + } + } + } + }); + + $('#voucher_expiry').on('focus', function() { + $('#voucher_expiry').parent().removeClass('has-error'); + }); + // initialize tootip for room price if ($('#rooms_refund_info .price_info').length) { $('#rooms_refund_info .price_info').each(function (i, element) { diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index 84fa3659b..ad04059d2 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -372,7 +372,7 @@