You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/01/26 17:40:56 UTC

svn commit: r500280 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Author: sichen
Date: Fri Jan 26 08:40:56 2007
New Revision: 500280

URL: http://svn.apache.org/viewvc?view=rev&rev=500280
Log:
Fix bug with receive offline payments screen in ordermgr which was not filling in partyId of customer or the currency of payment.  This probably addresses a JIRA issue though I can't remember which one right now

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=500280&r1=500279&r2=500280
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Fri Jan 26 08:40:56 2007
@@ -3463,12 +3463,19 @@
                 return ServiceUtil.returnError("Failed to create Payment: Cannot get related OrderHeader from payment preference");
             }
 
-            // get the store for the order
+            // get the store for the order.  It will be used to set the currency
             GenericValue productStore = orderHeader.getRelatedOne("ProductStore");
             if (productStore == null) {
                 return ServiceUtil.returnError("Failed to create Payment: Cannot get the ProductStore for the order header");
             }
 
+            // get the partyId billed to 
+            OrderReadHelper orh = new OrderReadHelper(orderHeader);
+            GenericValue billToParty = orh.getBillToParty();
+            if (billToParty == null) {
+                return ServiceUtil.returnError("Failed to create Payment: cannot find the bill to customer party");
+            }
+                
             // set the payToPartyId
             String payToPartyId = productStore.getString("payToPartyId");
             if (payToPartyId == null) {
@@ -3483,6 +3490,8 @@
             paymentParams.put("amount", orderPaymentPreference.getDouble("maxAmount"));
             paymentParams.put("statusId", "PMNT_RECEIVED");
             paymentParams.put("effectiveDate", UtilDateTime.nowTimestamp());
+            paymentParams.put("partyIdFrom", billToParty.getString("partyId"));
+            paymentParams.put("currencyUomId", productStore.getString("defaultCurrencyUomId"));
             paymentParams.put("partyIdTo", payToPartyId);
             if (paymentRefNum != null) {
                 paymentParams.put("paymentRefNum", paymentRefNum);