Author: lektran
Date: Sat May 23 03:31:59 2009
New Revision: 777786
URL:
http://svn.apache.org/viewvc?rev=777786&view=revLog:
Fix issue where the order's bill to party was not being used as the payment from party when the paymentFromId parameter was not being supplied
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?rev=777786&r1=777785&r2=777786&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat May 23 03:31:59 2009
@@ -4123,10 +4123,14 @@
}
// 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");
+ if (paymentFromId == null) {
+ OrderReadHelper orh = new OrderReadHelper(orderHeader);
+ GenericValue billToParty = orh.getBillToParty();
+ if (billToParty != null) {
+ paymentFromId = billToParty.getString("partyId");
+ } else {
+ paymentFromId = "_NA_";
+ }
}
// set the payToPartyId
@@ -4145,7 +4149,7 @@
paymentParams.put("amount", maxAmount);
paymentParams.put("statusId", "PMNT_RECEIVED");
paymentParams.put("effectiveDate", UtilDateTime.nowTimestamp());
- paymentParams.put("partyIdFrom", billToParty.getString("partyId"));
+ paymentParams.put("partyIdFrom", paymentFromId);
paymentParams.put("currencyUomId", productStore.getString("defaultCurrencyUomId"));
paymentParams.put("partyIdTo", payToPartyId);
/*}
@@ -4163,11 +4167,6 @@
if (paymentRefNum != null) {
paymentParams.put("paymentRefNum", paymentRefNum);
}
- if (paymentFromId != null) {
- paymentParams.put("partyIdFrom", paymentFromId);
- } else {
- paymentParams.put("partyIdFrom", "_NA_");
- }
if (comments != null) {
paymentParams.put("comments", comments);
}