Added: option to add voucher expiry date while managing refund request

This commit is contained in:
Shreesh Arora
2024-05-29 19:54:05 +05:30
parent 19c4e45320
commit 707393d2d7
3 changed files with 42 additions and 1 deletions

View File

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