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

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

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

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

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


The following commit(s) were added to refs/heads/release18.12 by this push:
     new 0d285cc  Fixed: Unnecessary iterations and setting inventory for all productFacilities in setLastInventoryCount. (OFBIZ-11796)
0d285cc is described below

commit 0d285ccaebecf80498479e5317584bf17c7c1a7a
Author: Suraj Khurana <[hidden email]>
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 75a0594..67f89de 100644
--- a/applications/product/minilang/product/inventory/InventoryServices.xml
+++ b/applications/product/minilang/product/inventory/InventoryServices.xml
@@ -1122,11 +1122,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">
@@ -1138,7 +1138,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">