svn commit: r535096 - in /ofbiz/trunk/applications/ecommerce: config/ webapp/ecommerce/WEB-INF/actions/order/ webapp/ecommerce/order/

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

svn commit: r535096 - in /ofbiz/trunk/applications/ecommerce: config/ webapp/ecommerce/WEB-INF/actions/order/ webapp/ecommerce/order/

hansbak-2
Author: hansbak
Date: Thu May  3 22:15:14 2007
New Revision: 535096

URL: http://svn.apache.org/viewvc?view=rev&rev=535096
Log:
first contribution by Wisut, in the ecommerce not only show orders entered, but also show purchase orders send to this party. To allow drop shippers to view their orders.

Modified:
    ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderhistory.bsh
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderheader.ftl
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderhistory.ftl
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl

Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties (original)
+++ ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties Thu May  3 22:15:14 2007
@@ -455,7 +455,8 @@
 OrderVerifyConfiguration=Verify Configuration
 OrderWhereShallWeShipIt=Where shall we ship it
 OrderYesIsAGift=Yes, Is A Gift
-
+OrderSalesHistory=Order history for orders entered by you
+OrderPurchaseHistory=Order history for orders send to you
 PageTitleAddContent=Add Content
 PageTitleAddResponse=Add Response
 PageTitleAdditionalInfo=Additional Info

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderhistory.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderhistory.bsh?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderhistory.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderhistory.bsh Thu May  3 22:15:14 2007
@@ -21,7 +21,13 @@
 import org.ofbiz.entity.*;
 import org.ofbiz.entity.util.*;
 import org.ofbiz.entity.condition.*;
-
+GenericValue partyRole = delegator.findByPrimaryKey("PartyRole",UtilMisc.toMap("partyId", userLogin.get("partyId"),"roleTypeId","SUPPLIER"));
+if((partyRole != null) && (partyRole.get("roleTypeId").equals("SUPPLIER"))){
+    /** drop shipper or supplier **/
+    porderRoleCollection = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "SUPPLIER_AGENT"));
+    porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", porderRoleCollection), UtilMisc.toList(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),new EntityExpr("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER"))), UtilMisc.toList("orderDate DESC"));
+    context.put("porderHeaderList", porderHeaderList);
+}
 orderRoleCollection = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "PLACING_CUSTOMER"));
 orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", orderRoleCollection), UtilMisc.toList(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"))), UtilMisc.toList("orderDate DESC"));
 context.put("orderHeaderList", orderHeaderList);

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh Thu May  3 22:15:14 2007
@@ -45,11 +45,18 @@
 boolean isDemoStore = true;
 if (orderId != null && orderId.length() > 0) {
     orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
-    
+    if((orderHeader != null) && (orderHeader.get("orderTypeId").equals("PURCHASE_ORDER"))){
+        //drop shipper or supplier
+        roleTypeId = "SUPPLIER_AGENT";
+    }else{
+        //customer
+        roleTypeId = "PLACING_CUSTOMER";
+    }
+    context.put("roleTypeId",roleTypeId);
     // check OrderRole to make sure the user can view this order.  This check must be done for any order which is not anonymously placed and
     // any anonymous order when the allowAnonymousView security flag (see above) is not set to Y, to prevent peeking
     if ((orderHeader != null) && (!("anonymous".equals(orderHeader.getString("createdBy"))) || ("anonymous".equals(orderHeader.getString("createdBy")) && !"Y".equals(allowAnonymousView)))) {
-        orderRole = EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "partyId", partyId, "roleTypeId", "PLACING_CUSTOMER")));
+        orderRole = EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "partyId", partyId, "roleTypeId", roleTypeId)));
         
         if (userLogin == null || orderRole == null) {
             context.remove("orderHeader");
@@ -77,7 +84,7 @@
     orderTaxTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false);
     orderTaxTotal += OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false);
     
-    placingCustomerOrderRoles = delegator.findByAnd("OrderRole",UtilMisc.toMap("orderId", orderId, "roleTypeId", "PLACING_CUSTOMER"));
+    placingCustomerOrderRoles = delegator.findByAnd("OrderRole",UtilMisc.toMap("orderId", orderId, "roleTypeId", roleTypeId));
     placingCustomerOrderRole = EntityUtil.getFirst(placingCustomerOrderRoles);        
     placingCustomerPerson = placingCustomerOrderRole == null ? null : delegator.findByPrimaryKey("Person",UtilMisc.toMap("partyId", placingCustomerOrderRole.getString("partyId")));
 

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderheader.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderheader.ftl?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderheader.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderheader.ftl Thu May  3 22:15:14 2007
@@ -29,7 +29,7 @@
     <div class="screenlet">
         <div class="screenlet-header">
             <div class="boxlink">
-                <#if maySelectItems?default("N") == "Y" && returnLink?default("N") == "Y" && (orderHeader.statusId)?if_exists == "ORDER_COMPLETED">
+                <#if maySelectItems?default("N") == "Y" && returnLink?default("N") == "Y" && (orderHeader.statusId)?if_exists == "ORDER_COMPLETED" && roleTypeId?if_exists == "PLACING_CUSTOMER">
                     <a href="<@ofbizUrl>makeReturn?orderId=${orderHeader.orderId}</@ofbizUrl>" class="submenutextright">${uiLabelMap.OrderRequestReturn}</a>
                 </#if>
             </div>

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderhistory.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderhistory.ftl?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderhistory.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderhistory.ftl Thu May  3 22:15:14 2007
@@ -24,7 +24,7 @@
             <a href="<@ofbizUrl>main</@ofbizUrl>" class="lightbuttontext">[${uiLabelMap.OrderBackHome}]</a>
         </div>
         -->
-        <div class="boxhead">${uiLabelMap.OrderHistory}</div>
+        <div class="boxhead">${uiLabelMap.OrderSalesHistory}</div>
     </div>
     <div class="screenlet-body">
         <table width="100%" cellpadding="1" cellspacing="0" border="0">
@@ -78,7 +78,64 @@
         </table>
     </div>
 </div>
-
+    <div class="screenlet">
+        <div class="screenlet-header">
+        <div class="boxhead">${uiLabelMap.OrderPurchaseHistory}</div>
+    </div>
+    <div class="screenlet-body">
+        <table width="100%" cellpadding="1" cellspacing="0" border="0">
+          <tr>
+            <td width="30%">
+              <div class="tabletext"><b>${uiLabelMap.CommonDate}</b></div>
+            </td>
+            <td width="10">&nbsp;</td>
+            <td width="15%">
+              <div class="tabletext"><b><span style="white-space: nowrap;">${uiLabelMap.OrderOrder} ${uiLabelMap.OrderNbr}</span></b></div>
+            </td>
+            <td width="10">&nbsp;</td>
+            <td width="15%">
+              <div class="tabletext"><b>${uiLabelMap.CommonAmount}</b></div>
+            </td>
+            <td width="10">&nbsp;</td>
+            <td width="15%">
+              <div class="tabletext"><b>${uiLabelMap.CommonStatus}</b></div>
+            </td>
+            <td width="10">&nbsp;</td>
+            <td width="15%"><b></b></td>                
+          </tr>
+ <#if porderHeaderList?has_content>
+          <#list porderHeaderList as porderHeader>
+            <#assign pstatus = porderHeader.getRelatedOneCache("StatusItem")>                              
+            <tr><td colspan="9"><hr class="sepbar"/></td></tr>
+            <tr>
+              <td>
+                <div class="tabletext"><span style="white-space: nowrap;">${porderHeader.orderDate.toString()}</span></div>
+              </td>
+              <td width="10">&nbsp;</td>
+              <td>
+                <div class="tabletext">${porderHeader.orderId}</div>
+              </td>
+              <td width="10">&nbsp;</td>
+              <td>
+                <div class="tabletext"><@ofbizCurrency amount=porderHeader.grandTotal isoCode=porderHeader.currencyUom/></div>
+              </td>
+              <td width="10">&nbsp;</td>
+              <td>
+                <div class="tabletext">${pstatus.get("description",locale)}</div>
+              </td>
+              <td width="10">&nbsp;</td>
+              <td align="right">
+                <a href="<@ofbizUrl>orderstatus?orderId=${porderHeader.orderId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonView}</a>
+              </td>
+            </tr>
+          </#list>
+ </#if>
+          <#if !porderHeaderList?has_content>
+            <tr><td colspan="9"><div class="head3">${uiLabelMap.OrderNoOrderFound}</div></td></tr>
+          </#if>
+        </table>
+    </div>
+</div>
 <div class="screenlet">
     <div class="screenlet-header">
         <div class="boxhead">${uiLabelMap.EcommerceDownloadsAvailableTitle}</div>

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl?view=diff&rev=535096&r1=535095&r2=535096
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl Thu May  3 22:15:14 2007
@@ -25,7 +25,7 @@
     <div class="screenlet-header">
         <div class="boxlink">
             <#assign numColumns = 8>
-            <#if maySelectItems?default("N") == "Y">
+            <#if maySelectItems?default("N") == "Y" && roleTypeId?if_exists == "PLACING_CUSTOMER">
                 <#assign numColumns = 11>
                 <a href="javascript:document.addCommonToCartForm.add_all.value='true';document.addCommonToCartForm.submit()" class="submenutext">${uiLabelMap.EcommerceAddAlltoCart}</a><a href="javascript:document.addCommonToCartForm.add_all.value='false';document.addCommonToCartForm.submit()" class="submenutext">${uiLabelMap.EcommerceAddCheckedToCart}</a><a href="<@ofbizUrl>createShoppingListFromOrder?orderId=${orderHeader.orderId}&frequency=6&intervalNumber=1&shoppingListTypeId=SLT_AUTO_REODR</@ofbizUrl>" class="submenutextright">${uiLabelMap.OrderSendMeThisEveryMonth}</a>
             </#if>
@@ -50,7 +50,7 @@
             <td width="10%" align="right"><span class="tableheadtext"><b>${uiLabelMap.EcommerceUnitPrice}</b></span></td>
             <td width="10%" align="right"><span class="tableheadtext"><b>${uiLabelMap.OrderAdjustments}</b></span></td>
             <td width="10%" align="right"><span class="tableheadtext"><b>${uiLabelMap.CommonSubtotal}</b></span></td>
-            <#if maySelectItems?default("N") == "Y">
+            <#if maySelectItems?default("N") == "Y" && roleTypeId?if_exists == "PLACING_CUSTOMER">
               <td colspan="3" width="5%" align="right">&nbsp;</td>
             </#if>
           </tr>
@@ -166,7 +166,7 @@
                   <div class="tabletext"><@ofbizCurrency amount=localOrderReadHelper.getOrderItemTotal(orderItem) isoCode=currencyUomId/></div>
                 </#if>
                 </td>                    
-                <#if maySelectItems?default("N") == "Y">
+                <#if maySelectItems?default("N") == "Y" && roleTypeId?if_exists == "PLACING_CUSTOMER">
                   <td>&nbsp;</td>
                   <#if (orderHeader.statusId != "ORDER_SENT" && orderItem.statusId != "ITEM_COMPLETED" && orderItem.statusId != "ITEM_CANCELLED" && pickedQty == 0)>
                     <td><a href="<@ofbizUrl>cancelOrderItem?orderId=${orderItem.orderId}&amp;orderItemSeqId=${orderItem.orderItemSeqId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonCancel}</a></td>