set voucher expiry is required

This commit is contained in:
Shreesh Arora
2024-07-11 13:19:11 +05:30
parent c4a6babd25
commit ac0de7b6f5
3 changed files with 20 additions and 5 deletions

View File

@@ -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.');

View File

@@ -23,6 +23,21 @@ $(document).ready(function() {
manageRefundOptions();
}
$('#order_return_form').on('submit', function() {
if ($("#id_refund_state option:selected").attr('refunded') == 1) {
if ($('#generateDiscount:checked').length) {
if ($('#voucher_expiry').val() == '') {
$('#voucher_expiry').parent().addClass('has-error');
return false;
}
}
}
});
$('#voucher_expiry').on('focus', function() {
$('#voucher_expiry').parent().removeClass('has-error');
});
// initialize tootip for room price
if ($('#rooms_refund_info .price_info').length) {
$('#rooms_refund_info .price_info').each(function (i, element) {

View File

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