You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/10 21:04:30 UTC

(ofbiz-framework) branch release24.09 updated: Fixed: createFacilityLocation locationSeqId collision fallback regression (OFBIZ-13557)

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

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


The following commit(s) were added to refs/heads/release24.09 by this push:
     new db9d50269c Fixed: createFacilityLocation locationSeqId collision fallback regression (OFBIZ-13557)
db9d50269c is described below

commit db9d50269c0b39213fba96576e72ee2f0d7a323c
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Fri Sep 11 01:25:53 2026 +0530

    Fixed: createFacilityLocation locationSeqId collision fallback regression (OFBIZ-13557)
    
    Restore original collision handling to try a single _2 suffix before falling back to a sequenced id instead of looping indefinitely with incremental suffixes.
---
 .../ofbiz/product/facility/storage/StorageServices.groovy | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/storage/StorageServices.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/storage/StorageServices.groovy
index 99c967a23f..84603bb205 100644
--- a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/storage/StorageServices.groovy
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/storage/StorageServices.groovy
@@ -30,15 +30,16 @@ Map createFacilityLocation() {
     "${parameters.levelId ?: ''}${parameters.positionId ?: ''}"
 
     if (locationSeqId) {
-        int i = 1
-        String nextLocationSeqId = locationSeqId
-        while (from('FacilityLocation')
-                .where([locationSeqId: nextLocationSeqId,
-                        facilityId: parameters.facilityId])
+        if (from('FacilityLocation')
+                .where(facilityId: parameters.facilityId, locationSeqId: locationSeqId)
                 .queryOne()) {
-            nextLocationSeqId = "${locationSeqId}_${i++}"
+            locationSeqId = "${locationSeqId}_2"
+            if (from('FacilityLocation')
+                    .where(facilityId: parameters.facilityId, locationSeqId: locationSeqId)
+                    .queryOne()) {
+                locationSeqId = delegator.getNextSeqId('FacilityLocation')
+            }
         }
-        locationSeqId = nextLocationSeqId
     } else {
         locationSeqId = delegator.getNextSeqId('FacilityLocation')
     }