Author: apatel
Date: Wed Aug 12 04:32:37 2009
New Revision: 803362
URL: http://svn.apache.org/viewvc?rev=803362&view=rev
Log:
User can not cancel batch of payment if it is associated in Reconcilation
process. Patch from OFBIZ-2825. Thanks Parimal contribution.
Modified:
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
ofbiz/trunk/applications/accounting/widget/Menus.xml
ofbiz/trunk/applications/accounting/widget/PaymentGroupScreens.xml
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=803362&r1=803361&r2=803362&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Aug
12 04:32:37 2009
@@ -1669,6 +1669,10 @@
<value xml:lang="en">Cancel Batch Payments</value>
<value xml:lang="hi_IN">à¤à¥à¤à¤¤à¤¾à¤¨ à¤à¤¾ बà¥à¤
रदà¥à¤¦ à¤à¤°à¥</value>
</property>
+ <property key="AccountingCancelBatchPaymentsError">
+ <value xml:lang="en">Cannot Cancel Batch Payment [${paymentGroupId}],
is associated to glReconciliation [${glReconciliationId}]</value>
+ <value xml:lang="hi_IN">बà¥à¤ à¤à¥à¤à¤¤à¤¾à¤¨
[${paymentGroupId}], glReconciliation [${glReconciliationId}] सà¥
à¤à¥à¤¡à¤¼à¤¾ हॠ, à¤à¤¸à¥ रदà¥à¤¦ नहà¥à¤ à¤à¤°
सà¤à¤¤à¥ |</value>
+ </property>
<property key="AccountingCancelCheckRun">
<value xml:lang="en">Cancel Check Run</value>
<value xml:lang="hi_IN">à¤à¥à¤/हà¥à¤à¤¡à¥ रदà¥à¤¦
à¤à¤°à¥</value>
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?rev=803362&r1=803361&r2=803362&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
(original)
+++
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
Wed Aug 12 04:32:37 2009
@@ -466,15 +466,25 @@
<set field="paymentRunningTotal"
value="${groovy:org.ofbiz.base.util.UtilFormatOut.formatCurrency(runningTotal,
currencyUomId, parameters.locale)}"/>
<field-to-result field="paymentRunningTotal"/>
</simple-method>
+
<simple-method method-name="cancelPaymentBatch" short-description="cancel
payment batch">
<set field="paymentGroupId" from-field="parameters.paymentGroupId"/>
<entity-and entity-name="PaymentGroupMember"
list="paymentGroupMembers">
<field-map field-name="paymentGroupId"/>
</entity-and>
- <iterate list="paymentGroupMembers" entry="paymentGroupMember">
- <set-service-fields service-name="expirePaymentGroupMember"
map="paymentGroupMember" to-map="expirePaymentGroupMemberMap"/>
- <call-service service-name="expirePaymentGroupMember"
in-map-name="expirePaymentGroupMemberMap"/>
- </iterate>
+ <call-service service-name="getPaymentGroupReconciliationId"
in-map-name="parameters">
+ <result-to-field result-name="glReconciliationId"/>
+ </call-service>
+ <if-empty field="glReconciliationId">
+ <iterate list="paymentGroupMembers" entry="paymentGroupMember">
+ <set-service-fields service-name="expirePaymentGroupMember"
map="paymentGroupMember" to-map="expirePaymentGroupMemberMap"/>
+ <call-service service-name="expirePaymentGroupMember"
in-map-name="expirePaymentGroupMemberMap"/>
+ </iterate>
+ <else>
+ <add-error><fail-property resource="AccountingUiLabels"
property="AccountingCancelBatchPaymentsError"/></add-error>
+ <check-errors/>
+ </else>
+ </if-empty>
</simple-method>
<simple-method method-name="createPaymentAndPaymentGroupForInvoices"
short-description="Creates Payments, PaymentApplications and PaymentGroup for
the same">
@@ -638,4 +648,20 @@
</if-not-empty>
<field-to-result field="payments"/>
</simple-method>
+
+ <simple-method method-name="getPaymentGroupReconciliationId"
short-description="Get ReconciliationId associated to paymentGroup">
+ <set field="paymentGroupId" from-field="parameters.paymentGroupId"/>
+ <entity-and entity-name="PaymentGroupMember"
list="paymentGroupMembers">
+ <field-map field-name="paymentGroupId"/>
+ </entity-and>
+ <first-from-list list="paymentGroupMembers" entry="paymentGroupMember"
/>
+ <get-related-one relation-name="Payment"
value-field="paymentGroupMember" to-value-field="payment"/>
+ <get-related-one relation-name="FinAccountTrans" value-field="payment"
to-value-field="finAccountTrans"/>
+ <if-not-empty field="finAccountTrans">
+ <if-not-empty field="finAccountTrans.glReconciliationId">
+ <set field="glReconciliationId"
from-field="finAccountTrans.glReconciliationId"/>
+ </if-not-empty>
+ </if-not-empty>
+ <field-to-result field="glReconciliationId"/>
+ </simple-method>
</simple-methods>
Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=803362&r1=803361&r2=803362&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Wed Aug
12 04:32:37 2009
@@ -212,5 +212,11 @@
<attribute name="finAccountTransId" type="String" mode="IN"
optional="true"/>
<attribute name="payments" type="List" mode="OUT" optional="true"/>
</service>
+ <service name="getPaymentGroupReconciliationId" engine="simple"
+
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml"
invoke="getPaymentGroupReconciliationId" auth="true">
+ <description>Get ReconciliationId associated to
paymentGroup</description>
+ <attribute name="paymentGroupId" type="String" mode="IN"
optional="false"/>
+ <attribute name="glReconciliationId" type="String" mode="OUT"
optional="true"/>
+ </service>
</services>
Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=803362&r1=803361&r2=803362&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/Menus.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/Menus.xml Wed Aug 12 04:32:37
2009
@@ -518,6 +518,7 @@
<and>
<not><if-empty field="paymentGroupMembers"/></not>
<not><if-empty field="paymentGroup"/></not>
+ <if-empty field="glReconciliationId"/>
<if-compare field="paymentGroup.paymentGroupTypeId"
operator="equals" value="BATCH_PAYMENT"/>
</and>
</condition>
Modified: ofbiz/trunk/applications/accounting/widget/PaymentGroupScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentGroupScreens.xml?rev=803362&r1=803361&r2=803362&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentGroupScreens.xml
(original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentGroupScreens.xml Wed Aug
12 04:32:37 2009
@@ -103,6 +103,10 @@
<entity-and entity-name="PaymentGroupMember"
list="paymentGroupMembers">
<field-map field-name="paymentGroupId"/>
</entity-and>
+ <service service-name="getPaymentGroupReconciliationId"
result-map="resultMap">
+ <field-map field-name="paymentGroupId"/>
+ </service>
+ <set field="glReconciliationId"
from-field="resultMap.glReconciliationId"/>
</actions>
<widgets>
<decorator-screen name="CommonPaymentGroupDecorator"
location="${parameters.mainDecoratorLocation}">