You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2009/05/01 15:04:24 UTC
svn commit: r770659 - in /ofbiz/trunk/applications/order: config/ data/
script/org/ofbiz/order/order/ servicedef/ src/org/ofbiz/order/shoppingcart/
webapp/ordermgr/entry/ webapp/ordermgr/order/ webapp/ordermgr/return/
Author: mor
Date: Fri May 1 13:04:24 2009
New Revision: 770659
URL: http://svn.apache.org/viewvc?rev=770659&view=rev
Log:
While doing a refund return, customer may want to purchase new items in exchange of returned items. A CSR can do this by creating an exchange order against the return.
To support this, new type EXCHANGE added for OrderItemAssocType.
Patch from Akash Jain (reviewd and tested by Pranay Pandey), part of OFBIZ-2377 (https://issues.apache.org/jira/browse/OFBIZ-2377)
Modified:
ofbiz/trunk/applications/order/config/OrderUiLabels.xml
ofbiz/trunk/applications/order/data/OrderTypeData.xml
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
ofbiz/trunk/applications/order/servicedef/secas.xml
ofbiz/trunk/applications/order/servicedef/services.xml
ofbiz/trunk/applications/order/servicedef/services_return.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl
ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri May 1 13:04:24 2009
@@ -2098,6 +2098,9 @@
<value xml:lang="zh">为询价å建请æ±</value>
<value xml:lang="zh_CN">为æ¥ä»·å»ºç«è¯·æ±</value>
</property>
+ <property key="OrderCreateExchangeOrder">
+ <value xml:lang="en">Create Exchange Order</value>
+ </property>
<property key="OrderCreateNewReturn">
<value xml:lang="de">Neue Retoure erstellen</value>
<value xml:lang="en">Create new return</value>
Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Fri May 1 13:04:24 2009
@@ -68,6 +68,7 @@
<OrderItemAssocType description="Drop Shipment" hasTable="N" orderItemAssocTypeId="DROP_SHIPMENT" parentTypeId=""/>
<OrderItemAssocType description="Return Replacement" hasTable="N" orderItemAssocTypeId="REPLACEMENT" parentTypeId=""/>
<OrderItemAssocType description="New Version" hasTable="N" orderItemAssocTypeId="NEW_VERSION" parentTypeId=""/>
+ <OrderItemAssocType description="Exchange Order" hasTable="N" orderItemAssocTypeId="EXCHANGE" parentTypeId=""/>
<EnumerationType description="Order Sales Channel" enumTypeId="ORDER_SALES_CHANNEL" hasTable="N" parentTypeId=""/>
<Enumeration description="Web Channel" enumCode="WEB_CHANNEL" enumId="WEB_SALES_CHANNEL" sequenceId="01" enumTypeId="ORDER_SALES_CHANNEL"/>
Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Fri May 1 13:04:24 2009
@@ -942,4 +942,94 @@
</else>
</if-compare>
</simple-method>
+
+ <simple-method method-name="createExchangeOrderAssoc" short-description="Associate exchange order with original order in OrderItemAssoc entity">
+ <entity-and entity-name="ReturnItem" list="returnItems">
+ <field-map field-name="orderId" from-field="parameters.originOrderId"/>
+ <field-map field-name="returnTypeId" value="RTN_REFUND"/>
+ </entity-and>
+ <set field="returnItemSize" value="${util:size(returnItems)}" type="Long"/>
+ <entity-and entity-name="OrderItem" list="orderItems">
+ <field-map field-name="orderId" from-field="parameters.orderId"/>
+ </entity-and>
+ <set field="orderItemSize" value="${util:size(orderItems)}" type="Long"/>
+ <if>
+ <condition>
+ <if-compare-field field="returnItemSize" operator="greater" to-field="orderItemSize" type="Long"/>
+ </condition>
+ <then>
+ <set field="returnItemCounter" value="1" type="Long"/>
+ <iterate list="returnItems" entry="returnItem">
+ <set field="orderItemAssocMap.orderId" from-field="parameters.originOrderId"/>
+ <set field="orderItemAssocMap.orderItemSeqId" from-field="returnItem.orderItemSeqId"/>
+ <set field="orderItemCounter" value="1" type="Long"/>
+ <iterate list="orderItems" entry="orderItem">
+ <if>
+ <condition>
+ <if-compare-field field="returnItemCounter" operator="equals" to-field="orderItemCounter" type="Long"/>
+ </condition>
+ <then>
+ <set field="orderItemAssocMap.toOrderId" from-field="parameters.orderId"/>
+ <set field="orderItemAssocMap.toOrderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+ </then>
+ <else-if>
+ <condition>
+ <if-compare-field field="returnItemCounter" operator="greater" to-field="orderItemSize" type="Long"/>
+ </condition>
+ <then>
+ <set field="orderItemAssocMap.toOrderId" from-field="parameters.orderId"/>
+ <set field="orderItemAssocMap.toOrderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+ </then>
+ </else-if>
+ </if>
+ <set field="orderItemCounter" value="${orderItemCounter+1}" type="Long"/>
+ </iterate>
+ <set field="orderItemAssocMap.shipGroupSeqId" value="_NA_"/>
+ <set field="orderItemAssocMap.toShipGroupSeqId" value="_NA_"/>
+ <set field="orderItemAssocMap.orderItemAssocTypeId" value="EXCHANGE"/>
+ <make-value entity-name="OrderItemAssoc" value-field="orderItemAssoc"/>
+ <set-pk-fields map="orderItemAssocMap" value-field="orderItemAssoc"/>
+ <create-value value-field="orderItemAssoc"/>
+ <set field="returnItemCounter" value="${returnItemCounter+1}" type="Long"/>
+ </iterate>
+ </then>
+ <else>
+ <set field="orderItemCounter" value="1" type="Long"/>
+ <iterate list="orderItems" entry="orderItem">
+ <set field="orderItemAssocMap.toOrderId" from-field="parameters.orderId"/>
+ <set field="orderItemAssocMap.toOrderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+ <set field="returnItemCounter" value="1" type="Long"/>
+ <iterate list="returnItems" entry="returnItem">
+ <if>
+ <condition>
+ <if-compare-field field="orderItemCounter" operator="equals" to-field="returnItemCounter" type="Long"/>
+ </condition>
+ <then>
+ <set field="orderItemAssocMap.orderId" from-field="parameters.originOrderId"/>
+ <set field="orderItemAssocMap.orderItemSeqId" from-field="returnItem.orderItemSeqId"/>
+ </then>
+ <else-if>
+ <condition>
+ <if-compare-field field="orderItemCounter" operator="greater" to-field="returnItemSize" type="Long"/>
+ </condition>
+ <then>
+ <set field="orderItemAssocMap.orderId" from-field="parameters.originOrderId"/>
+ <set field="orderItemAssocMap.orderItemSeqId" from-field="returnItem.orderItemSeqId"/>
+ </then>
+ </else-if>
+ </if>
+ <set field="returnItemCounter" value="${returnItemCounter+1}" type="Long"/>
+ </iterate>
+ <set field="orderItemAssocMap.shipGroupSeqId" value="_NA_"/>
+ <set field="orderItemAssocMap.toShipGroupSeqId" value="_NA_"/>
+ <set field="orderItemAssocMap.orderItemAssocTypeId" value="EXCHANGE"/>
+ <make-value entity-name="OrderItemAssoc" value-field="orderItemAssoc"/>
+ <set-pk-fields map="orderItemAssocMap" value-field="orderItemAssoc"/>
+ <create-value value-field="orderItemAssoc"/>
+ <clear-field field="orderItemAssocMap"/>
+ <set field="orderItemCounter" value="${orderItemCounter+1}" type="Long"/>
+ </iterate>
+ </else>
+ </if>
+ </simple-method>
</simple-methods>
\ No newline at end of file
Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/secas.xml Fri May 1 13:04:24 2009
@@ -242,6 +242,10 @@
<eca service="processRefundReturn" event="commit">
<action service="checkReturnComplete" mode="sync"/>
</eca>
+ <eca service="storeOrder" event="commit">
+ <condition field-name="originOrderId" operator="is-not-empty"/>
+ <action service="createExchangeOrderAssoc" mode="sync"/>
+ </eca>
<!-- ShoppingList ECAs -->
<eca service="createShoppingList" event="in-validate">
Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri May 1 13:04:24 2009
@@ -140,6 +140,7 @@
<attribute name="orderNotes" type="List" mode="IN" optional="true"/>
<attribute name="supplierPartyId" type="String" mode="IN" optional="true"/>
<attribute name="orderId" type="String" mode="INOUT" optional="true"/>
+ <attribute name="originOrderId" type="String" mode="IN" optional="true"/>
<attribute name="statusId" type="String" mode="OUT" optional="false"/>
</service>
Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_return.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_return.xml Fri May 1 13:04:24 2009
@@ -305,4 +305,11 @@
<attribute name="returnHeaderTypeId" type="String" mode="IN" optional="false"/>
<attribute name="statusItems" type="List" mode="OUT" optional="false"/>
</service>
+
+ <service name="createExchangeOrderAssoc" engine="simple"
+ location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="createExchangeOrderAssoc">
+ <description>Associate exchange order with original order in OrderItemAssoc entity</description>
+ <attribute name="orderId" type="String" mode="IN" optional="false"/>
+ <attribute name="originOrderId" type="String" mode="IN" optional="false"/>
+ </service>
</services>
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Fri May 1 13:04:24 2009
@@ -566,6 +566,7 @@
}
String orderId = this.cart.getOrderId();
String supplierPartyId = (String) this.cart.getAttribute("supplierPartyId");
+ String originOrderId = (String) this.cart.getAttribute("originOrderId");
this.cart.clearAllItemStatus();
@@ -586,6 +587,7 @@
context.put("userLogin", userLogin);
context.put("visitId", visitId);
context.put("webSiteId", webSiteId);
+ context.put("originOrderId", originOrderId);
// need the partyId; don't use userLogin in case of an order via order mgr
String partyId = this.cart.getPartyId();
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Fri May 1 13:04:24 2009
@@ -1453,6 +1453,8 @@
// set party info
String partyId = request.getParameter("supplierPartyId");
cart.setAttribute("supplierPartyId", partyId);
+ String originOrderId = request.getParameter("originOrderId");
+ cart.setAttribute("originOrderId", originOrderId);
if (!UtilValidate.isEmpty(request.getParameter("partyId"))) {
partyId = request.getParameter("partyId");
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl Fri May 1 13:04:24 2009
@@ -44,6 +44,7 @@
</div>
<div class="screenlet-body">
<form method="post" name="salesentryform" action="<@o...@ofbizUrl>">
+ <input type="hidden" name="originOrderId" value="${parameters.originOrderId?if_exists}"/>
<input type="hidden" name="finalizeMode" value="type"/>
<input type="hidden" name="orderMode" value="SALES_ORDER"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="boxbottom">
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Fri May 1 13:04:24 2009
@@ -254,11 +254,12 @@
<#assign linkedOrderItemSeqId = linkedOrderItem.toOrderItemSeqId>
<#assign linkedOrderItemValue = linkedOrderItem.getRelatedOne("ToOrderItem")>
<#assign linkedOrderItemValueStatus = linkedOrderItemValue.getRelatedOne("StatusItem")>
+ <#assign description = linkedOrderItem.getRelatedOne("OrderItemAssocType").getString("description")/>
<tr>
<td> </td>
<td colspan="6">
<div>
- <span class="label">${uiLabelMap.OrderLinkedToOrderItem}</span> (${linkedOrderItem.orderItemAssocTypeId})
+ <span class="label">${uiLabelMap.OrderLinkedToOrderItem}</span> (${description?if_exists})
<a href="/ordermgr/control/orderview?orderId=${linkedOrderId}" class="buttontext">${linkedOrderId}/${linkedOrderItemSeqId}</a> ${linkedOrderItemValueStatus.description?if_exists}
</div>
</td>
@@ -271,11 +272,12 @@
<#assign linkedOrderItemSeqId = linkedOrderItem.orderItemSeqId>
<#assign linkedOrderItemValue = linkedOrderItem.getRelatedOne("FromOrderItem")>
<#assign linkedOrderItemValueStatus = linkedOrderItemValue.getRelatedOne("StatusItem")>
+ <#assign description = linkedOrderItem.getRelatedOne("OrderItemAssocType").getString("description")/>
<tr>
<td> </td>
<td colspan="6">
<div>
- <span class="label">${uiLabelMap.OrderLinkedFromOrderItem}</span> ${linkedOrderItem.orderItemAssocTypeId})
+ <span class="label">${uiLabelMap.OrderLinkedFromOrderItem}</span> (${description?if_exists})
<a href="/ordermgr/control/orderview?orderId=${linkedOrderId}" class="buttontext">${linkedOrderId}/${linkedOrderItemSeqId}</a> ${linkedOrderItemValueStatus.description?if_exists}
</div>
</td>
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl?rev=770659&r1=770658&r2=770659&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl Fri May 1 13:04:24 2009
@@ -27,6 +27,14 @@
</div>
<div>
<a href="<@o...@ofbizUrl>" class="buttontext">PDF</a>
+ <#if returnId?exists>
+ <#assign returnItems = delegator.findByAnd("ReturnItem", Static["org.ofbiz.base.util.UtilMisc"].toMap("returnId", returnId, "returnTypeId", "RTN_REFUND"))/>
+ <#if returnItems?has_content>
+ <#assign orderId = (Static["org.ofbiz.entity.util.EntityUtil"].getFirst(returnItems)).getString("orderId")/>
+ <#assign partyId = "${(returnHeader.fromPartyId)?if_exists}"/>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.OrderCreateExchangeOrder} ${uiLabelMap.CommonFor} ${orderId?if_exists}</a>
+ </#if>
+ </#if>
</div>
<#else>
<h1>${uiLabelMap.OrderCreateNewReturn}</h1>