Author: jleroux
Date: Thu Dec 19 12:20:32 2013
New Revision: 1552290
URL:
http://svn.apache.org/r1552290Log:
A slightly modified patch from Praveen Agrawal for "Order Return Process doesn't override the Order Adjustment Amount that is provided from Return Screen GUI"
https://issues.apache.org/jira/browse/OFBIZ-5439OFBiz return services (OrderReturnServices.java - createReturnAdjustment) contains a bug when generating the Return Adjustments based on the Order Adjustments.
The bug is it is ignoring the 'overriding amount' entered on the screen.
For example If an order has an Shipping Charge Order Adjustment in the amount of 7.95 and from the screen the cleint wants to return only 5.95 (override), the return services ignores the 5.95 entry and returns the full 7.95.
jleroux: I removed a BigDecimal amount declaration which was conflicting
I formatted the if block
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1552290&r1=1552289&r2=1552290&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Dec 19 12:20:32 2013
@@ -2386,6 +2386,7 @@ public class OrderReturnServices {
String returnId = (String) context.get("returnId");
String returnItemSeqId = (String) context.get("returnItemSeqId");
String description = (String) context.get("description");
+ BigDecimal amount = (BigDecimal) context.get("amount");
Locale locale = (Locale) context.get("locale");
GenericValue returnItemTypeMap = null;
@@ -2395,8 +2396,6 @@ public class OrderReturnServices {
GenericValue returnItem = null;
GenericValue returnHeader = null;
- BigDecimal amount;
-
// if orderAdjustment is not empty, then copy most return adjustment information from orderAdjustment's
if (orderAdjustmentId != null) {
try {
@@ -2440,6 +2439,9 @@ public class OrderReturnServices {
throw new GeneralRuntimeException(e.getMessage());
}
context.putAll(orderAdjustment.getAllFields());
+ if (UtilValidate.isNotEmpty(amount)) {
+ context.put("amount", amount);
+ }
}
// if orderAdjustmentTypeId is empty, ie not found from orderAdjustmentId, then try to get returnAdjustmentTypeId from returnItemTypeMap,