You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/09/28 23:47:10 UTC

svn commit: r1527254 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml

Author: jleroux
Date: Sat Sep 28 21:47:10 2013
New Revision: 1527254

URL: http://svn.apache.org/r1527254
Log:
A modified patch from Karl Beecher for "Updating EFT Account address resurrects out-of-date EFT Accounts" https://issues.apache.org/jira/browse/OFBIZ-5193

When you update the address that an EFT Acccount is linked to, all expired EFT accounts are "resurrected", which can mean multiple out-of-date copies of an EFT account are displayed in the Payment Method Information.

To reproduce (with OFBiz demo data):

* Go to DemoSupplier profile page and click Create EFT Account
* Enter details of a new account, making sure the account is linked to the DemoSupplier postal address.
* Click Save and then click Cancel/Done.
* Back on the profile page, Update for this new EFT account.
* Change at least one field of the account.
* Click Save (now there are two EFT account records in the database; one of which is expired). Click Cancel/Done.
* Now click Update for the DemoSupplier's postal address.
* Update at least one field. Click Save.
* Go back to the DemoSupplier profile page. You should see that the old expired EFT accounts are listed in the Payment Method Information.

We avoid this bug by altering PaymentMethodServices.xml#setPaymentMethodAddress, so that out-of-date EFT Accounts are filtered out.

jleroux: I applied changes by hand because the patch did not work. I also removed the useless line setting a now var.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml?rev=1527254&r1=1527253&r2=1527254&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml Sat Sep 28 21:47:10 2013
@@ -63,11 +63,14 @@ under the License.
 
         <find-by-and entity-name="EftAccount" map="lookupMap" list="eftAccounts"/>
         <iterate entry="eftAccount" list="eftAccounts">
-            <set-service-fields service-name="updateEftAccount" map="eftAccount" to-map="ueaMap"/>
-            <set field="ueaMap.contactMechId" from-field="parameters.contactMechId"/>
-            <set field="ueaMap.partyId" from-field="parameters.partyId"/>
-            <!-- use the service so it will expire the old account and create a new one; don't break on error since this is a background process, just get whatever we can done... -->
-            <call-service service-name="updateEftAccount" in-map-name="ueaMap" break-on-error="false"/>
+            <get-related-one relation-name="PaymentMethod" to-value-field="paymentMethod" value-field="eftAccount"/>
+            <if-empty field="paymentMethod.thruDate">
+                <set-service-fields service-name="updateEftAccount" map="eftAccount" to-map="ueaMap"/>
+                <set field="ueaMap.contactMechId" from-field="parameters.contactMechId"/>
+                <set field="ueaMap.partyId" from-field="parameters.partyId"/>
+                <!-- use the service so it will expire the old account and create a new one; don't break on error since this is a background process, just get whatever we can done... -->
+                <call-service service-name="updateEftAccount" in-map-name="ueaMap" break-on-error="false"/>
+            </if-empty>            
         </iterate>
     </simple-method>
     <!--CreateCreditCardTypeGlAccount methods -->