Author: jacopoc
Date: Wed May 23 01:32:52 2007
New Revision: 540884
URL:
http://svn.apache.org/viewvc?view=rev&rev=540884Log:
Enhanced the setPaymentStatus service for the transition to 'cancelled':
* instead of removing the payment applications, the proper service is invoked;
* if the payment is associate to an OrderPaymentPreference, then the record is cancelled too
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?view=diff&rev=540884&r1=540883&r2=540884==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Wed May 23 01:32:52 2007
@@ -191,10 +191,20 @@
</if-compare>
</if-compare>
- <!-- if new status is cancelled delete existing payment applications. -->
<if-compare field-name="parameters.statusId" operator="equals" value="PMNT_CANCELLED">
- <set field="removePaymentApplicationMap.paymentId" from-field="parameters.paymentId"/>
- <remove-by-and entity-name="PaymentApplication" map-name="removePaymentApplicationMap"/>
+ <!-- if new status is cancelled delete existing payment applications. -->
+ <get-related value-name="payment" relation-name="PaymentApplication" list-name="paymentApplications"/>
+ <iterate list-name="paymentApplications" entry-name="paymentApplication">
+ <set field="removePaymentApplicationMap.paymentApplicationId" from-field="paymentApplication.paymentApplicationId"/>
+ <call-service service-name="removePaymentApplication" in-map-name="removePaymentApplicationMap"/>
+ </iterate>
+ <!-- if new status is cancelled and the payment is associated to an OrderPaymentPreference, update the status of that record too. -->
+ <get-related-one value-name="payment" relation-name="OrderPaymentPreference" to-value-name="orderPaymentPreference"/>
+ <if-not-empty field-name="orderPaymentPreference">
+ <set field="updateOrderPaymentPreferenceMap.orderPaymentPreferenceId" from-field="orderPaymentPreference.orderPaymentPreferenceId"/>
+ <set field="updateOrderPaymentPreferenceMap.cancelThis" value="true"/>
+ <call-service service-name="updateOrderPaymentPreference" in-map-name="updateOrderPaymentPreferenceMap"/>
+ </if-not-empty>
</if-compare>
<!-- everything ok so now change the status field -->
@@ -203,7 +213,6 @@
</else>
</if-empty>
-
</if-compare-field>
</simple-method>