Author: ashish
Date: Tue May 13 06:19:50 2008
New Revision: 655851
URL: http://svn.apache.org/viewvc?rev=655851&view=rev
Log:
Applied patch from JIRA issue (Save an Invoice as Invoice Template) :-
https://issues.apache.org/jira/browse/OFBIZ-1672
Here is the description :-
Save Invoice as Template
1) Add Seed Invoice Type TEMPLATE.
2) Add two sub invoice Types SALES_INV_TEMPLATE and PUR_INV_TEMPLATE
3) Add [Save Invoice as Template] button on Create Invoice and Edit Invoice
screens. On Click save Invoice data as Invoice Template.
Thanks Sumit Pandit for working on this.
Patched a typo.
Modified:
ofbiz/trunk/applications/accounting/data/AccountingTypeData.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/WEB-INF/controller.xml
ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml
ofbiz/trunk/applications/accounting/widget/Menus.xml
Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=655851&r1=655850&r2=655851&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Tue May 13
06:19:50 2008
@@ -446,6 +446,9 @@
<InvoiceType description="Customer Return" hasTable="N"
invoiceTypeId="CUST_RTN_INVOICE" parentTypeId="PURCHASE_INVOICE"/>
<InvoiceType description="Commission" hasTable="N"
invoiceTypeId="COMMISSION_INVOICE" parentTypeId="PURCHASE_INVOICE"/>
<InvoiceType description="Interest" hasTable="N"
invoiceTypeId="INTEREST_INVOICE" parentTypeId="SALES_INVOICE"/>
+ <InvoiceType description="Invoice Template" hasTable="N"
invoiceTypeId="TEMPLATE"/>
+ <InvoiceType description="Sales Invoice Template" hasTable="N"
invoiceTypeId="SALES_INV_TEMPLATE" parentTypeId="TEMPLATE"/>
+ <InvoiceType description="Purchase Invoice Template" hasTable="N"
invoiceTypeId="PUR_INV_TEMPLATE" parentTypeId="TEMPLATE"/>
<!-- maps line items such as order items to invoice item types. separate
mapping for sales and purchase invoices -->
<InvoiceItemTypeMap invoiceTypeId="SALES_INVOICE"
invoiceItemMapKey="FINISHED_GOOD" invoiceItemTypeId="INV_FPROD_ITEM"/>
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=655851&r1=655850&r2=655851&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
Tue May 13 06:19:50 2008
@@ -169,6 +169,9 @@
<now-timestamp-to-env env-name="nowTimestamp"/>
<set field="invoice.invoiceDate" from-field="nowTimestamp"/>
<set field="invoice.statusId" value="INVOICE_IN_PROCESS"/>
+ <if-not-empty field-name="parameters.invoiceTypeId">
+ <set field="invoice.invoiceTypeId"
from-field="parameters.invoiceTypeId"/>
+ </if-not-empty>
<set-service-fields service-name="createInvoice" map-name="invoice"
to-map-name="newInvoice"/>
<clear-field field-name="newInvoice.invoiceId"/>
<call-service service-name="createInvoice" in-map-name="newInvoice">
@@ -484,6 +487,17 @@
<create-value value-name="newEntity"/>
</simple-method>
+ <simple-method method-name="copyInvoiceToTemplate" short-description="copy
a invoice to a InvoiceType starting with 'template'">
+ <set field="parameters.invoiceIdToCopyFrom"
from-field="parameters.invoiceId"/>
+ <if-compare field-name="parameters.invoiceTypeId" operator="equals"
value="SALES_INVOICE">
+ <set field="parameters.invoiceTypeId" value="SALES_INV_TEMPLATE"/>
+ </if-compare>
+ <if-compare field-name="parameters.invoiceTypeId" operator="equals"
value="PURCHASE_INVOICE">
+ <set field="parameters.invoiceTypeId" value="PUR_INV_TEMPLATE"/>
+ </if-compare>
+ <call-simple-method method-name="copyInvoice"/>
+ </simple-method>
+
<!-- ===============subroutine services =================-->
<simple-method method-name="InvoiceStatusInProgress"
short-description="Check if the invoiceStatus is in progress">
<!-- find the current header record -->
Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=655851&r1=655850&r2=655851&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Tue May
13 06:19:50 2008
@@ -76,6 +76,13 @@
<attribute name="paidDate" type="Timestamp" mode="IN"
optional="true"/> <!-- only relevant for changes to PAID -->
<attribute name="oldStatusId" type="String" mode="OUT"
optional="true"/>
</service>
+ <service name="copyInvoiceToTemplate" engine="simple"
+ location="org/ofbiz/accounting/invoice/InvoiceServices.xml"
invoke="copyInvoiceToTemplate">
+ <description>Save a Invoice data to a template .</description>
+ <permission-service service-name="acctgInvoicePermissionCheck"
main-action="CREATE"/>
+ <attribute name="invoiceId" type="String" mode="INOUT"
optional="false"/>
+ <attribute name="invoiceTypeId" type="String" mode="IN"
optional="false"/>
+ </service>
<!--
TODO: There is a big problem with the taxableFlag. Currently, all
adjustments are treated as having the same taxableFlag as
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=655851&r1=655850&r2=655851&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
(original)
+++
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
Tue May 13 06:19:50 2008
@@ -276,6 +276,12 @@
<response name="success" type="view" value="invoiceOverview"/>
<response name="error" type="view" value="invoiceOverview"/>
</request-map>
+ <request-map uri="copyInvoiceToTemplate">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="copyInvoiceToTemplate"/>
+ <response name="success" type="view" value="editInvoice"/>
+ <response name="error" type="view" value="editInvoice"/>
+ </request-map>
<!-- Request EditInvoiceItemType -->
<request-map uri="editInvoiceItemType">
Modified: ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml?rev=655851&r1=655850&r2=655851&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml Tue May 13
06:19:50 2008
@@ -26,6 +26,7 @@
<screen name="CommonInvoiceDecorator">
<section>
<actions>
+ <property-map resource="ProjectMgrUiLabels"
map-name="uiLabelMap" global="true"/>
<set field="headerItem" value="invoices"/>
</actions>
<widgets>
Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=655851&r1=655850&r2=655851&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/Menus.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/Menus.xml Tue May 13 06:19:50
2008
@@ -240,7 +240,19 @@
</condition>
<link target="javascript:confirmActionLink('You want to cancel
this invoice number
${invoice.invoiceId}?','setInvoiceStatus?invoiceId=${invoice.invoiceId}&statusId=INVOICE_CANCELLED')"
url-mode="plain"/>
</menu-item>
-
+ <menu-item name="saveInvoiceAsTemplate"
title="${uiLabelMap.ProjectMgrSaveAsTemplate}">
+ <condition>
+ <and>
+ <not><if-empty field-name="invoice.invoiceId"/></not>
+ <or>
+ <if-compare field-name="invoice.invoiceTypeId"
operator="equals" value="SALES_INVOICE"/>
+ <if-compare field-name="invoice.invoiceTypeId"
operator="equals" value="PURCHASE_INVOICE"/>
+ </or>
+ </and>
+ </condition>
+ <link
target="copyInvoiceToTemplate?invoiceId=${invoice.invoiceId}&invoiceTypeId=${invoice.invoiceTypeId}"/>
+ </menu-item>
+
</menu>
<menu name="PaymentTabBar" menu-container-style="button-bar
button-style-1" default-selected-style="selected">