From 4261d1b47f3e9dbb4574484315e73c7fd948fe3e Mon Sep 17 00:00:00 2001
From: Andy Armaignac <andy.armaignac@doceleguas.com>
Date: Wed, 22 Jul 2020 16:36:06 -0400
Subject: [PATCH] Fixed issue-2262: Unwanted notification message is shown
 after discount is selected

A new validation was added to check if the notifications should be shown.

Now the notifications will be shown if the showNotification field is not defined in the event or is defined with true value
---
 .../js/pointofsale/view/ticketdiscount.js     | 45 ++++++++++---------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/view/ticketdiscount.js b/web/org.openbravo.retail.posterminal/js/pointofsale/view/ticketdiscount.js
index a5126d284..cb83bc288 100644
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/ticketdiscount.js
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/ticketdiscount.js
@@ -346,27 +346,32 @@ enyo.kind({
           return;
         }
         if (
-          OB.UTIL.isNullOrUndefined(args.formElementDiscountsList) ||
-          OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.model)
+          OB.UTIL.isNullOrUndefined(args.inEvent.showNotification) ||
+          args.inEvent.showNotification
         ) {
-          // Mandatory infornation
-          OB.UTIL.showError(
-            'Critical discount information is missing: ' +
-              (args.formElementDiscountsList
-                ? 'Discount model'
-                : 'Discount Container')
-          );
-        } else if (
-          OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.amt) ||
-          OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.units)
-        ) {
-          // Without this information, the discounts could not be applied
-          OB.UTIL.showWarning(
-            'Some discount information is missing, the promotion could not be applied: ' +
-              (args.formElementDiscountsList.amt
-                ? 'Discount units'
-                : 'Discount amount')
-          );
+          if (
+            OB.UTIL.isNullOrUndefined(args.formElementDiscountsList) ||
+            OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.model)
+          ) {
+            // Mandatory infornation
+            OB.UTIL.showError(
+              'Critical discount information is missing: ' +
+                (args.formElementDiscountsList
+                  ? 'Discount model'
+                  : 'Discount Container')
+            );
+          } else if (
+            OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.amt) ||
+            OB.UTIL.isNullOrUndefined(args.formElementDiscountsList.units)
+          ) {
+            // Without this information, the discounts could not be applied
+            OB.UTIL.showWarning(
+              'Some discount information is missing, the promotion could not be applied: ' +
+                (args.formElementDiscountsList.amt
+                  ? 'Discount units'
+                  : 'Discount amount')
+            );
+          }
         }
         if (args.hideLineSelectionOptions) {
           args.context.$.formElementCheckSelectAll.hide();
-- 
2.25.1

