From 2099ab2e25eee85c1e5fb658688d51155952ce58 Mon Sep 17 00:00:00 2001 From: Robert He Date: Fri, 1 Apr 2016 15:42:21 -0500 Subject: [PATCH 1/8] MAGETWO-51248: Unable to generate coupon codes for Cart Price Rules -- fix javascript that enables/disables auto coupon generation --- .../base/web/js/form/element/coupon-type.js | 23 +++++++++++++++++++ .../js/form/element/manage-coupon-codes.js | 10 +++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/SalesRule/view/base/web/js/form/element/coupon-type.js b/app/code/Magento/SalesRule/view/base/web/js/form/element/coupon-type.js index 914dc4bc8bda3..31c836a638278 100644 --- a/app/code/Magento/SalesRule/view/base/web/js/form/element/coupon-type.js +++ b/app/code/Magento/SalesRule/view/base/web/js/form/element/coupon-type.js @@ -20,6 +20,29 @@ define([ if (this.value() != this.displayOnlyForCouponType) { uiRegistry.get('sales_rule_form.sales_rule_form.rule_information.use_auto_generation').checked(false); } + + this.enableDisableFields(); + }, + + /** + * Enable/disable fields on Coupons tab + */ + enableDisableFields: function () { + var selector = '[id=sales-rule-form-tab-coupons] input, [id=sales-rule-form-tab-coupons] select, ' + + '[id=sales-rule-form-tab-coupons] button', + isUseAutoGenerationChecked = uiRegistry + .get('sales_rule_form.sales_rule_form.rule_information.use_auto_generation') + .checked(); + var couponType = uiRegistry + .get('sales_rule_form.sales_rule_form.rule_information.coupon_type') + .value(); + var disableAuto = (isUseAutoGenerationChecked && couponType == 2) || (couponType == 3) + _.each( + document.querySelectorAll(selector), + function (element) { + element.disabled = !disableAuto; + } + ); } }); }); diff --git a/app/code/Magento/SalesRule/view/base/web/js/form/element/manage-coupon-codes.js b/app/code/Magento/SalesRule/view/base/web/js/form/element/manage-coupon-codes.js index 641a1d3605a51..12dc4550d1f7c 100644 --- a/app/code/Magento/SalesRule/view/base/web/js/form/element/manage-coupon-codes.js +++ b/app/code/Magento/SalesRule/view/base/web/js/form/element/manage-coupon-codes.js @@ -28,7 +28,7 @@ define([ var useAutoGeneration = uiRegistry.get( 'sales_rule_form.sales_rule_form.rule_information.use_auto_generation' ); - + useAutoGeneration.on('checked', function () { obj.enableDisableFields(); }); @@ -46,14 +46,18 @@ define([ enableDisableFields: function () { var selector = '[id=sales-rule-form-tab-coupons] input, [id=sales-rule-form-tab-coupons] select, ' + '[id=sales-rule-form-tab-coupons] button', - isUseAutoGenerationChecked = !uiRegistry + isUseAutoGenerationChecked = uiRegistry .get('sales_rule_form.sales_rule_form.rule_information.use_auto_generation') .checked(); + var couponType = uiRegistry + .get('sales_rule_form.sales_rule_form.rule_information.coupon_type') + .value(); + var disableAuto = (couponType == 3) || isUseAutoGenerationChecked _.each( document.querySelectorAll(selector), function (element) { - element.disabled = isUseAutoGenerationChecked; + element.disabled = !disableAuto; } ); } From 87f27afb8e581f47292303ac16c4685ca12e7f14 Mon Sep 17 00:00:00 2001 From: Robert He Date: Mon, 4 Apr 2016 16:28:46 -0500 Subject: [PATCH 2/8] MAGETWO-51503: Incorrect comments history time in admin order review page -- fixed getting the correct time/date from a comment --- .../Sales/view/adminhtml/templates/order/comments/view.phtml | 4 ++-- .../Sales/view/adminhtml/templates/order/view/history.phtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml index 46f1281e3cc5b..ec8a477dcd0ca 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml @@ -53,8 +53,8 @@