You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/12/15 10:43:35 UTC

svn commit: r726662 - in /ofbiz/trunk/applications/accounting: ./ data/ entitydef/ script/org/ofbiz/accounting/invoice/ servicedef/ webapp/accounting/invoice/

Author: jleroux
Date: Mon Dec 15 01:43:34 2008
New Revision: 726662

URL: http://svn.apache.org/viewvc?rev=726662&view=rev
Log:
A patch from Sumit Pandit "A scheduled service to generate Invoice." (https://issues.apache.org/jira/browse/OFBIZ-1796) - OFBIZ-1796


Added:
    ofbiz/trunk/applications/accounting/data/InvoiceScheduledServiceData.xml
Modified:
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/accounting/ofbiz-component.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml

Added: ofbiz/trunk/applications/accounting/data/InvoiceScheduledServiceData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/InvoiceScheduledServiceData.xml?rev=726662&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/data/InvoiceScheduledServiceData.xml (added)
+++ ofbiz/trunk/applications/accounting/data/InvoiceScheduledServiceData.xml Mon Dec 15 01:43:34 2008
@@ -0,0 +1,41 @@
+<?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.
+-->
+
+<entity-engine-xml>
+    <RecurrenceRule recurrenceRuleId="400" untilDateTime="" frequency="MONTHLY" intervalNumber="1" countNumber="-1"/>
+    <RecurrenceInfo recurrenceInfoId="400" startDateTime="2008-05-14 22:00:00.000" recurrenceRuleId="400" recurrenceCount="0"/>
+    <RuntimeData runtimeDataId="8501">
+        <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+            <ofbiz-ser>
+                <map-HashMap>
+                    <map-Entry>
+                        <map-Key>
+                            <std-String value="recurrenceInfoId"/>
+                        </map-Key>
+                        <map-Value>
+                            <std-String value="400"/>
+                        </map-Value>
+                    </map-Entry>
+                </map-HashMap>
+            </ofbiz-ser>
+        ]]></runtimeInfo>
+    </RuntimeData>    
+    <JobSandbox jobId="8500" jobName="Generate Invoice template" runTime="2008-05-14 00:00:00.000" serviceName="autoGenerateInvoiceFromExistingInvoice" runtimeDataId="8501" poolId="pool" runAsUser="system" recurrenceInfoId="400"/>
+</entity-engine-xml>

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=726662&r1=726661&r2=726662&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Mon Dec 15 01:43:34 2008
@@ -1076,6 +1076,7 @@
       <field name="referenceNumber" type="short-varchar"></field> <!-- used to record things like the vendor's invoice number -->
       <field name="description" type="description"></field>
       <field name="currencyUomId" type="id"></field>
+      <field name="recurrenceInfoId" type="id"></field>
       <prim-key field="invoiceId"/>
       <relation type="one" fk-name="INVOICE_INVTYP" rel-entity-name="InvoiceType">
         <key-map field-name="invoiceTypeId"/>
@@ -1108,6 +1109,9 @@
       <relation type="one" fk-name="INVOICE_CUOM" title="Currency" rel-entity-name="Uom">
         <key-map field-name="currencyUomId" rel-field-name="uomId"/>
       </relation>
+      <relation type="one" fk-name="INVOICE_RECINFO" rel-entity-name="RecurrenceInfo">
+        <key-map field-name="recurrenceInfoId"/>
+      </relation>
     </entity>
     <entity entity-name="InvoiceAttribute"
             package-name="org.ofbiz.accounting.invoice"

Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=726662&r1=726661&r2=726662&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Mon Dec 15 01:43:34 2008
@@ -39,6 +39,7 @@
     <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/UsTaxAccountGroups.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/InvoiceScheduledServiceData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoGeneralChartOfAccounts.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoOrganizationData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoGlSetupData.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=726662&r1=726661&r2=726662&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 Mon Dec 15 01:43:34 2008
@@ -551,4 +551,29 @@
         <set-nonpk-fields value-name="lookedUpValue" map-name="parameters"/>
         <store-value value-name="lookedUpValue"/>
    </simple-method>
+
+   <simple-method method-name="autoGenerateInvoiceFromExistingInvoice" short-description="Scheduled service to generate Invoice from an existing Invoice">
+       <entity-and entity-name="Invoice" list-name="invoices">
+            <field-map field-name="recurrenceInfoId" env-name="parameters.recurrenceInfoId"/>
+       </entity-and>
+       <iterate list-name="invoices" entry-name="invoice">
+           <set-service-fields service-name="copyInvoice" map-name="invoice" to-map-name="copyInvoiceCtx"/>
+           <set field="copyInvoiceCtx.invoiceIdToCopyFrom" from-field="invoice.invoiceId"/>
+           <call-service service-name="copyInvoice" in-map-name="copyInvoiceCtx">
+               <result-to-field result-name="invoiceId" field-name="invoiceId"/>
+           </call-service>
+           <set-service-fields service-name="updateInvoice" map-name="invoice" to-map-name="updateInvoiceCtx"/>
+           <set field="updateInvoiceCtx.invoiceId" from-field="invoiceId"/>
+           <if-compare field-name="updateInvoiceCtx.invoiceTypeId" operator="equals" value="SALES_INV_TEMPLATE">
+               <set field="updateInvoiceCtx.invoiceTypeId" value="SALES_INVOICE"/>
+           </if-compare>
+           <if-compare field-name="updateInvoiceCtx.invoiceTypeId" operator="equals" value="PUR_INV_TEMPLATE">
+               <set field="updateInvoiceCtx.invoiceTypeId" value="PURCHASE_INVOICE"/>
+           </if-compare>
+           <clear-field field-name="invoice"/>
+           <clear-field field-name="invoiceIdToCopyFrom" map-name="parameters"/>
+           <clear-field field-name="recurrenceInfoId" map-name="updateInvoiceCtx"/>
+           <call-service service-name="updateInvoice" in-map-name="updateInvoiceCtx"/>
+       </iterate>
+   </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=726662&r1=726661&r2=726662&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Mon Dec 15 01:43:34 2008
@@ -281,4 +281,9 @@
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
     </service>
+    <!-- Auto generate Invoice for fixed period -->
+    <service name="autoGenerateInvoiceFromExistingInvoice" engine="simple" location="org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="autoGenerateInvoiceFromExistingInvoice">
+        <description>Scheduled service to generate Invoice from an existing Invoice</description>
+        <attribute name="recurrenceInfoId" mode="IN" type="String" optional="false"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml?rev=726662&r1=726661&r2=726662&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml Mon Dec 15 01:43:34 2008
@@ -281,6 +281,7 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field position="2" name="recurrenceInfoId"><text size="10"/></field>
         <field position="1" name="invoiceMessage"><text size="100"/></field>
         <!--field position="2" name="invoiceAmount" use-when="invoiceId!=null"><display/></field-->
         <field position="1" name="updateButton" widget-style="smallSubmit" use-when="invoice!=null&amp;&amp;invoice.getString(&quot;statusId&quot;).equals(&quot;INVOICE_IN_PROCESS&quot;)">
@@ -555,4 +556,4 @@
         <field name="paidAmount"><display/></field>
         <field name="outstandingAmount"><display/></field>
     </form>
-</forms>
\ No newline at end of file
+</forms>