svn commit: r803572 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/payment/ servicedef/ webapp/accounting/WEB-INF/ webapp/ar/WEB-INF/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r803572 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/payment/ servicedef/ webapp/accounting/WEB-INF/ webapp/ar/WEB-INF/

apatel-2
Author: apatel
Date: Wed Aug 12 15:56:29 2009
New Revision: 803572

URL: http://svn.apache.org/viewvc?rev=803572&view=rev
Log:
Adding service to check valid payment before create a new batch for payments.  Patch from OFBIZ-2774. Thanks Awdesh for patch.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas.xml
    ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=803572&r1=803571&r2=803572&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Aug 12 15:56:29 2009
@@ -1703,8 +1703,8 @@
         <value xml:lang="zh">无法为应用[${payAppl}]获得支付,由于${msg}</value>
     </property>
     <property key="AccountingCannotIncludeApPaymentError">
-        <value xml:lang="en">Cannot include AP payment in a deposit batch</value>
-        <value xml:lang="hi_IN">भुगतान को देय खाते(AP) के  à¤œà¤®à¤¾ बैच (deposit batch) खाते में शामिल नहीं कर सकते</value>
+        <value xml:lang="en">Cannot include AP payments ${disbursementPaymentIds} in a deposit batch</value>
+        <value xml:lang="hi_IN">भुगतान ${disbursementPaymentIds} को देय खाते(AP) के  à¤œà¤®à¤¾ बैच (deposit batch) खाते में शामिल नहीं कर सकते</value>
     </property>
     <property key="AccountingCapture">
         <value xml:lang="ar">خطفة</value>
@@ -6908,6 +6908,10 @@
         <value xml:lang="th">โปรแกรมประยุกต์ใช้การชำระเงินต้องการรหัสใบเสร็จการชำระเงิน, หมายเลขบัญชีธนาคาร, taxAuthGeoId หรือ หมายเลขบัญชีแยกประเภททั่วไป</value>
         <value xml:lang="zh">支付程序需要提供发票编号、账单账户标识或税务机关辖区编号</value>
     </property>
+    <property key="AccountingPaymentsAreAlreadyBatchedError">
+        <value xml:lang="en">Selected payments ${batchPaymentIds} is already assigned in a batch</value>
+        <value xml:lang="hi_IN">चुने हुए भुगतान $(batchPaymentIds) पहले ही एक बैच में सौंपा है </value>
+    </property>
     <property key="AccountingPaymentCancelled">
         <value xml:lang="en">Payment [${paymentId}] is cancelled and cannot be applied</value>
         <value xml:lang="es">Pago [${paymentId}] ha sido concelado y no puede ser aplicado</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=803572&r1=803571&r2=803572&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 15:56:29 2009
@@ -664,4 +664,34 @@
         </if-not-empty>
         <field-to-result field="glReconciliationId"/>
     </simple-method>
+    <simple-method method-name="checkAndCreateBatchForValidPayments" short-description="Check the valid(unbatched) payment and create batch for same">
+        <set field="paymentIds" from-field="parameters.paymentIds"/>
+        <entity-condition entity-name="Payment" list="payments">
+            <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/>
+        </entity-condition>
+        <iterate list="payments" entry="payment">
+            <set field="isReceipt" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isReceipt(payment)}" type="Boolean"/>
+            <if-compare field="isReceipt" operator="equals" value="false" type="Boolean">
+                <field-to-list field="payment.paymentId" list="disbursementPaymentIds"/>
+            </if-compare>
+        </iterate>
+        <if-not-empty field="disbursementPaymentIds">
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingCannotIncludeApPaymentError"/></add-error>
+            <check-errors/>
+        </if-not-empty>
+        <entity-condition entity-name="PaymentGroupMember" list="paymentGroupMembers" filter-by-date="true">
+            <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/>
+        </entity-condition>
+        <if-not-empty field="paymentGroupMembers">
+            <set field="batchPaymentIds" value="${groovy:org.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(paymentGroupMembers, 'paymentId', true);}" type="List"/>
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentsAreAlreadyBatchedError"/></add-error>
+            <check-errors/>
+        <else>
+            <set-service-fields service-name="createPaymentGroupAndMember" map="parameters" to-map="createPaymentGroupAndMemberMap"/>
+            <call-service service-name="createPaymentGroupAndMember" in-map-name="createPaymentGroupAndMemberMap">
+                <result-to-result result-name="paymentGroupId"/>
+            </call-service>            
+        </else>
+        </if-not-empty>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=803572&r1=803571&r2=803572&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Wed Aug 12 15:56:29 2009
@@ -169,6 +169,6 @@
     </eca>
     <eca service="depositWithdrawPayments" event="commit">
         <condition field-name="groupInOneTransaction" operator="equals" value="Y"/>
-        <action service="createPaymentGroupAndMember" mode="async"/>
+        <action service="checkAndCreateBatchForValidPayments" mode="sync"/>
     </eca>
 </service-eca>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=803572&r1=803571&r2=803572&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Wed Aug 12 15:56:29 2009
@@ -219,4 +219,9 @@
         <attribute name="glReconciliationId" type="String" mode="OUT" optional="true"/>
     </service>
     
+    <service name="checkAndCreateBatchForValidPayments" engine="simple"
+            location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="checkAndCreateBatchForValidPayments" auth="true">
+        <description>Check the valid(unbatched) payment and create batch for same</description>
+        <implements service="createPaymentGroupAndMember"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=803572&r1=803571&r2=803572&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Wed Aug 12 15:56:29 2009
@@ -2216,7 +2216,7 @@
     </request-map>
     <request-map uri="createPaymentBatch">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createPaymentGroupAndMember"/>
+        <event type="service" invoke="checkAndCreateBatchForValidPayments"/>
         <response name="success" type="view" value="EditDepositSlipAndMembers"/>
         <response name="error" type="view" value="NewDepositSlip"/>
     </request-map>

Modified: ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml?rev=803572&r1=803571&r2=803572&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml Wed Aug 12 15:56:29 2009
@@ -43,7 +43,7 @@
     </request-map>
     <request-map uri="createPaymentBatch">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createPaymentGroupAndMember"/>
+        <event type="service" invoke="checkAndCreateBatchForValidPayments"/>
         <response name="success" type="view" value="PaymentGroupOverview"/>
         <response name="error" type="view" value="BatchPayments"/>
     </request-map>
@@ -92,4 +92,4 @@
     <view-map name="NewSalesInvoice" type="screen" page="component://accounting/widget/ar/InvoiceScreens.xml#NewSalesInvoice"/>
 
     <!-- end of view mappings -->
-</site-conf>
\ No newline at end of file
+</site-conf>