Author: lektran
Date: Mon Jul 7 04:04:31 2008 New Revision: 674448 URL: http://svn.apache.org/viewvc?rev=674448&view=rev Log: converted some bsh scripts to groovy Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy - copied, changed from r674244, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy - copied, changed from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh Removed: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy (from r674244, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh&r1=674244&r2=674448&rev=674448&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy Mon Jul 7 04:04:31 2008 @@ -23,22 +23,18 @@ import org.ofbiz.entity.condition.EntityFieldValue; import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityCondition; -import org.ofbiz.base.util.UtilMisc; -productId = request.getParameter("productId"); -if (productId == null) { - productId = ""; -} - -conditionList = new LinkedList(); -orConditionList = new LinkedList(); -mainConditionList = new LinkedList(); +productId = request.getParameter("productId") ?: ""; + +conditionList = []; +orConditionList = []; +mainConditionList = []; //make sure the look up is case insensitive conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), EntityOperator.LIKE, productId.toUpperCase() + "%")); -// do not include configurabl products +// do not include configurable products conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); // no virtual products: note that isVirtual could be null, which in some databases is different than isVirtual != "Y". @@ -54,7 +50,4 @@ mainConditionList.add(conditions); mainConditions = EntityCondition.makeCondition(mainConditionList, EntityOperator.AND); -productList = delegator.findList("Product", mainConditions, UtilMisc.toSet("productId", "brandName", "internalName"), UtilMisc.toList("productId"), null, false); -context.put("productList", productList); - - +context.productList = delegator.findList("Product", mainConditions, ["productId", "brandName", "internalName"] as Set, ["productId"], null, false); Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy (from r674416, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh&r1=674416&r2=674448&rev=674448&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy Mon Jul 7 04:04:31 2008 @@ -17,25 +17,18 @@ * under the License. */ -import org.ofbiz.entity.condition.EntityExpr; -import org.ofbiz.entity.condition.EntityFunction; -import org.ofbiz.entity.condition.EntityOperator; -import org.ofbiz.entity.condition.EntityFieldValue; -import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.*; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.order.shoppingcart.ShoppingCart; import org.ofbiz.order.shoppingcart.ShoppingCartEvents; -productId = request.getParameter("productId"); -if (productId == null) { - productId = ""; -} +productId = request.getParameter("productId") ?: ""; ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request); -conditionList = new LinkedList(); +conditionList = []; // make sure the look up is case insensitive conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), @@ -45,9 +38,9 @@ conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency())); conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND); -List selectedFields = UtilMisc.toSet("productId", "supplierProductId", "supplierProductName", "lastPrice", "minimumOrderQuantity"); +selectedFields = ["productId", "supplierProductId", "supplierProductName", "lastPrice", "minimumOrderQuantity"] as Set; selectedFields.add("availableFromDate"); selectedFields.add("availableThruDate"); -productList = delegator.findList("SupplierProduct", conditions, selectedFields, UtilMisc.toList("productId"), null, false); -productList = EntityUtil.filterByDate(productList, UtilDateTime.nowTimestamp(), "availableFromDate", "availableThruDate", true); -context.put("productList", productList); +productList = delegator.findList("SupplierProduct", conditions, selectedFields, ["productId"], null, false); + +context.productList = EntityUtil.filterByDate(productList, nowTimestamp, "availableFromDate", "availableThruDate", true); Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml?rev=674448&r1=674447&r2=674448&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Mon Jul 7 04:04:31 2008 @@ -171,7 +171,7 @@ <set field="titleProperty" value="PageTitleLookupBulkAddProduct"/> <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/> <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/> <!-- 10 rows seems more appropriate given screen size, etc. --> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml"> @@ -186,7 +186,7 @@ <section> <actions> <set field="title" value="Bulk Add Supplier Product"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddSupplierProducts.groovy"/> <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/> <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/> </actions> |
Free forum by Nabble | Edit this page |