Author: lektran
Date: Fri Aug 22 22:20:46 2008 New Revision: 688263 URL: http://svn.apache.org/viewvc?rev=688263&view=rev Log: Converted the last of the bsh files in the applications directory to groovy Added: ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.groovy - copied, changed from r688198, ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.bsh ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.groovy - copied, changed from r688198, ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.bsh Removed: ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.bsh ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.bsh Modified: ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Modified: ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml?rev=688263&r1=688262&r2=688263&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml Fri Aug 22 22:20:46 2008 @@ -48,7 +48,7 @@ <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/popup.js" global="true"/> <set field="layoutSettings.extraHead" value="<link rel="stylesheet" href="/content/images/contentForum.css" type="text/css"/>" global="true"/> - <script location="component://ecommerce/widget/EcommerceSetup.bsh"/> + <script location="component://ecommerce/widget/EcommerceSetup.groovy"/> <!-- The default (main) stylesheets --> <set field="layoutSettings.styleSheets[+0]" value="/ecommerce/images/blog.css" global="true"/> Copied: ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.groovy (from r688198, ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.groovy?p2=ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.groovy&p1=ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.bsh&r1=688198&r2=688263&rev=688263&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.bsh (original) +++ ofbiz/trunk/applications/ecommerce/widget/EcommerceSetup.groovy Fri Aug 22 22:20:46 2008 @@ -29,14 +29,13 @@ productStore = ProductStoreWorker.getProductStore(request); prodCatalog = CatalogWorker.getProdCatalog(request); -if (prodCatalog != null) { - catalogStyleSheet = prodCatalog.get("styleSheet"); - if (catalogStyleSheet != null) globalContext.put("catalogStyleSheet", catalogStyleSheet); - catalogHeaderLogo = prodCatalog.get("headerLogo"); - if (catalogHeaderLogo != null) globalContext.put("catalogHeaderLogo", catalogHeaderLogo); +if (prodCatalog) { + catalogStyleSheet = prodCatalog.styleSheet; + if (catalogStyleSheet) globalContext.catalogStyleSheet = catalogStyleSheet; + catalogHeaderLogo = prodCatalog.headerLogo; + if (catalogHeaderLogo) globalContext.catalogHeaderLogo = catalogHeaderLogo; } -globalContext.put("productStore", productStore); -globalContext.put("checkLoginUrl", LoginWorker.makeLoginUrl(request, "checkLogin")); -globalContext.put("catalogQuickaddUse", CatalogWorker.getCatalogQuickaddUse(request)); - +globalContext.productStore = productStore; +globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin"); +globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=688263&r1=688262&r2=688263&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri Aug 22 22:20:46 2008 @@ -1476,11 +1476,11 @@ <handler name="jasperreportspdf" type="view" class="org.ofbiz.webapp.view.JasperReportsPdfViewHandler"/> to the handler section of this file and uncomment the following lines: <request-map uri="orderreportjasper.pdf"><security https="true" auth="true"/> - <event type="bsf" path="/reports/" invoke="OrderReportPrepare.bsh"/> + <event type="bsf" path="/reports/" invoke="OrderReportPrepare.groovy"/> <response name="success" type="view" value="orderreportjasper"/> </request-map> <request-map uri="orderitemreportjasper.pdf"><security https="true" auth="true"/> - <event type="bsf" path="/reports/" invoke="OrderReportPrepare.bsh"/> + <event type="bsf" path="/reports/" invoke="OrderReportPrepare.groovy"/> <response name="success" type="view" value="orderitemreportjasper"/> </request-map> <request-map uri="orderreportlist"> Copied: ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.groovy (from r688198, ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.bsh&r1=688198&r2=688263&rev=688263&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderReportPrepare.groovy Fri Aug 22 22:20:46 2008 @@ -23,7 +23,7 @@ import org.ofbiz.base.util.*; import org.ofbiz.content.report.*; -GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); +delegator = request.getAttribute("delegator"); fromDateStr = request.getParameter("fromDate"); toDateStr = request.getParameter("toDate"); @@ -31,48 +31,37 @@ fromDate = null; toDate = null; try { - if (fromDateStr != null && fromDateStr.length() != 0) { + if (fromDateStr) { fromDate = Timestamp.valueOf(fromDateStr); } -} catch (Exception e) { - Debug.logError(e); -} -try { - if (toDateStr != null && toDateStr.length() != 0) { + if (toDateStr) { toDate = Timestamp.valueOf(toDateStr); } } catch (Exception e) { - Debug.log(e); + Debug.logError(e); } - /* we'll have to work on getting this to work again, maybe with the ad-hoc view entity feature... -String groupName = request.getParameter("groupName"); +groupName = request.getParameter("groupName"); if (groupName.equals("product")) { groupName = "order_item.product_id"; reportName = "orderitemreport.jasper"; -} -if (groupName.equals("orderStatus")) { +} else if (groupName.equals("orderStatus")) { groupName = "status_item.description"; reportName = "orderreport.jasper"; -} -if (groupName.equals("itemStatus")) { +} else if (groupName.equals("itemStatus")) { groupName = "item_status.description"; reportName = "orderitemreport.jasper"; -} -if (groupName.equals("adjustment")) { +} else if (groupName.equals("adjustment")) { groupName = "order_adjustment_type.description"; reportName = "orderitemreport.jasper"; -} -if (groupName.equals("ship")) { +} else if (groupName.equals("ship")) { groupName = "concat(concat(order_shipment_preference.carrier_party_id, ' - '), shipment_method_type.description)"; reportName = "orderreport.jasper"; -} -if (groupName.equals("payment")) { +} else if (groupName.equals("payment")) { groupName = "payment_method_type.description"; reportName = "orderreport.jasper"; -} -if (groupName.length() < 4) { +} else if (groupName.length() < 4) { groupName = "status_item.description"; reportName = "orderreport.jasper"; } @@ -81,23 +70,23 @@ sbSql.append(" order_item.unit_price * order_item.quantity as purchaseAmount, "); */ -conditionList = new LinkedList(); -if (fromDate != null) { +conditionList = []; +if (fromDate) { conditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); } -if (toDate != null) { +if (toDate) { conditionList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, toDate)); } entityCondition = EntityCondition.makeCondition(conditionList, EntityOperator.AND); -orderByList = UtilMisc.toList("orderTypeId", "orderStatus"); +orderByList = ["orderTypeId", "orderStatus"]; eli = delegator.find("OrderReportView", entityCondition, null, null, orderByList, null); jrDataSource = new JREntityListIteratorDataSource(eli); -jrParameters = new HashMap(); -jrParameters.put("dateRange", fromDateStr + " - " + toDateStr); +jrParameters = [:]; +jrParameters.dateRange = fromDateStr + " - " + toDateStr; request.setAttribute("jrDataSource", jrDataSource); request.setAttribute("jrParameters", jrParameters); - + return "success"; |
Free forum by Nabble | Edit this page |