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> |
Free forum by Nabble | Edit this page |