Author: jleroux Date: Sat Oct 28 01:34:59 2006 New Revision: 468662 URL: http://svn.apache.org/viewvc?view=rev&rev=468662 Log: A patch from Iain Fogg adressing an issue related to "POS Multiple bar code product match" (https://issues.apache.org/jira/browse/OFBIZ-238)
Modified: incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/event/MenuEvents.java Modified: incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/event/MenuEvents.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/event/MenuEvents.java?view=diff&rev=468662&r1=468661&r2=468662 ============================================================================== --- incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/event/MenuEvents.java (original) +++ incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/event/MenuEvents.java Sat Oct 28 01:34:59 2006 @@ -16,6 +16,7 @@ package org.ofbiz.pos.event; import java.util.List; +import java.util.ListIterator; import java.awt.AWTEvent; import org.ofbiz.base.util.UtilValidate; @@ -143,11 +144,21 @@ String productId = null; try { List items = trans.lookupItem(value); - if (items != null && items.size() == 1) { - GenericValue product = EntityUtil.getFirst(items); - productId = product.getString("productId"); - } else if (items != null && items.size() > 0) { - Debug.logInfo("Multiple products found; need to select one from the list", module); + if (items != null) { + ListIterator it = items.listIterator(); + if (it.hasNext()) { + GenericValue product = (GenericValue) it.next(); + productId = product.getString("productId"); + + while (it.hasNext()) { + product = (GenericValue) it.next(); + if (!productId.equals(product.getString("productId"))) { + productId = null; + Debug.logInfo("Multiple products found; need to select one from the list", module); + break; + } + } + } } } catch (GeneralException e) { Debug.logError(e, module);