Author: apatel
Date: Sat Jul 25 10:20:53 2009
New Revision: 797734

URL: http://svn.apache.org/viewvc?rev=797734&view=rev
Log:
On canceling the FinAccountTrans record It remove finAccountTransId from 
Associated Payment records.

Modified:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml

Modified: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?rev=797734&r1=797733&r2=797734&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
 (original)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
 Sat Jul 25 10:20:53 2009
@@ -473,11 +473,20 @@
     
     <simple-method method-name="updatePaymentOnFinAccTransStatusSetToCancel" 
short-description="remove field finAccountTransId from Payment entity.">
         <entity-one entity-name="FinAccountTrans" 
value-field="finAccountTrans"/>
-        <get-related-one relation-name="Payment" value-field="finAccountTrans" 
to-value-field="payment"/>
-        <if-not-empty field="payment">
+        <if-empty field="finAccountTrans.paymentId">
+            <entity-and entity-name="Payment" list="payments">
+                <field-map field-name="finAccountTransId" 
from-field="finAccountTrans.finAccountTransId"/>
+            </entity-and>
+            <else>
+                <get-related-one relation-name="Payment" 
value-field="finAccountTrans" to-value-field="payment"/>
+                <field-to-list field="payment" list="payments"/>
+            </else>
+        </if-empty>
+        <iterate list="payments" entry="payment">
             <set field="updatePaymentMap.paymentId" 
from-field="payment.paymentId"/>
             <clear-field field="updatePaymentMap.finAccountTransId"/>
             <call-service service-name="updatePayment" 
in-map-name="updatePaymentMap"/>
-        </if-not-empty>
+            <clear-field field="updatePaymentMap"/>
+        </iterate>
     </simple-method>
 </simple-methods>


Reply via email to