svn commit: r799549 - in /ofbiz/trunk/applications/accounting: ofbiz-component.xml script/org/ofbiz/accounting/invoice/InvoiceServices.xml servicedef/secas_invoice.xml servicedef/secas_ledger.xml servicedef/services_invoice.xml

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

svn commit: r799549 - in /ofbiz/trunk/applications/accounting: ofbiz-component.xml script/org/ofbiz/accounting/invoice/InvoiceServices.xml servicedef/secas_invoice.xml servicedef/secas_ledger.xml servicedef/services_invoice.xml

apatel-2
Author: apatel
Date: Fri Jul 31 08:58:41 2009
New Revision: 799549

URL: http://svn.apache.org/viewvc?rev=799549&view=rev
Log:
Delete invoice item assoc when Commission Invoice is cancelled. This will allow user to create new commission invoice if needed.

Rishi, Sumit, Amit, Thanks for working on it. Patch from OFBIZ-2776

Added:
    ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml   (with props)
Modified:
    ofbiz/trunk/applications/accounting/ofbiz-component.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
    ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml

Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=799549&r1=799548&r2=799549&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Fri Jul 31 08:58:41 2009
@@ -77,6 +77,7 @@
     <service-resource type="eca" loader="main" location="servicedef/secas_payment.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas_ledger.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas_olap.xml"/>
+    <service-resource type="eca" loader="main" location="servicedef/secas_invoice.xml"/>
 
     <test-suite loader="main" location="testdef/accountingtests.xml"/>
     <test-suite loader="main" location="testdef/paymenttests.xml"/>

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=799549&r1=799548&r2=799549&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Fri Jul 31 08:58:41 2009
@@ -606,6 +606,7 @@
             <set field="removePaymentApplicationCtx.paymentApplicationId" from-field="paymentApplication.paymentApplicationId"/>
             <call-service service-name="removePaymentApplication" in-map-name="removePaymentApplicationCtx"/>
         </iterate>
+        <field-to-result result-name="invoiceTypeId" field="invoice.invoiceTypeId"/>
     </simple-method>
 
     <simple-method method-name="getInvoiceRunningTotal" short-description="calculate running total for Invoices">
@@ -649,4 +650,14 @@
         <field-to-result field="filteredInvoiceList"/>
     </simple-method>
 
+    <simple-method method-name="removeInvoiceItemAssocOnCancelInvoice" short-description="Remove invoiceItemAssoc record on cancel invoice">
+        <entity-and entity-name="InvoiceItemAssoc" list="invoiceItemAssocs">
+            <field-map field-name="invoiceIdTo" from-field="parameters.invoiceId"/>
+        </entity-and>
+        <iterate entry="invoiceItemAssoc" list="invoiceItemAssocs">
+            <set-service-fields service-name="deleteInvoiceItemAssoc" map="invoiceItemAssoc" to-map="deleteInvoiceItemAssocMap"/>
+            <call-service service-name="deleteInvoiceItemAssoc" in-map-name="deleteInvoiceItemAssocMap"/>
+            <log level="info" message="Removed invoiceItemAssoc: ${invoiceItemAssoc}"/>
+        </iterate>
+    </simple-method>
 </simple-methods>

Added: ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml?rev=799549&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml (added)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml Fri Jul 31 08:58:41 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
+
+    <!-- On cancelling invoice reverse its Accounting Transactions -->
+    <eca service="cancelInvoice" event="invoke">
+        <action service="revertAcctgTransOnCancelInvoice" mode="sync"/>
+    </eca>
+
+    <!-- Remove InvoiceItemAssoc on cancel commission invoice -->
+    <eca service="cancelInvoice" event="commit">
+        <condition field-name="invoiceTypeId" operator="equals" value="COMMISSION_INVOICE"/>
+        <action service="removeInvoiceItemAssocOnCancelInvoice" mode="sync"/>
+    </eca>
+</service-eca>

Propchange: ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/servicedef/secas_invoice.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=799549&r1=799548&r2=799549&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Fri Jul 31 08:58:41 2009
@@ -131,8 +131,4 @@
         <condition field-name="statusId" operator="equals" value="INVOICE_CANCELLED"/>
         <action service="cancelInvoice" mode="sync"/>
     </eca>
-    <!-- On canceling invoice reverse its Accounting Transactions -->
-    <eca service="cancelInvoice" event="invoke">
-        <action service="revertAcctgTransOnCancelInvoice" mode="sync"/>
-    </eca>
 </service-eca>
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=799549&r1=799548&r2=799549&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Fri Jul 31 08:58:41 2009
@@ -292,6 +292,7 @@
             location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="cancelInvoice">
         <description>Cancel Invoice</description>
         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
+        <attribute name="invoiceTypeId" type="String" mode="OUT" optional="false"/>
     </service>
     
     <service name="getInvoiceRunningTotal" engine="simple"
@@ -326,4 +327,10 @@
         <description>Delete a InvoiceItemAssoc</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+
+    <service name="removeInvoiceItemAssocOnCancelInvoice" engine="simple"
+            location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="removeInvoiceItemAssocOnCancelInvoice" auth="true">
+        <description>Remove invoiceItemAssoc record on cancel invoice</description>
+        <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
+    </service>
 </services>