Author: jleroux
Date: Sun Jun 19 21:07:27 2011 New Revision: 1137435 URL: http://svn.apache.org/viewvc?rev=1137435&view=rev Log: A patch from Rene Scheibe"ProductWorker.getSelectableProductFeaturesByTypesAndSeq() returns duplicate entries" https://issues.apache.org/jira/browse/OFBIZ-4276 Calling ProductWorker#getSelectableProductFeaturesByTypesAndSeq() returns duplicate entries. Example: A virtual product with 2 variants: variant 1 features COLOR: blau SIZE: XXL MATERIAL: Holz variant 2 features: COLOR: rot SIZE: L MATERIAL: Stahl Actual output: { {{productFeatureTypeId=COLOR, description=Farbbezeichnung}, {productFeatureId=COLOR_BLAU, description=blau}, {productFeatureId=COLOR_ROT, description=rot}}, {{productFeatureTypeId=COLOR, description=Farbbezeichnung}, {productFeatureId=COLOR_BLAU, description=blau}, {productFeatureId=COLOR_ROT, description=rot}}, {{productFeatureTypeId=COLOR, description=Farbbezeichnung}, {productFeatureId=COLOR_BLAU, description=blau}, {productFeatureId=COLOR_ROT, description=rot}}, {{productFeatureTypeId=SIZE, description=Größe}, {productFeatureId=SIZE_XXL, description=XXL}, {productFeatureId=SIZE_L, description=L}}, {{productFeatureTypeId=SIZE, description=Größe}, {productFeatureId=SIZE_XXL, description=XXL}, {productFeatureId=SIZE_L, description=L}} {{productFeatureTypeId=SIZE, description=Größe}, {productFeatureId=SIZE_XXL, description=XXL}, {productFeatureId=SIZE_L, description=L}}, {{productFeatureTypeId=MATERIAL, description=Material}, {productFeatureId=MATERIAL_HOLZ, description=Holz}, {productFeatureId=MATERIAL_STAHL, description=Stahl}}, {{productFeatureTypeId=MATERIAL, description=Material}, {productFeatureId=MATERIAL_HOLZ, description=Holz}, {productFeatureId=MATERIAL_STAHL, description=Stahl}} } Expected output: { {{productFeatureTypeId=COLOR, description=Farbbezeichnung}, {productFeatureId=COLOR_BLAU, description=blau}, {productFeatureId=COLOR_ROT, description=rot}}, {{productFeatureTypeId=SIZE, description=Größe}, {productFeatureId=SIZE_XXL, description=XXL}, {productFeatureId=SIZE_L, description=L}}, {{productFeatureTypeId=MATERIAL, description=Material}, {productFeatureId=MATERIAL_HOLZ, description=Holz}, {productFeatureId=MATERIAL_STAHL, description=Stahl}} } Patch: Moved a statement out of a for loop to the correct place. JLR: tested with WebPos Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1137435&r1=1137434&r2=1137435&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Sun Jun 19 21:07:27 2011 @@ -460,10 +460,10 @@ public class ProductWorker { } } featureList.add(featureData); - if (oldType != null) { - // last map - featureTypeFeatures.add(featureList); - } + } + if (oldType != null) { + // last map + featureTypeFeatures.add(featureList); } } catch (GenericEntityException e) { Debug.logError(e, module); |
Free forum by Nabble | Edit this page |