[ofbiz-framework] branch trunk updated: Fixed: BigDecimal casting in Groovy (OFBIZ-11862)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: BigDecimal casting in Groovy (OFBIZ-11862)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 4bf23fd  Fixed: BigDecimal casting in Groovy (OFBIZ-11862)
4bf23fd is described below

commit 4bf23fdd9c7dc11cca9135df84bd599b29168a0e
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Tue Jun 30 18:42:43 2020 +0200

    Fixed: BigDecimal casting in Groovy (OFBIZ-11862)
   
    Fixes syntax errors introduced by my previous commit
---
 applications/order/groovyScripts/order/OrderReturnServices.groovy | 8 ++++----
 .../groovyScripts/product/inventory/InventoryIssueServices.groovy | 4 ++--
 .../groovyScripts/product/promo/ProductPromoCondServices.groovy   | 4 ++--
 .../product/groovyScripts/shipment/ShipmentReceiptServices.groovy | 2 +-
 .../product/groovyScripts/shipment/ShipmentServices.groovy        | 6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/applications/order/groovyScripts/order/OrderReturnServices.groovy b/applications/order/groovyScripts/order/OrderReturnServices.groovy
index 4583812..85fb741 100644
--- a/applications/order/groovyScripts/order/OrderReturnServices.groovy
+++ b/applications/order/groovyScripts/order/OrderReturnServices.groovy
@@ -205,7 +205,7 @@ def createReturnItem() {
         && ("RTN_CSREPLACE" == parameters.returnTypeId || "RTN_REPAIR_REPLACE" == parameters.returnTypeId)) {
         return informError("OrderReturnPaymentMethodNeededForThisTypeOfReturn")
     }
-    if (parameters.returnQuantity == 0 as BigDecimal) {
+    if (parameters.returnQuantity == (0 as BigDecimal)) {
         return informError("OrderNoReturnQuantityAvailablePreviousReturnsMayExist")
     }
     
@@ -232,7 +232,7 @@ def createReturnItem() {
         returnableQuantity = serviceResult.returnableQuantity ?: returnableQuantity
         returnablePrice = serviceResult.returnablePrice ?: returnablePrice
     }
-    if (returnableQuantity > 0 as BigDecimal) {
+    if (returnableQuantity > (0 as BigDecimal)) {
         // the user is only allowed to set a returnPrice if he has ORDERMGR_CREATE privilege,
         // otherwise only the returnablePrice calculated by service is used
         if (!security.hasEntityPermission("ORDERMGR", "_CREATE", parameters.userLogin)) {
@@ -520,7 +520,7 @@ def quickReturnFromOrder() {
             logInfo("Found unexpected orderAdjustment: ${newItemCtx.orderAdjustmentId}")
             newItemCtx.orderAdjustmentId = null
         }
-        if (newItemCtx.returnQuantity > 0 as BigDecimal) {
+        if (newItemCtx.returnQuantity > (0 as BigDecimal)) {
             // otherwise, items which have been fully returned would still get passed in and then come back with an error
             run service:"createReturnItem", with: newItemCtx
         } else {
@@ -551,7 +551,7 @@ def quickReturnFromOrder() {
     logInfo("OrderTotal [${orderTotal}] - ReturnTotal [${returnTotal}] = available Return Total [${}]")
     
     // create a manual balance adjustment based on the difference between order total and return total
-    if (availableReturnTotal != 0 as BigDecimal) {
+    if (availableReturnTotal != (0 as BigDecimal)) {
         logWarning("Creating a balance adjustment of [" + availableReturnTotal + "] for return [" + returnId + "]")
         
         // create the balance adjustment return item
diff --git a/applications/product/groovyScripts/product/inventory/InventoryIssueServices.groovy b/applications/product/groovyScripts/product/inventory/InventoryIssueServices.groovy
index e9faa29..d443024 100644
--- a/applications/product/groovyScripts/product/inventory/InventoryIssueServices.groovy
+++ b/applications/product/groovyScripts/product/inventory/InventoryIssueServices.groovy
@@ -116,7 +116,7 @@ def issueImmediatelyFulfilledOrderItem() {
         parameters.quantityNotIssued = orderItem.quantity
         // if quantityNotIssued is not 0, then pull it from the last non-serialized inventory item found,
         // in the quantityNotIssued field
-        if (parameters.quantityNotIssued != 0 as BigDecimal) {
+        if (parameters.quantityNotIssued != (0 as BigDecimal)) {
             BigDecimal availableToPromiseDiff = - parameters.quantityNotIssued
             BigDecimal quantityOnHandDiff = - parameters.quantityNotIssued
             if (lastNonSerInventoryItem) {
@@ -175,7 +175,7 @@ def issueImmediatelyFulfilledOrderItem() {
 def issueImmediateForInventoryItemInline(GenericValue inventoryItem) {
     GenericValue lastNonSerInventoryItem
     // only do something with this inventoryItem if there is more inventory to issue
-    if (parameters.quantityNotIssued > 0 as BigDecimal) {
+    if (parameters.quantityNotIssued > (0 as BigDecimal)) {
         if ("SERIALIZED_INV_ITEM" == inventoryItem.inventoryItemTypeId) {
             if ("INV_AVAILABLE" == inventoryItem.statusId) {
                 // change status on inventoryItem
diff --git a/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy b/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy
index a3ec0ce..cacaadf 100644
--- a/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy
+++ b/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy
@@ -401,7 +401,7 @@ def productOrderHist() {
                 logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_HIST ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result))
                 return serviceResult
             } else {
-                BigDecimal orderSubTotal = (BigDecimal) serviceResult.get("totalSubRemainingAmount")
+                BigDecimal orderSubTotal = serviceResult.get("totalSubRemainingAmount")
                 BigDecimal orderSubTotalAndCartSubTotal = orderSubTotal.add(cart.getSubTotal())
                 if (Debug.verboseOn()) logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.")
                 compareBase = orderSubTotalAndCartSubTotal.compareTo(new BigDecimal(condValue))
@@ -447,7 +447,7 @@ def productOrderYear() {
                 logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result))
                 return serviceResult
             } else {
-                BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount")
+                BigDecimal orderSubTotal = result.get("totalSubRemainingAmount")
                 if (Debug.verboseOn()) logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.")
                 compareBase = orderSubTotal.compareTo(new BigDecimal((condValue)))
 
diff --git a/applications/product/groovyScripts/shipment/ShipmentReceiptServices.groovy b/applications/product/groovyScripts/shipment/ShipmentReceiptServices.groovy
index 4365e1e..0f78946 100644
--- a/applications/product/groovyScripts/shipment/ShipmentReceiptServices.groovy
+++ b/applications/product/groovyScripts/shipment/ShipmentReceiptServices.groovy
@@ -82,7 +82,7 @@ def receiveInventoryProduct () {
     Double loops = 1.0
     if (parameters.inventoryItemTypeId == "SERIALIZED_INV_ITEM") {
         // if we are serialized and either a serialNumber or inventoyItemId is passed in and the quantityAccepted is greater than 1 then complain
-        if ((parameters.serialNumber || parameters.currentInventoryItemId) && (parameters.quantityAccepted > 1 as BigDecimal)) {
+        if ((parameters.serialNumber || parameters.currentInventoryItemId) && (parameters.quantityAccepted > (1 as BigDecimal))) {
             Map errorLog = [parameters: parameters]
             return error(UtilProperties.getMessage("ProductUiLabels", "FacilityReceiveInventoryProduct", errorLog,  parameters.locale))
             // before getting going, see if there are any validation issues so far
diff --git a/applications/product/groovyScripts/shipment/ShipmentServices.groovy b/applications/product/groovyScripts/shipment/ShipmentServices.groovy
index b452759..838ee19 100644
--- a/applications/product/groovyScripts/shipment/ShipmentServices.groovy
+++ b/applications/product/groovyScripts/shipment/ShipmentServices.groovy
@@ -545,7 +545,7 @@ def splitShipmentItemByQuantity() {
             .queryList()
     BigDecimal orderShipmentQuantityLeft = parameters.newItemQuantity
     for (GenericValue itemOrderShipment : itemOrderShipmentList) {
-        if (orderShipmentQuantityLeft > 0 as BigDecimal) {
+        if (orderShipmentQuantityLeft > (0 as BigDecimal)) {
             if (itemOrderShipment.quantity > orderShipmentQuantityLeft) {
                 // there is enough in this OrderShipment record, so just adjust it and move on
                 Map updateOrderShipmentMap = itemOrderShipment.getAllFields()
@@ -1336,7 +1336,7 @@ def removeOrderShipmentFromShipment() {
     GenericValue shipmentItem = from("ShipmentItem").where(parameters).queryOne()
     run service: "deleteOrderShipment", with: parameters
     shipmentItem.quantity = orderShipment.quantity - shipmentItem.quantity
-    if (shipmentItem.quantity > 0 as BigDecimal) {
+    if (shipmentItem.quantity > (0 as BigDecimal)) {
         run service: "updateShipmentItem", with: shipmentItem.getAllFields()
     } else {
         run service: "deleteShipmentItem", with: parameters
@@ -1353,7 +1353,7 @@ def removeOrderShipmentFromShipment() {
 def addOrderShipmentToShipment() {
     Map result = success()
     // if quantity is greater than 0 we add or update the ShipmentPlan
-    if (parameters.quantity > 0 as BigDecimal) {
+    if (parameters.quantity > (0 as BigDecimal)) {
         // get orderHeader
         GenericValue orderHeader = from("OrderHeader").where(parameters).queryOne()
         // get orderItem