Author: ashish
Date: Thu Jul 2 14:49:45 2009 New Revision: 790606 URL: http://svn.apache.org/viewvc?rev=790606&view=rev Log: Applied patch from jira issue OFBIZ-2685 (Allow user, ability to void a Payment.) Thanks Surya & Sumit for your contribution. Special thanks to Jacopo for notes. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml ofbiz/trunk/applications/accounting/servicedef/services_payment.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/Menus.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=790606&r1=790605&r2=790606&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Jul 2 14:49:45 2009 @@ -6229,6 +6229,9 @@ <value xml:lang="th">à¹à¸à¸¥à¸µà¹à¸¢à¸à¸ªà¸à¸²à¸à¸°à¹à¸à¹à¸ 'Sent'</value> <value xml:lang="zh">ç¶ææ¹ä¸º'å·²åé'</value> </property> + <property key="AccountingPaymentTabStatusToVoid"> + <value xml:lang="en"> Status to 'Void'</value> + </property> <property key="AccountingPaymentType"> <value xml:lang="ar">ÙÙع اÙتسدÙد</value> <value xml:lang="en">Payment Type</value> Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=790606&r1=790605&r2=790606&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Thu Jul 2 14:49:45 2009 @@ -854,11 +854,15 @@ <StatusItem description="Received" sequenceId="04" statusCode="RECEIVED" statusId="PMNT_RECEIVED" statusTypeId="PMNT_STATUS"/> <StatusItem description="Confirmed" sequenceId="05" statusCode="CONFIRMED" statusId="PMNT_CONFIRMED" statusTypeId="PMNT_STATUS"/> <StatusItem description="Cancelled" sequenceId="10" statusCode="CANCELLED" statusId="PMNT_CANCELLED" statusTypeId="PMNT_STATUS"/> + <StatusItem description="Voided" sequenceId="11" statusCode="VOID" statusId="PMNT_VOID" statusTypeId="PMNT_STATUS"/> <StatusValidChange condition="" statusId="PMNT_NOT_PAID" statusIdTo="PMNT_SENT" transitionName="Payment Send"/> <StatusValidChange condition="" statusId="PMNT_NOT_PAID" statusIdTo="PMNT_RECEIVED" transitionName="Payment Received"/> <StatusValidChange condition="" statusId="PMNT_NOT_PAID" statusIdTo="PMNT_CANCELLED" transitionName="Payment Cancelled"/> <StatusValidChange condition="" statusId="PMNT_SENT" statusIdTo="PMNT_CONFIRMED" transitionName="Payment Confirmed"/> <StatusValidChange condition="" statusId="PMNT_RECEIVED" statusIdTo="PMNT_CONFIRMED" transitionName="Payment Confirmed"/> + <StatusValidChange condition="" statusId="PMNT_SENT" statusIdTo="PMNT_VOID" transitionName="Payment Voided"/> + <StatusValidChange condition="" statusId="PMNT_RECEIVED" statusIdTo="PMNT_VOID" transitionName="Payment Voided"/> + <StatusValidChange condition="" statusId="PMNT_NOT_PAID" statusIdTo="PMNT_VOID" transitionName="Payment Voided"/> <SettlementTerm settlementTermId="COD" termName="Cash Due on Delivery" termValue="0" uomId="TF_day"/> <SettlementTerm settlementTermId="NET_15" termName="Net Due in 15 Days" termValue="15" uomId="TF_day"/> 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=790606&r1=790605&r2=790606&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 Thu Jul 2 14:49:45 2009 @@ -387,5 +387,45 @@ </iterate> <field-to-result field="selectedInvoicePaymentInfoList" result-name="invoicePaymentInfoList"/> </simple-method> + + <simple-method method-name="voidPayment" short-description="Service to void a payment"> + <check-permission permission="ACCOUNTING" action="_UPDATE"> + <alt-permission permission="ACCOUNTING_ROLE" action="_UPDATE"/> + <fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/> + </check-permission> + <entity-one entity-name="Payment" value-field="payment"/> + <if-empty field="payment"> + <add-error><fail-message message="${uiLabelMap.AccountingNoPaymentsfound}"/></add-error> + <check-errors/> + </if-empty> + <set field="paymentStatusCtx.paymentId" from-field="parameters.paymentId"/> + <set field="paymentStatusCtx.statusId" value="PMNT_VOID"/> + <call-service service-name="setPaymentStatus" in-map-name="paymentStatusCtx"/> + <get-related relation-name="PaymentApplication" value-field="payment" list="paymentApplications"/> + <iterate list="paymentApplications" entry="paymentApplication"> + <get-related-one relation-name="Invoice" value-field="paymentApplication" to-value-field="updateInvoiceCtx"/> + <if-compare field="updateInvoiceCtx.statusId" operator="equals" value="INVOICE_PAID"> + <set-service-fields service-name="updateInvoice" map="updateInvoiceCtx" to-map="invoiceStatusCtx"/> + <set field="invoiceStatusCtx.paidDate" type="Timestamp" value=""/> + <set field="invoiceStatusCtx.statusId" value="INVOICE_READY"/> + <call-service service-name="setInvoiceStatus" in-map-name="invoiceStatusCtx"/> + </if-compare> + <set field="removePaymentApplicationCtx.paymentApplicationId" from-field="paymentApplication.paymentApplicationId"/> + <call-service service-name="removePaymentApplication" in-map-name="removePaymentApplicationCtx"/> + <get-related relation-name="AcctgTrans" value-field="updateInvoiceCtx" list="acctgTransInvoiceList"/> + <iterate list="acctgTransInvoiceList" entry="acctgTransInvoice"> + <set field="copyAcctgTransCtx.fromAcctgTransId" from-field="acctgTransInvoice.acctgTransId"/> + <set field="copyAcctgTransCtx.revert" value="Y"/> + <call-service service-name="copyAcctgTransAndEntries" in-map-name="copyAcctgTransCtx"/> + </iterate> + </iterate> + <get-related relation-name="AcctgTrans" value-field="payment" list="acctgTransPaymentList"/> + <clear-field field="copyAcctgTransCtx"/> + <iterate list="acctgTransPaymentList" entry="acctgTransPayment"> + <set field="copyAcctgTransCtx.fromAcctgTransId" from-field="acctgTransPayment.acctgTransId"/> + <set field="copyAcctgTransCtx.revert" value="Y"/> + <call-service service-name="copyAcctgTransAndEntries" in-map-name="copyAcctgTransCtx"/> + </iterate> + </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=790606&r1=790605&r2=790606&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Thu Jul 2 14:49:45 2009 @@ -142,4 +142,10 @@ <attribute name="partyIdFrom" type="String" mode="IN" optional="true"/> <attribute name="invoicePaymentInfoList" type="List" mode="OUT" optional="true"/> </service> + <service name="voidPayment" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="voidPayment" auth="true"> + <description>Sets payment status to PMNT_VOID, removes all PaymentApplications, changes related invoice statuses to + INVOICE_READY if status is INVOICE_PAID, and reverses related AcctgTrans by calling copyAcctgTransAndEntries service</description> + <attribute name="paymentId" mode="IN" optional="false" type="String"/> + </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=790606&r1=790605&r2=790606&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Thu Jul 2 14:49:45 2009 @@ -1966,6 +1966,12 @@ <response name="success" type="view" value="EditAgreementRoles"/> <response name="error" type="view" value="EditAgreementRoles"/> </request-map> + <request-map uri="voidPayment"> + <security https="true" auth="true"/> + <event type="service" invoke="voidPayment"/> + <response name="success" type="view" value="paymentOverview"/> + <response name="error" type="view" value="paymentOverview"/> + </request-map> <!-- ================ Entity Lookup Requests ================= --> <request-map uri="LookupProduct"><security auth="true" https="true"/><response name="success" type="view" value="LookupProduct"/></request-map> Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=790606&r1=790605&r2=790606&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/Menus.xml (original) +++ ofbiz/trunk/applications/accounting/widget/Menus.xml Thu Jul 2 14:49:45 2009 @@ -445,6 +445,20 @@ <parameter param-name="paymentId" from-field="payment.paymentId"/> </link> </menu-item> + <menu-item name="statusToVoidPayment" title="${uiLabelMap.AccountingPaymentTabStatusToVoid}"> + <condition> + <and> + <not><if-empty field="payment.paymentId"/></not> + <and> + <if-compare field="payment.statusId" operator="not-equals" value="PMNT_CONFIRMED"/> + <if-compare field="payment.statusId" operator="not-equals" value="PMNT_VOID"/> + </and> + </and> + </condition> + <link target="voidPayment"> + <parameter param-name="paymentId" from-field="payment.paymentId"/> + </link> + </menu-item> </menu> <menu name="PaymentGroupTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> |
Free forum by Nabble | Edit this page |