Return-Path: Delivered-To: apmail-incubator-ofbiz-commits-archive@locus.apache.org Received: (qmail 52212 invoked from network); 5 Dec 2006 12:02:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2006 12:02:43 -0000 Received: (qmail 47556 invoked by uid 500); 5 Dec 2006 12:02:51 -0000 Delivered-To: apmail-incubator-ofbiz-commits-archive@incubator.apache.org Received: (qmail 47539 invoked by uid 500); 5 Dec 2006 12:02:51 -0000 Mailing-List: contact ofbiz-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ofbiz-dev@incubator.apache.org Delivered-To: mailing list ofbiz-commits@incubator.apache.org Received: (qmail 47530 invoked by uid 99); 5 Dec 2006 12:02:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 04:02:51 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 04:02:41 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 13DE71A9846; Tue, 5 Dec 2006 04:02:01 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r482615 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Date: Tue, 05 Dec 2006 12:02:00 -0000 To: ofbiz-commits@incubator.apache.org From: jacopoc@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061205120201.13DE71A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jacopoc Date: Tue Dec 5 04:02:00 2006 New Revision: 482615 URL: http://svn.apache.org/viewvc?view=rev&rev=482615 Log: Now the order created for a return of type "replacement" also has correct information about order ship groups. 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=482615&r1=482614&r2=482615 ============================================================================== --- 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 04:02:00 2006 @@ -1316,6 +1316,8 @@ // make the order items double itemTotal = 0.00; List orderItems = new ArrayList(); + List orderItemShipGroupInfo = new ArrayList(); + List orderItemShipGroupIds = new ArrayList(); // this is used to store the ship group ids of the groups already added to the orderItemShipGroupInfo list if (items != null) { Iterator ri = items.iterator(); int itemCount = 1; @@ -1348,10 +1350,34 @@ newItem.set("correspondingPoId", orderItem.get("correspondingPoId")); newItem.set("statusId", "ITEM_CREATED"); orderItems.add(newItem); + // Set the order item ship group information + // TODO: only the first ship group associated to the item + // of the original order is considered and cloned, + // and the returned units are assigned to it. + // Is there a better way to handle this? + try { + GenericValue orderItemShipGroupAssoc = EntityUtil.getFirst(orderItem.getRelated("OrderItemShipGroupAssoc")); + if (orderItemShipGroupAssoc != null) { + if (!orderItemShipGroupIds.contains(orderItemShipGroupAssoc.getString("shipGroupSeqId"))) { + GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup"); + GenericValue newOrderItemShipGroup = (GenericValue)orderItemShipGroup.clone(); + newOrderItemShipGroup.set("orderId", null); + orderItemShipGroupInfo.add(newOrderItemShipGroup); + orderItemShipGroupIds.add(orderItemShipGroupAssoc.getString("shipGroupSeqId")); + } + GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", quantity)); + orderItemShipGroupInfo.add(newOrderItemShipGroupAssoc); + } + } catch(GenericEntityException gee) { + Debug.logError(gee, module); + } } } } orderMap.put("orderItems", orderItems); + if (orderItemShipGroupInfo.size() > 0) { + orderMap.put("orderItemShipGroupInfo", orderItemShipGroupInfo); + } } else { Debug.logError("No return items found??", module); continue;