You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/05/14 14:43:38 UTC

svn commit: r774749 - in /ofbiz/trunk/applications/accounting: servicedef/services_paymentmethod.xml src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

Author: ashish
Date: Thu May 14 12:43:38 2009
New Revision: 774749

URL: http://svn.apache.org/viewvc?rev=774749&view=rev
Log:
Applied patch from jira issue OFBIZ-2472 (Error on updating order items from order datail page).
Thanks Arun Patidar for your contribution.

Modified:
    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=774749&r1=774748&r2=774749&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu May 14 12:43:38 2009
@@ -267,6 +267,7 @@
         <description>Releases all payment authorizations for an order</description>
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
+        <attribute name="orderPaymentPreferenceId" type="String" mode="IN" optional="true"/>
     </service>
 
     <service name="releaseOrderPaymentPreference" engine="java"

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=774749&r1=774748&r2=774749&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu May 14 12:43:38 2009
@@ -672,22 +672,23 @@
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String orderPaymentPreferenceId = (String) context.get("orderPaymentPreferenceId");
         Map<String, Object> result = ServiceUtil.returnSuccess();
+        String orderId = "";
         // Get the OrderPaymentPreference
         GenericValue paymentPref = null;
         try {
-            paymentPref = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false);
+            if (orderPaymentPreferenceId != null) {
+                paymentPref = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false);
+                orderId = paymentPref.getString("orderId");
+            }
+            else {
+                orderId =  (String) context.get("orderId");
+            }
         } catch ( GenericEntityException e ) {
             String errMsg = "Problem getting OrderPaymentPreference for orderPaymentPreferenceId " + orderPaymentPreferenceId;
             Debug.logWarning(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
-        // Error if no OrderPaymentPreference was found
-        if (paymentPref == null) {
-            String errMsg = "Could not find OrderPaymentPreference with orderPaymentPreferenceId: " + orderPaymentPreferenceId;
-            Debug.logWarning(errMsg, module);
-            return ServiceUtil.returnError(errMsg);
-        }
-        String orderId = paymentPref.getString("orderId");
+
         // get the payment preferences
         List<GenericValue> paymentPrefs = null;
         try {