@@ -245,7 +245,8 @@ public function renderView()
245
245
'isRefundCompleted ' => $ objOrderReturn ->hasBeenCompleted (),
246
246
'paymentMethods ' => $ paymentMethods ,
247
247
'name_controller ' => Tools::getValue ('controller ' ),
248
- 'info_icon_path ' => $ this ->context ->link ->getMediaLink (_MODULE_DIR_ .'hotelreservationsystem/views/img/Slices/icon-info.svg ' )
248
+ 'info_icon_path ' => $ this ->context ->link ->getMediaLink (_MODULE_DIR_ .'hotelreservationsystem/views/img/Slices/icon-info.svg ' ),
249
+ 'expiry_date ' => time () + (3600 * 24 * 365.25 )
249
250
)
250
251
);
251
252
@@ -325,6 +326,11 @@ public function postProcess()
325
326
} else {
326
327
$ this ->errors [] = $ this ->l ('Invalid refund state. ' );
327
328
}
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. ' );
333
+ }
328
334
} else {
329
335
$ this ->errors [] = $ this ->l ('Invalid refund information found. ' );
330
336
}
@@ -480,7 +486,12 @@ public function postProcess()
480
486
$ cartrule ->id_customer = $ objOrder ->id_customer ;
481
487
$ now = time ();
482
488
$ cartrule ->date_from = date ('Y-m-d H:i:s ' , $ now );
483
- $ cartrule ->date_to = date ('Y-m-d H:i:s ' , $ now + (3600 * 24 * 365.25 )); /* 1 year */
489
+ // generateDiscount
490
+ if ($ voucher_expiry_date ) {
491
+ $ cartrule ->date_to = date ('Y-m-d H:i:s ' , strtotime ($ voucher_expiry_date ));
492
+ } else {
493
+ $ cartrule ->date_to = date ('Y-m-d H:i:s ' , $ now + (3600 * 24 * 365.25 )); /* 1 year */
494
+ }
484
495
$ cartrule ->active = 1 ;
485
496
$ cartrule ->highlight = 1 ;
486
497
$ cartrule ->reduction_amount = $ totalRefundedAmount ;
@@ -560,6 +571,8 @@ public function setMedia()
560
571
561
572
if ($ this ->display == 'view ' ) {
562
573
$ this ->addJqueryUI ('ui.tooltip ' , 'base ' , true );
574
+ $ this ->removeJS (Media::getJqueryUIPath ('effects.core ' , 'base ' , false ), false );
575
+
563
576
$ this ->addJs (_MODULE_DIR_ .$ this ->module ->name .'/views/js/admin/wk_refund_request.js ' );
564
577
$ this ->addCSS (_MODULE_DIR_ .$ this ->module ->name .'/views/css/admin/wk_refund_request.css ' );
565
578
}
0 commit comments