You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/06/08 12:30:52 UTC

[ofbiz-framework] branch trunk updated: Fixed: Unnecessary iterations and setting inventory for all productFacilities in setLastInventoryCount. (OFBIZ-11796)

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

surajk 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 a6cf5aa  Fixed: Unnecessary iterations and setting inventory for all productFacilities in setLastInventoryCount. (OFBIZ-11796)
a6cf5aa is described below

commit a6cf5aafda6561f3fabedeea9007718919d15d02
Author: Suraj Khurana <su...@apache.org>
AuthorDate: Mon Jun 8 18:00:37 2020 +0530

    Fixed: Unnecessary iterations and setting inventory for all productFacilities in setLastInventoryCount.
    (OFBIZ-11796)
    
    Instead of updating all product facilities records on one inventory item change, we should be changing only specific product facility record for that the inventory item belongs to. Thanks Jacques, Pierre, Pawan and Arun for the review.
---
 .../product/minilang/product/inventory/InventoryServices.xml     | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/applications/product/minilang/product/inventory/InventoryServices.xml b/applications/product/minilang/product/inventory/InventoryServices.xml
index a543886..8805fc9 100644
--- a/applications/product/minilang/product/inventory/InventoryServices.xml
+++ b/applications/product/minilang/product/inventory/InventoryServices.xml
@@ -1221,11 +1221,11 @@ under the License.
         <entity-one entity-name="InventoryItem" value-field="inventoryItem"  auto-field-map="false">
             <field-map field-name="inventoryItemId" from-field="parameters.inventoryItemId"/>
         </entity-one>
-        <entity-and entity-name="ProductFacility" list="productFacilities">
+        <entity-one entity-name="ProductFacility" value-field="productFacility">
             <field-map field-name="productId" from-field="inventoryItem.productId" />
-        </entity-and>
-        <if-not-empty field="productFacilities">
-            <iterate list="productFacilities" entry="productFacility">
+            <field-map field-name="facilityId" from-field="inventoryItem.facilityId" />
+        </entity-one>
+        <if-not-empty field="productFacility">
                 <set field="serviceInMap.productId" from-field="productFacility.productId"/>
                 <set field="serviceInMap.facilityId" from-field="productFacility.facilityId"/>
                 <call-service service-name="getInventoryAvailableByFacility" in-map-name="serviceInMap">
@@ -1237,7 +1237,6 @@ under the License.
                 <call-service service-name="updateProductFacility" in-map-name="serviceInMap"/>
                 <clear-field field="productFacility"/>
                 <clear-field field="serviceInMap"/>
-            </iterate>
         </if-not-empty>
     </simple-method>
     <simple-method method-name="createUpdateFacilityGeoPoint" short-description="Create or update GeoPoint assigned to facility">