[OFBiz] SVN: r6528 - trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart

sichen@svn.ofbiz.org sichen at svn.ofbiz.org
Thu Jan 19 09:34:58 CST 2006


Author: sichen
Date: 2006-01-19 09:34:54 -0600 (Thu, 19 Jan 2006)
New Revision: 6528

Modified:
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh
Log:
Fixed order entry quick product lookup to handle cases where isVirtual is null (which means product is not virtual)

Modified: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh	2006-01-19 00:35:43 UTC (rev 6527)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh	2006-01-19 15:34:54 UTC (rev 6528)
@@ -19,6 +19,9 @@
  *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
+ * @author Mu Jinsong (mujinsong at opensourcestrategies.com)
+ * @author Si Chen (sichen at opensourcestrategies.com)
+ *
  */
 
 import org.ofbiz.entity.condition.EntityExpr;
@@ -31,14 +34,29 @@
 productId = request.getParameter("productId");
 
 conditionList = new LinkedList();
+orConditionList = new LinkedList();
+mainConditionList = new LinkedList();
+
 //make sure the look up is case insensitive
 conditionList.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("productId")),
         EntityOperator.LIKE, "%" + productId.toUpperCase() + "%"));
 
+// do not include configurabl products
 conditionList.add(new EntityExpr("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED"));
-conditionList.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
-conditions = new EntityConditionList(conditionList,EntityOperator.AND);
 
-productList = delegator.findByCondition("Product", conditions, UtilMisc.toList("productId", "brandName", "internalName"), UtilMisc.toList("productId"));
+// no virtual products: note that isVirtual could be null, which in some databases is different than isVirtual != "Y".
+// we consider those products to be non-virtual and hence addable to the order in bulk
+orConditionList.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
+orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, "N"));
+orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, null));
+
+orConditions = new EntityConditionList(orConditionList, EntityOperator.OR);
+conditions = new EntityConditionList(conditionList, EntityOperator.AND);
+
+mainConditionList.add(orConditions);
+mainConditionList.add(conditions);
+mainConditions = new EntityConditionList(mainConditionList, EntityOperator.AND);
+
+productList = delegator.findByCondition("Product", mainConditions, UtilMisc.toList("productId", "brandName", "internalName"), UtilMisc.toList("productId"));
 context.put("productList",productList);
 



More information about the Svn mailing list