ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaco...@apache.org
Subject svn commit: r482584 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
Date Tue, 05 Dec 2006 10:46:28 GMT
Author: jacopoc
Date: Tue Dec  5 02:46:27 2006
New Revision: 482584

URL: http://svn.apache.org/viewvc?view=rev&rev=482584
Log:
When an order for a return replacement is automatically created by the system, the order roles
are also cloned.

Modified:
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?view=diff&rev=482584&r1=482583&r2=482584
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
(original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
Tue Dec  5 02:46:27 2006
@@ -29,6 +29,7 @@
 import java.util.Set;
 
 import javolution.util.FastMap;
+import javolution.util.FastList;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralRuntimeException;
@@ -1369,7 +1370,29 @@
                 try {
                     orderMap.put("orderTerms", orderHeader.getRelated("OrderTerm"));
                 } catch (GenericEntityException e) {
-                    Debug.logError(e, "Cannot create replacement order because order terms
for original order is not available", module);
+                    Debug.logError(e, "Cannot create replacement order because order terms
for original order are not available", module);
+                }
+                // we'll assume the new order has the same order roles of the original one
+                try {
+                    List orderRoles = orderHeader.getRelated("OrderRole");
+                    Map orderRolesMap = FastMap.newInstance();
+                    if (orderRoles != null) {
+                        Iterator orderRolesIt = orderRoles.iterator();
+                        while (orderRolesIt.hasNext()) {
+                            GenericValue orderRole = (GenericValue) orderRolesIt.next();
+                            List parties = (List) orderRolesMap.get(orderRole.getString("roleTypeId"));
+                            if (parties == null) {
+                                parties = FastList.newInstance();
+                                orderRolesMap.put(orderRole.getString("roleTypeId"), parties);
+                            }
+                            parties.add(orderRole.getString("partyId"));
+                        }
+                    }
+                    if (orderRolesMap.size() > 0) {
+                        orderMap.put("orderAdditionalPartyRoleMap", orderRolesMap);
+                    }
+                } catch (GenericEntityException e) {
+                    Debug.logError(e, "Cannot create replacement order because order roles
for original order are not available", module);
                 }
 
                 // create the order



Mime
View raw message