svn commit: r598148 - in /ofbiz/trunk/applications/order: entitydef/eecas.xml servicedef/services.xml src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh webapp/ordermgr/order/orderpaymentinfo.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r598148 - in /ofbiz/trunk/applications/order: entitydef/eecas.xml servicedef/services.xml src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh webapp/ordermgr/order/orderpaymentinfo.ftl

apatel-2
Author: apatel
Date: Sun Nov 25 22:56:30 2007
New Revision: 598148

URL: http://svn.apache.org/viewvc?rev=598148&view=rev
Log:
Now tracking orderPaymentPreference status change. Thanks to Vikas for providing this patch.

Modified:
    ofbiz/trunk/applications/order/entitydef/eecas.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl

Modified: ofbiz/trunk/applications/order/entitydef/eecas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/eecas.xml?rev=598148&r1=598147&r2=598148&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/eecas.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/eecas.xml Sun Nov 25 22:56:30 2007
@@ -42,4 +42,8 @@
         <action service="checkUpdateQuoteStatus" mode="sync"/>
     </eca>
 
+    <eca entity="OrderPaymentPreference" operation="create-store" event="return">
+        <condition field-name="orderPaymentPreferenceId" operator="is-not-empty"/>
+        <action service="changeOrderPaymentStatus" mode="sync"/>
+    </eca>
 </entity-eca>

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=598148&r1=598147&r2=598148&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Sun Nov 25 22:56:30 2007
@@ -257,6 +257,7 @@
         <attribute name="orderTypeId" type="String" mode="OUT" optional="true"/>
         <attribute name="needsInventoryIssuance" type="String" mode="OUT" optional="true"/>
         <attribute name="grandTotal" type="Double" mode="OUT" optional="true"/>
+        <attribute name="changeReason" type="String" mode="IN" optional="true"/>
     </service>
 
     <service name="changeOrderItemStatus" engine="java" auth="true"
@@ -267,6 +268,7 @@
         <attribute name="fromStatusId" type="String" mode="IN" optional="true"/>
         <attribute name="statusId" type="String" mode="IN" optional="false"/>
         <attribute name="statusDateTime" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="changeReason" type="String" mode="IN" optional="true"/>
     </service>
 
     <service name="cancelOrderItem" engine="java" auth="true"

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=598148&r1=598147&r2=598148&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sun Nov 25 22:56:30 2007
@@ -2296,15 +2296,16 @@
 
     public static List getOrderHeaderStatuses(List orderStatuses) {
         List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null));
-        List contraints2 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
-        List contraints3 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, ""));
+        contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+        contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, ""));
+        
+        List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null));
+        contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+        contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, ""));
+        
         List newOrderStatuses = FastList.newInstance();
-
-        newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints1));
-        newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints2));
-        newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints3));
-        newOrderStatuses = EntityUtil.orderBy(newOrderStatuses, UtilMisc.toList("-statusDatetime"));
-        return newOrderStatuses;
+        newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1));
+        return EntityUtil.orderBy(EntityUtil.filterByOr(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
     }
 
     public static BigDecimal getOrderAdjustmentsTotal(List orderItems, List adjustments) {
@@ -2534,7 +2535,14 @@
     }
 
     public static List getOrderItemStatuses(GenericValue orderItem, List orderStatuses) {
-        return EntityUtil.orderBy(EntityUtil.filterByAnd(orderStatuses, UtilMisc.toMap("orderItemSeqId", orderItem.get("orderItemSeqId"))), UtilMisc.toList("-statusDatetime"));
+        List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, orderItem.get("orderItemSeqId")));
+        List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null));
+        contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+        contraints2.add(new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, ""));
+        
+        List newOrderStatuses = FastList.newInstance();
+        newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints1));
+        return EntityUtil.orderBy(EntityUtil.filterByOr(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
     }
 
 
@@ -2772,5 +2780,21 @@
            Debug.logError(e, e.getMessage(), module);
        }
        return invoiced;
+   }
+
+   public List getOrderPaymentStatuses() {
+       return getOrderPaymentStatuses(getOrderStatuses());
+   }
+
+   public static List getOrderPaymentStatuses(List orderStatuses) {
+       List contraints1 = UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null));
+       contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+       contraints1.add(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, ""));
+      
+       List contraints2 = UtilMisc.toList(new EntityExpr("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null));
+       List newOrderStatuses = FastList.newInstance();
+       newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1));
+      
+       return EntityUtil.orderBy(EntityUtil.filterByAnd(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
    }
 }

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh?rev=598148&r1=598147&r2=598148&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh Sun Nov 25 22:56:30 2007
@@ -65,28 +65,28 @@
 Timestamp yearBegin = new Timestamp(cal.getTime().getTime());      
   
 // order status report
-List dayList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin)));
+List dayList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin)));
 context.put("dayOrder", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_ORDERED")));
 context.put("dayApprove", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_APPROVED")));
 context.put("dayComplete", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_COMPLETED")));
 context.put("dayCancelled", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_CANCELLED")));
 context.put("dayRejected", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_REJECTED")));
   
-List weekList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin)));
+List weekList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin)));
 context.put("weekOrder", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_ORDERED")));
 context.put("weekApprove", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_APPROVED")));
 context.put("weekComplete", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_COMPLETED")));
 context.put("weekCancelled", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_CANCELLED")));
 context.put("weekRejected", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_REJECTED")));
   
-List monthList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin)));
+List monthList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin)));
 context.put("monthOrder", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_ORDERED")));
 context.put("monthApprove", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_APPROVED")));
 context.put("monthComplete", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_COMPLETED")));
 context.put("monthCancelled", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_CANCELLED")));
 context.put("monthRejected", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_REJECTED")));
   
-List yearList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin)));
+List yearList = delegator.findByAnd("OrderStatus", UtilMisc.toList(new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, null), new EntityExpr("orderPaymentPreferenceId", EntityOperator.EQUALS, null), new EntityExpr("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin)));
 context.put("yearOrder", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_ORDERED")));
 context.put("yearApprove", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_APPROVED")));
 context.put("yearComplete", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_COMPLETED")));

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl?rev=598148&r1=598147&r2=598148&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderpaymentinfo.ftl Sun Nov 25 22:56:30 2007
@@ -24,6 +24,27 @@
   </div>
   <div class="screenlet-body">
      <table width="100%" border="0" cellpadding="1" cellspacing="0"><tbody>
+     <#-- order payment status -->
+     <tr>
+       <td align="center" valign="top" width="25%">
+         <div class="tabletext">&nbsp;<b>${uiLabelMap.OrderStatusHistory}</b></div>
+       </td>
+       <td width="15">&nbsp;</td>
+       <td>
+         <#assign orderPaymentStatuses = orderReadHelper.getOrderPaymentStatuses()>
+         <#if orderPaymentStatuses?has_content>
+           <#list orderPaymentStatuses as orderPaymentStatus>
+             <#assign statusItem = orderPaymentStatus.getRelatedOne("StatusItem")>
+             <div class="tabletext">
+               ${statusItem.get("description",locale)} - ${orderPaymentStatus.statusDatetime?default("0000-00-00 00:00:00")?string}
+               &nbsp;
+               ${uiLabelMap.CommonBy} - [${orderPaymentStatus.statusUserLogin}]
+             </div>
+           </#list>
+         </#if>
+       </td>
+     </tr>
+     <tr><td colspan="3"><hr class="sepbar"/></td></tr>
      <#if orderPaymentPreferences?has_content || billingAccount?has_content || invoices?has_content>
         <#list orderPaymentPreferences as orderPaymentPreference>
           <#assign pmBillingAddress = {}>