You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/06/27 12:13:12 UTC

svn commit: r788945 - in /ofbiz/trunk/applications/order: config/ data/ src/org/ofbiz/order/order/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/order/ widget/ordermgr/

Author: ashish
Date: Sat Jun 27 10:13:11 2009
New Revision: 788945

URL: http://svn.apache.org/viewvc?rev=788945&view=rev
Log:
Applied patch from jira issue OFBIZ-2655 (Portlet to list Sales Orders placed on a day.)
Thanks Chirag for your contribution on this.

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl   (with props)
Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/trunk/applications/order/data/OrderPortletData.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderlist.ftl
    ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Sat Jun 27 10:13:11 2009
@@ -5667,6 +5667,9 @@
         <value xml:lang="zh">询价币种标识</value>
         <value xml:lang="zh_CN">报价单位标识</value>
     </property>
+    <property key="OrderOrderReceivedOn">
+        <value xml:lang="en">Order Recieved On</value>
+    </property>
     <property key="OrderOrderReturn">
         <value xml:lang="de">Retoure</value>
         <value xml:lang="en">Return</value>

Modified: ofbiz/trunk/applications/order/data/OrderPortletData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderPortletData.xml?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderPortletData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderPortletData.xml Sat Jun 27 10:13:11 2009
@@ -54,5 +54,14 @@
         editFormName="EditOrderByCustomer"
         editFormLocation="component://order/webapp/ordermgr/order/OrderForms.xml"/>
     <PortletPortletCategory portalPortletId="ListCustomerOrders" portletCategoryId="LIST_CUSTOMER_ORDER"/>
+    
+    <!-- List Todays Order -->
+    <PortletCategory portletCategoryId="LIST_TODAYS_ORDER" description="List of order(s) placed"/>
+    <PortalPortlet portalPortletId="ListSalesOrders"
+        portletName="List Sales Orders By Date"
+        screenName="ListSalesOrders"
+        screenLocation="component://order/widget/ordermgr/OrderViewScreens.xml"
+        description="List Sales Orders placed today" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW"/>
+    <PortletPortletCategory portalPortletId="ListSalesOrders" portletCategoryId="LIST_TODAYS_ORDER"/>
 
 </entity-engine-xml>

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java Sat Jun 27 10:13:11 2009
@@ -18,6 +18,7 @@
  */
 package org.ofbiz.order.order;
 
+import java.sql.Timestamp;
 import java.util.*;
 import javax.servlet.http.*;
 import javolution.util.*;
@@ -209,12 +210,19 @@
     /**
      * Get the OrderHeaders corresponding to the state.
      */
-    public List getOrders(String facilityId, GenericDelegator delegator) throws GenericEntityException {
+    public List getOrders(String facilityId, Timestamp filterDate, GenericDelegator delegator) throws GenericEntityException {
         List allConditions = new ArrayList();
 
         if (facilityId != null) {
             allConditions.add(EntityCondition.makeCondition("originFacilityId", EntityOperator.EQUALS, facilityId));
         }
+        
+        if (filterDate != null) {
+            List andExprs = new ArrayList();
+            andExprs.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.getDayStart(filterDate)));
+            andExprs.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.getDayEnd(filterDate)));
+            allConditions.add(EntityCondition.makeCondition(andExprs, EntityOperator.AND));
+        }
 
         List statusConditions = new ArrayList();
         for (Iterator iter = orderStatusState.keySet().iterator(); iter.hasNext(); ) {

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy Sat Jun 27 10:13:11 2009
@@ -46,7 +46,7 @@
 }
 context.hasPermission = hasPermission;
 
-orderHeaderList = state.getOrders(facilityId, delegator);
+orderHeaderList = state.getOrders(facilityId, filterDate, delegator);
 context.orderHeaderList = orderHeaderList;
 
 // a list of order type descriptions
@@ -54,3 +54,5 @@
 ordertypes.each { type ->
     context["descr_" + type.orderTypeId] = type.get("description",locale);
 }
+
+context.filterDate = filterDate;

Added: ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl?rev=788945&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl Sat Jun 27 10:13:11 2009
@@ -0,0 +1,75 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<div id="findOrdersList" class="screenlet">
+  <div class="screenlet-title-bar">
+    <ul>
+      <li class="h3">${uiLabelMap.OrderOrderReceivedOn} ${Static["org.ofbiz.base.util.UtilDateTime"].toDateString(filterDate)}</li>
+      <#assign listSize = state.getSize()>
+      <#if (listSize > 10)>
+        <li><a href="/ordermgr/control/orderlist?viewIndex=${state.getViewIndex() + 1}&viewSize=${state.getViewSize()}&filterDate=${filterDate?if_exists}">${uiLabelMap.CommonMore}</a></li>
+      </#if>
+      <#if orderHeaderList?has_content> 
+        <li>1-${orderHeaderList.size()} ${uiLabelMap.CommonOf} ${state.getSize()}</li>
+      </#if>
+    </ul>
+    <br class="clear"/>
+  </div>
+  <div class="screenlet-body">
+    <table class="basic-table hover-bar" cellspacing='0'>
+      <tr class="header-row">
+        <td width="20%">${uiLabelMap.OrderOrder} #</td>
+        <td width="25%">${uiLabelMap.OrderOrderBillToParty}</td>
+        <td width="15%">${uiLabelMap.CommonAmount}</td>
+        <td width="20%">${uiLabelMap.OrderTrackingCode}</td>
+        <td width="20%">${uiLabelMap.CommonStatus}</td>
+      </tr>
+      <#assign alt_row = false>
+      <#list orderHeaderList as orderHeader>
+        <#assign status = orderHeader.getRelatedOneCache("StatusItem")>
+        <#assign orh = Static["org.ofbiz.order.order.OrderReadHelper"].getHelper(orderHeader)>
+        <#assign billToParty = orh.getBillToParty()?if_exists>
+        <#if billToParty?has_content>
+          <#assign billToPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", billToParty.partyId, "compareDate", orderHeader.orderDate, "userLogin", userLogin))/>
+          <#assign billTo = billToPartyNameResult.fullName?default("[${uiLabelMap.OrderPartyNameNotFound}]")/>
+        </#if>
+        <tr<#if alt_row> class="alternate-row"</#if>>
+          <#assign alt_row = !alt_row>
+          <td>
+            <a href="/ordermgr/control/orderview?orderId=${orderHeader.orderId}" class="buttontext">${orderHeader.orderId}</a>
+          </td>
+          <td>${billTo?if_exists}</td>
+          <td><@ofbizCurrency amount=orderHeader.grandTotal isoCode=orderHeader.currencyUom/></td>
+          <td>
+            <#assign trackingCodes = orderHeader.getRelated("TrackingCodeOrder")>
+            <#list trackingCodes as trackingCode>
+              <#if trackingCode?has_content>
+                <a href="/marketing/control/FindTrackingCodeOrders?trackingCodeId=${trackingCode.trackingCodeId}&externalLoginKey=${requestAttributes.externalLoginKey?if_exists}">${trackingCode.trackingCodeId}</a><br/>
+              </#if>
+            </#list>
+          </td>
+          <td>${orderHeader.getRelatedOneCache("StatusItem").get("description",locale)}</td>
+        </tr>
+      </#list>
+      <#if !orderHeaderList?has_content>
+        <tr><td colspan="9"><h3>${uiLabelMap.OrderNoOrderFound}</h3></td></tr>
+      </#if>
+    </table>
+  </div>
+</div>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/order/OrderListByDate.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderlist.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderlist.ftl?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderlist.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderlist.ftl Sat Jun 27 10:13:11 2009
@@ -40,12 +40,12 @@
          <tr>
         <td>
           <#if state.hasPrevious()>
-            <a href="<@ofbizUrl>orderlist?viewIndex=${state.getViewIndex() - 1}&viewSize=${state.getViewSize()}</...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a>
+            <a href="<@ofbizUrl>orderlist?viewIndex=${state.getViewIndex() - 1}&viewSize=${state.getViewSize()}&filterDate=${filterDate?if_exists}</...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a>
           </#if>
         </td>
         <td align="right">
           <#if state.hasNext()>
-            <a href="<@ofbizUrl>orderlist?viewIndex=${state.getViewIndex() + 1}&viewSize=${state.getViewSize()}</...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+            <a href="<@ofbizUrl>orderlist?viewIndex=${state.getViewIndex() + 1}&viewSize=${state.getViewSize()}&filterDate=${filterDate?if_exists}</...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
           </#if>
         </td>
       </tr>

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?rev=788945&r1=788944&r2=788945&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Sat Jun 27 10:13:11 2009
@@ -168,6 +168,7 @@
             <actions>
                 <set field="titleProperty" value="OrderLookupOrder"/>
                 <set field="headerItem" value="orderlist"/>
+                <set field="filterDate" type="Timestamp" from-field="parameters.filterDate"/>
                 <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy"/>
                 <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy"/>
             </actions>
@@ -453,5 +454,29 @@
             </widgets>
         </section> 
     </screen>
+    
+    <screen name="ListSalesOrders">
+        <section>
+            <actions>
+                <set field="filterDate" type="Timestamp" value="${nowTimestamp}"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy"/>
+            </actions>
+            <widgets>
+                <section>
+                    <condition>
+                        <if-has-permission permission="ORDERMGR" action="_VIEW"/>
+                    </condition>
+                    <widgets>
+                        <platform-specific>
+                            <html><html-template location="component://order/webapp/ordermgr/order/OrderListByDate.ftl"/></html>
+                        </platform-specific>
+                    </widgets>
+                    <fail-widgets>
+                        <label style="h3" text="${uiLabelMap.OrderViewPermissionError}"/>
+                    </fail-widgets>
+                </section>
+            </widgets>
+        </section>
+    </screen>
 
 </screens>
\ No newline at end of file