You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by go...@apache.org on 2026/06/03 15:42:36 UTC

(ofbiz-framework) branch trunk updated (6b1ccfc4cd -> f8f7949738)

This is an automated email from the ASF dual-hosted git repository.

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


    from 6b1ccfc4cd Fixing the console warnings: No transaction in place, so not suspending. (#1310)
     new 5a7578971d Fixed: Correct receivedQuantity calculation in getReceivedQuantityForOrderItem by including quantityRejected
     new f8f7949738 Improved: Refactor getReceiveQuantityForOrderItem and add checks for null quantities

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ofbiz/product/shipment/ShipmentReceiptServices.groovy     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)


(ofbiz-framework) 01/02: Fixed: Correct receivedQuantity calculation in getReceivedQuantityForOrderItem by including quantityRejected

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

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

commit 5a7578971d91c7cb5938741d753a83c2c51ffa41
Author: Anahita Goljahani <an...@gmail.com>
AuthorDate: Mon May 25 10:26:14 2026 +0200

    Fixed: Correct receivedQuantity calculation in getReceivedQuantityForOrderItem by including quantityRejected
---
 .../org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
index 369517712d..71f795166e 100644
--- a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
@@ -299,6 +299,7 @@ BigDecimal getReceivedQuantityForOrderItem (GenericValue orderItem) {
     List shipmentReceipts = from('ShipmentReceipt').where(orderId: orderItem.orderId, orderItemSeqId: orderItem.orderItemSeqId).queryList()
     for (GenericValue shipmentReceipt : shipmentReceipts) {
         receivedQuantity +=  shipmentReceipt.quantityAccepted
+        receivedQuantity +=  shipmentReceipt.quantityRejected
     }
     return receivedQuantity
 }


(ofbiz-framework) 02/02: Improved: Refactor getReceiveQuantityForOrderItem and add checks for null quantities

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

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

commit f8f7949738f2bdc76ff3b6be60871dfd026b25f8
Author: Anahita Goljahani <an...@gmail.com>
AuthorDate: Wed Jun 3 11:40:44 2026 +0200

    Improved: Refactor getReceiveQuantityForOrderItem and add checks for null quantities
    
    Thanks to Nicolas Malin for the advice and the code snippet.
---
 .../ofbiz/product/shipment/ShipmentReceiptServices.groovy    | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
index 71f795166e..c52882fae1 100644
--- a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
@@ -295,13 +295,11 @@ Map quickReceiveReturn() {
  * Computes the till now received quantity from all ShipmentReceipts
  */
 BigDecimal getReceivedQuantityForOrderItem (GenericValue orderItem) {
-    BigDecimal receivedQuantity = 0
-    List shipmentReceipts = from('ShipmentReceipt').where(orderId: orderItem.orderId, orderItemSeqId: orderItem.orderItemSeqId).queryList()
-    for (GenericValue shipmentReceipt : shipmentReceipts) {
-        receivedQuantity +=  shipmentReceipt.quantityAccepted
-        receivedQuantity +=  shipmentReceipt.quantityRejected
-    }
-    return receivedQuantity
+    return from('ShipmentReceipt')
+            .where(orderId: orderItem.orderId,
+                    orderItemSeqId: orderItem.orderItemSeqId)
+            .queryList()
+            .sum { (it.quantityAccepted ?: 0) + (it.quantityRejected ?: 0) }
 }
 
 /**