Skip to content

Commit ac0de7b

Browse files
set voucher expiry is required
1 parent c4a6bab commit ac0de7b

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ public function postProcess()
326326
} else {
327327
$this->errors[] = $this->l('Invalid refund state.');
328328
}
329-
if ($voucher_expiry_date = Tools::getValue('voucher_expiry_date')) {
330-
if (!Validate::isDate($voucher_expiry_date)) {
331-
$this->errors[] = $this->l('Invalid voucher expiry date.');
332-
}
329+
if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) {
330+
$this->errors[] = $this->l('Voucher expiry date is required.');
331+
} elseif (!Validate::isDate($voucher_expiry_date)) {
332+
$this->errors[] = $this->l('Invalid voucher expiry date.');
333333
}
334334
} else {
335335
$this->errors[] = $this->l('Invalid refund information found.');

modules/hotelreservationsystem/views/js/admin/wk_refund_request.js

+15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ $(document).ready(function() {
2323
manageRefundOptions();
2424
}
2525

26+
$('#order_return_form').on('submit', function() {
27+
if ($("#id_refund_state option:selected").attr('refunded') == 1) {
28+
if ($('#generateDiscount:checked').length) {
29+
if ($('#voucher_expiry').val() == '') {
30+
$('#voucher_expiry').parent().addClass('has-error');
31+
return false;
32+
}
33+
}
34+
}
35+
});
36+
37+
$('#voucher_expiry').on('focus', function() {
38+
$('#voucher_expiry').parent().removeClass('has-error');
39+
});
40+
2641
// initialize tootip for room price
2742
if ($('#rooms_refund_info .price_info').length) {
2843
$('#rooms_refund_info .price_info').each(function (i, element) {

modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
<div class="generate_discount_fields" style="display:none;">
373373
<div class="form-group">
374374
<div class="col-sm-3">
375-
<label for="voucher_expiry" class="control-label">
375+
<label for="voucher_expiry" class="control-label required">
376376
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Please select the date until which the voucher can be used.' mod='hotelreservationsystem'}">{l s='Voucher expiry date' mod='hotelreservationsystem'}</span> :
377377
</label>
378378
</div>

0 commit comments

Comments
 (0)