Added: option to add voucher expiry date while managing refund request
This commit is contained in:
@@ -338,6 +338,11 @@ 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.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund information found.');
|
||||
}
|
||||
@@ -491,7 +496,12 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
$cartrule->id_customer = $objOrder->id_customer;
|
||||
$now = time();
|
||||
$cartrule->date_from = date('Y-m-d H:i:s', $now);
|
||||
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
|
||||
// generateDiscount
|
||||
if ($voucher_expiry_date) {
|
||||
$cartrule->date_to = date('Y-m-d H:i:s', strtotime($voucher_expiry_date));
|
||||
} else {
|
||||
$cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
|
||||
}
|
||||
$cartrule->active = 1;
|
||||
$cartrule->highlight = 1;
|
||||
$cartrule->reduction_amount = $totalRefundedAmount;
|
||||
@@ -570,6 +580,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
parent::setMedia();
|
||||
|
||||
$this->addJqueryUI('ui.tooltip', 'base', true);
|
||||
$this->removeJS(Media::getJqueryUIPath('effects.core', 'base', false), false);
|
||||
|
||||
|
||||
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_refund_request.js');
|
||||
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/admin/wk_refund_request.css');
|
||||
|
||||
@@ -70,6 +70,21 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('#voucher_expiry').datepicker({
|
||||
dateFormat: 'dd-mm-yy',
|
||||
altFormat: 'yy-mm-dd',
|
||||
altField: '#voucher_expiry_date',
|
||||
minDate: 0,
|
||||
});
|
||||
|
||||
$(document).on('change', '#generateDiscount', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$(".generate_discount_fields").show(200);
|
||||
} else {
|
||||
$(".generate_discount_fields").hide(200);
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_refund_state').on('change', function() {
|
||||
if ($("#id_refund_state option:selected").attr('refunded') == 1) {
|
||||
$(".refunded_state_fields").show(200);
|
||||
|
||||
@@ -353,6 +353,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="generate_discount_fields" style="display:none;">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-3">
|
||||
<label for="voucher_expiry" class="control-label required">
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Select voucher expiry date.' mod='hotelreservationsystem'}">{l s='Voucher expiry date' mod='hotelreservationsystem'}</span> :
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" id="voucher_expiry">
|
||||
<input type="hidden" name="voucher_expiry_date" id="voucher_expiry_date">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user