Author: hansbak
Date: Thu Jul 11 03:14:30 2013
New Revision: 1502093
URL: http://svn.apache.org/r1502093
Log:
add a csv import/export invoices at an organizational level with partyid and
productid translation functions, more imports/exports will follow
Added:
ofbiz/trunk/framework/base/lib/commons/commons-csv-1.0.jar (with props)
Modified:
ofbiz/trunk/.classpath
ofbiz/trunk/LICENSE
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml
ofbiz/trunk/applications/accounting/entitydef/entitymodel_reports.xml
ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml
ofbiz/trunk/applications/accounting/widget/GlSetupScreens.xml
ofbiz/trunk/framework/common/config/CommonUiLabels.xml
Modified: ofbiz/trunk/.classpath
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/.classpath (original)
+++ ofbiz/trunk/.classpath Thu Jul 11 03:14:30 2013
@@ -83,6 +83,7 @@
<classpathentry kind="lib"
path="framework/base/lib/commons/commons-pool-1.3.jar"/>
<classpathentry kind="lib"
path="framework/base/lib/commons/commons-primitives-1.0.jar"/>
<classpathentry kind="lib"
path="framework/base/lib/commons/commons-validator-1.4.0.jar"/>
+ <classpathentry kind="lib"
path="framework/base/lib/commons/commons-csv-1.0.jar"/>
<classpathentry kind="lib"
path="framework/base/lib/j2eespecs/geronimo-activation_1.0.2_spec-1.0.jar"/>
<classpathentry kind="lib"
path="framework/base/lib/j2eespecs/geronimo-j2ee-connector_1.5_spec-1.0.jar"/>
<classpathentry kind="lib"
path="framework/base/lib/j2eespecs/geronimo-jaxr_1.0_spec-1.0.jar"/>
Modified: ofbiz/trunk/LICENSE
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/LICENSE (original)
+++ ofbiz/trunk/LICENSE Thu Jul 11 03:14:30 2013
@@ -44,6 +44,7 @@ framework/base/lib/commons/commons-cli-1
framework/base/lib/commons/commons-codec-1.6.jar
framework/base/lib/commons/commons-collections-3.2.1.jar
framework/base/lib/commons/commons-compress-1.4.1.jar
+framework/base/lib/commons/commons-csv-1.0.jar
framework/base/lib/commons/commons-digester3-3.2.jar
framework/base/lib/commons/commons-discovery-0.4.jar
framework/base/lib/commons/commons-el-1.0.jar
@@ -2729,4 +2730,5 @@ This package also includes the following
donated by SyncRO Soft Ltd., the publishers of the oXygen XML Editor.
* Cosmetic improvements provided by OpenStack.
-Webhelp for DocBook was developed as a Google Summer of Code project. August 2010
\ No newline at end of file
+Webhelp for DocBook was developed as a Google Summer of Code project. August
2010
+
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Jul
11 03:14:30 2013
@@ -5010,6 +5010,9 @@
<value
xml:lang="zh">åºå®èµäº§æ°æ®ä¸çææä½¿ç¨å¯¿å½ç»æä¸ºç©ºã</value>
<value
xml:lang="zh_TW">åºå®è³ç¢è³æä¸çææä½¿ç¨å£½å½çµæçºç©ºã</value>
</property>
+ <property key="AccountingExportInvoices">
+ <value xml:lang="en">Export Invoices</value>
+ </property>
<property key="AccountingExpenses">
<value xml:lang="de">Aufwendungen</value>
<value xml:lang="en">Expenses</value>
Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Thu Jul 11
03:14:30 2013
@@ -1087,4 +1087,7 @@ under the License.
<CustomMethod customMethodId="STR_LINE_DEP_FORMULA" customMethodTypeId="DEPRECIATION_FORMULA"
customMethodName="straightLineDepreciation" description="Straight Line depreciatiion algorithm for fixed
asset((purchaseCost - salvageCost)/expectedLifeInYears)"/>
<CustomMethod customMethodId="DBL_DECL_DEP_FORMULA" customMethodTypeId="DEPRECIATION_FORMULA"
customMethodName="doubleDecliningBalanceDepreciation" description="Double decline depreciatiion algorithm for
fixed asset((NetBookValue - salvageCost)*2/remainingLifeInYears)"/>
+ <!-- invoice export replacement Id types -->
+ <GoodIdentificationType description="replacement value for partyId in the invoice export
function in accounting" goodIdentificationTypeId="INVOICE_EXPORT"/>
+ <PartyIdentificationType description="replacement value for partyId in the invoice export
function in accounting" partyIdentificationTypeId="INVOICE_EXPORT"/>
</entity-engine-xml>
Modified: ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml Thu Jul
11 03:14:30 2013
@@ -224,4 +224,7 @@ under the License.
partyId="Company" transactionDate="2009-07-18 00:00:01.000" entryDate="2009-08-11 12:28:45.315"
performedByPartyId="admin" statusId="FINACT_TRNS_CREATED" paymentId="8002"/>
<Payment paymentId="8002" finAccountTransId="9104"/>
+ <!-- invoice export demo data for replacement id's -->
+ <GoodIdentification goodIdentificationTypeId="INVOICE_EXPORT"
idValue="GZ-2644-replaced" productId="GZ-2644"/>
+ <PartyIdentification idValue="DemoCustomer2" partyId="DemoCustomer"
partyIdentificationTypeId="INVOICE_EXPORT"/>
</entity-engine-xml>
Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel_reports.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel_reports.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel_reports.xml
(original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel_reports.xml Thu
Jul 11 03:14:30 2013
@@ -77,4 +77,51 @@ under the License.
<key-map field-name="productId"/>
</view-link>
</view-entity>
+
+ <view-entity entity-name="InvoiceExport"
package-name="org.ofbiz.accounting.reports">
+ <member-entity entity-alias="INV" entity-name="Invoice"/>
+ <member-entity entity-alias="ITM" entity-name="InvoiceItem"/>
+ <member-entity entity-alias="PFR" entity-name="PartyIdentification"/>
+ <member-entity entity-alias="PTO" entity-name="PartyIdentification"/>
+ <member-entity entity-alias="GI" entity-name="GoodIdentification"/>
+ <alias entity-alias="INV" name="invoiceId" />
+ <alias entity-alias="INV" name="invoiceDate"/>
+ <alias entity-alias="INV" name="invoiceTypeId"/>
+ <alias entity-alias="INV" name="description"/>
+ <alias entity-alias="INV" name="partyIdFrom"/>
+ <alias entity-alias="PFR" name="partyIdFromTrans" field="idValue"/>
+ <alias entity-alias="INV" name="partyId"/>
+ <alias entity-alias="PTO" name="partyIdTrans" field="idValue"/>
+ <alias entity-alias="INV" name="currencyUomId"/>
+ <alias entity-alias="INV" name="referenceNum"/>
+ <alias entity-alias="ITM" name="invoiceItemSeqId"/>
+ <alias entity-alias="ITM" name="invoiceItemTypeId"/>
+ <alias entity-alias="ITM" name="itemDescription" field="description"/>
+ <alias entity-alias="ITM" name="productId"/>
+ <alias entity-alias="GI" name="productIdTrans" field="idValue"/>
+ <alias entity-alias="ITM" name="quantity"/>
+ <alias entity-alias="ITM" name="amount"/>
+ <view-link entity-alias="INV" rel-entity-alias="ITM"
rel-optional="true">
+ <key-map field-name="invoiceId"/>
+ </view-link>
+ <view-link entity-alias="INV" rel-entity-alias="PFR"
rel-optional="true">
+ <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
+ <entity-condition>
+ <condition-expr entity-alias="PFR" field-name="partyIdentificationTypeId"
value="INVOICE_EXPORT"/>
+ </entity-condition>
+ </view-link>
+ <view-link entity-alias="INV" rel-entity-alias="PTO"
rel-optional="true">
+ <key-map field-name="partyId"/>
+ <entity-condition>
+ <condition-expr entity-alias="PTO" field-name="partyIdentificationTypeId"
value="INVOICE_EXPORT"/>
+ </entity-condition>
+ </view-link>
+ <view-link entity-alias="ITM" rel-entity-alias="GI"
rel-optional="true">
+ <key-map field-name="productId"/>
+ <entity-condition>
+ <condition-expr entity-alias="GI"
field-name="goodIdentificationTypeId"/>
+ </entity-condition>
+ </view-link>
+ </view-entity>
+
</entitymodel>
Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Thu Jul
11 03:14:30 2013
@@ -430,5 +430,12 @@ under the License.
<attribute name="invoiceId" type="String" mode="IN" optional="false"/>
<attribute name="isForeign" type="Boolean" mode="OUT"
optional="false"/>
</service>
+ <service name="importInvoice" engine="java"
+ location="org.ofbiz.accounting.invoice.InvoiceServices" invoke="importInvoice"
auth="true">
+ <description>Import an invoice with invoiceitems in csv
format</description>
+ <permission-service service-name="acctgInvoicePermissionCheck"
main-action="CREATE"/>
+ <attribute mode="INOUT" name="organizationPartyId" type="String"
optional="false"/>
+ <attribute mode="IN" name="uploadedFile" type="java.nio.ByteBuffer"
optional="true" />
+ </service>
</services>
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Thu Jul 11 03:14:30 2013
@@ -18,7 +18,16 @@
*******************************************************************************/
package org.ofbiz.accounting.invoice;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVFormat.CSVFormatBuilder;
+import org.apache.commons.csv.CSVRecord;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Iterator;
@@ -3334,5 +3343,164 @@ public class InvoiceServices {
return ServiceUtil.returnError(ee.getMessage());
}
}
+
+ public static Map<String, Object> importInvoice(DispatchContext dctx,
Map<String, Object> context) {
+ Delegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+ ByteBuffer fileBytes = (ByteBuffer) context.get("uploadedFile");
+ String organizationPartyId = (String)
context.get("organizationPartyId");
+ String encoding = System.getProperty("file.encoding");
+ String csvString =
Charset.forName(encoding).decode(fileBytes).toString();
+ final BufferedReader csvReader = new BufferedReader(new
StringReader(csvString));
+ final CSVFormatBuilder builder =
CSVFormat.newBuilder(',').withQuoteChar('"').withHeader();
+ CSVFormat fmt = builder.build();
+ List<String> errMsgs = FastList.newInstance();
+ List<String> newErrMsgs = FastList.newInstance();
+ String lastInvoiceId = null;
+ String currentInvoiceId = null;
+ String newInvoiceId = null;
+ int invoicesCreated = 0;
+
+ if (fileBytes == null) {
+ return ServiceUtil.returnError("Uploaded file data not found");
+ }
+
+ try {
+ for(final CSVRecord rec : fmt.parse(csvReader)) {
+ currentInvoiceId = rec.get("invoiceId");
+ if (lastInvoiceId == null ||
!currentInvoiceId.equals(lastInvoiceId)) {
+ newInvoiceId = null;
+ Map<String, Object> invoice = UtilMisc.toMap(
+ "invoiceTypeId",
rec.get("invoiceTypeId"),
+ "partyIdFrom", rec.get("partyIdFrom"),
+ "partyId", rec.get("partyId"),
+ "invoiceDate", rec.get("invoiceDate"),
+ "dueDate", rec.get("dueDate"),
+ "currencyUomId",
rec.get("currencyUomId"),
+ "description", rec.get("description"),
+ "referenceNum", rec.get("referenceNum") + "
Imported: orginal InvoiceId: " + currentInvoiceId,
+ "userLogin", userLogin
+ );
+
+ // replace values if required
+ if
(UtilValidate.isNotEmpty(rec.get("partyIdFromTrans"))) {
+ invoice.put("partyIdFrom",
rec.get("partyIdFromTrans"));
+ }
+ if
(UtilValidate.isNotEmpty(rec.get("partyIdTrans"))) {
+ invoice.put("partyId",
rec.get("partyIdTrans"));
+ }
+
+ // invoice validation
+ try {
+ newErrMsgs = FastList.newInstance();
+ if (UtilValidate.isEmpty(invoice.get("partyIdFrom"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() +
": Mandatory Party Id From and Party Id From Trans missing for invoice: " +
currentInvoiceId);
+ } else if (delegator.findOne("Party", UtilMisc.<String,
Object>toMap("partyId", invoice.get("partyIdFrom")), false) == null) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyIdFrom:
" + invoice.get("partyIdFrom") + " not found for invoice: " + currentInvoiceId);
+ }
+ if (UtilValidate.isEmpty(invoice.get("partyId"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() +
": Mandatory Party Id and Party Id Trans missing for invoice: " + currentInvoiceId);
+ } else if (delegator.findOne("Party", UtilMisc.<String,
Object>toMap("partyId", invoice.get("partyId")), false) == null) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId:
" + invoice.get("partyId") + " not found for invoice: " + currentInvoiceId);
+ }
+ if
(UtilValidate.isEmpty(invoice.get("invoiceTypeId"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() +
": Mandatory Invoice Type missing for invoice: " + currentInvoiceId);
+ } else if (delegator.findOne("InvoiceType", UtilMisc.<String,
Object>toMap("invoiceTypeId", invoice.get("invoiceTypeId")), false) == null) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem
type id: " + invoice.get("invoiceTypeId") + " not found for invoice: " + currentInvoiceId);
+ }
+ GenericValue invoiceType = delegator.findOne("InvoiceType", UtilMisc.<String,
Object>toMap("invoiceTypeId", invoice.get("invoiceTypeId")), false);
+ if ("PURCHASE_INVOICE".equals(invoiceType.getString("parentTypeId"))
&& !invoice.get("partyId").equals(organizationPartyId)) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A purchase type invoice
should have the partyId 'To' being the organizationPartyId(=" + organizationPartyId + ")! however is " +
invoice.get("partyId") +"! invoice: " + currentInvoiceId);
+ }
+ if ("SALES_INVOICE".equals(invoiceType.getString("parentTypeId"))
&& !invoice.get("partyIdFrom").equals(organizationPartyId)) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A sales type invoice
should have the partyId 'from' being the organizationPartyId(=" + organizationPartyId + ")! however is " +
invoice.get("partyIdFrom") +"! invoice: " + currentInvoiceId);
+ }
+
+
+ } catch (GenericEntityException e) {
+ Debug.logError("Valication checking problem against
database. due to " + e.getMessage(), module);
+ }
+
+ if (newErrMsgs.size() > 0) {
+ errMsgs.addAll(newErrMsgs);
+ } else {
+ Map<String, Object> invoiceResult = null;
+ try {
+ invoiceResult =
dispatcher.runSync("createInvoice", invoice);
+ } catch (GenericServiceException e) {
+ Debug.logError(e, module);
+ return
ServiceUtil.returnError(e.getMessage());
+ }
+ newInvoiceId = (String) invoiceResult.get("invoiceId");
+ invoicesCreated++;
+ }
+ lastInvoiceId = currentInvoiceId;
+ }
+
+
+ if (newInvoiceId != null) {
+ Map<String, Object> invoiceItem =
UtilMisc.toMap(
+ "invoiceId", newInvoiceId,
+ "invoiceItemSeqId", rec.get("invoiceItemSeqId"),
+ "invoiceItemTypeId",
rec.get("invoiceItemTypeId"),
+ "productId", rec.get("productId"),
+ "description", rec.get("itemDescription"),
+ "amount", rec.get("amount"),
+ "quantity", rec.get("quantity"),
+ "userLogin", userLogin
+ );
+
+ if
(UtilValidate.isNotEmpty(rec.get("productIdTrans"))) {
+ invoiceItem.put("productId",
rec.get("productIdTrans"));
+ }
+ // invoice item validation
+ try {
+ newErrMsgs = FastList.newInstance();
+ if
(UtilValidate.isEmpty(invoiceItem.get("invoiceItemSeqId"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() +
": Mandatory item sequence Id missing for invoice: " + currentInvoiceId);
+ }
+ if
(UtilValidate.isEmpty(invoiceItem.get("invoiceItemTypeId"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() +
": Mandatory invoice item type missing for invoice: " + currentInvoiceId);
+ } else if (delegator.findOne("InvoiceItemType", UtilMisc.<String,
Object>toMap("invoiceItemTypeId", invoiceItem.get("invoiceItemTypeId")), false) == null) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem Item type id: "
+ invoiceItem.get("invoiceItemTypeId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" +
invoiceItem.get("invoiceItemSeqId"));
+ }
+ if (UtilValidate.isEmpty(invoiceItem.get("productId")) &&
UtilValidate.isEmpty(invoiceItem.get("description"))) {
+ }
+ if (UtilValidate.isNotEmpty(invoiceItem.get("productId")) &&
delegator.findOne("Product", UtilMisc.<String, Object>toMap("productId",
invoiceItem.get("productId")), false) == null) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Product Id: " +
invoiceItem.get("productId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" +
invoiceItem.get("invoiceItemSeqId"));
+ }
+ if (UtilValidate.isEmpty(invoiceItem.get("amount")) &&
UtilValidate.isEmpty(invoiceItem.get("quantity"))) {
+ newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Either or
both quantity and amount is required for invoice: " + currentInvoiceId + " Item seqId:" +
invoiceItem.get("invoiceItemSeqId"));
+ }
+ } catch (GenericEntityException e) {
+ Debug.logError("Validation checking problem against
database. due to " + e.getMessage(), module);
+ }
+
+ if (newErrMsgs.size() > 0) {
+ errMsgs.addAll(newErrMsgs);
+ } else {
+ try {
+ dispatcher.runSync("createInvoiceItem",
invoiceItem);
+ } catch (GenericServiceException e) {
+ Debug.logError(e, module);
+ return
ServiceUtil.returnError(e.getMessage());
+ }
+ }
+ }
+ }
+
+ } catch (IOException e) {
+ Debug.logError(e, module);
+ return ServiceUtil.returnError(e.getMessage());
+ }
+
+ if (errMsgs.size() > 0) {
+ return ServiceUtil.returnError(errMsgs);
+ }
+ Map<String, Object> result = ServiceUtil.returnSuccess(invoicesCreated + " new invoice(s) created");
+ result.put("organizationPartyId", organizationPartyId);
+ return result;
+ }
}
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=1502093&r1=1502092&r2=1502093&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 11 03:14:30 2013
@@ -753,6 +753,23 @@ under the License.
<security https="true" auth="true"/>
<response name="success" type="view" value="ListGlAccountOrgCsv"/>
</request-map>
+
+ <!-- Import export -->
+ <request-map uri="ImportExport">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="ImportExport"/>
+ </request-map>
+
+ <request-map uri="PartyAccountsExportInvoicesCsv.csv">
+ <security https="true" auth="true"/>
+ <response name="success" type="view"
value="PartyAccountsExportInvoicesCsv"/>
+ </request-map>
+ <request-map uri="uploadInvoice">
+ <security auth="true" https="true"/>
+ <event invoke="importInvoice" path="" type="service"/>
+ <response name="success" type="request" value="ImportExport"/>
+ <response name="error" type="view" value="ImportExport"/>
+ </request-map>
<!-- TO BE REMOVED
<request-map uri="EditGlobalGlAccountOrganizations"><security https="true" auth="true"/><response
name="success" type="view" value="EditGlobalGlAccountOrganizations"/></request-map>
@@ -2768,6 +2785,10 @@ under the License.
<view-map name="ListGlAccountOrgPdf" type="screenfop"
page="component://accounting/widget/GlSetupScreens.xml#ListGlAccountOrgPdf" content-type="application/pdf"
encoding="none"/>
<view-map name="ListGlAccountOrgCsv" type="screencsv"
page="component://accounting/widget/GlSetupScreens.xml#ListGlAccountOrgCsv" content-type="text/csv"
encoding="none"/>
+ <!-- import export -->
+ <view-map name="ImportExport" type="screen"
page="component://accounting/widget/GlSetupScreens.xml#ImportExport"/>
+ <view-map name="PartyAccountsExportInvoicesCsv" type="screencsv"
page="component://accounting/widget/GlSetupScreens.xml#PartyAccountsExportInvoicesCsv" content-type="text/csv"
encoding="none"/>
+
<!-- Manual Credit Card Transaction -->
<view-map name="FindGatewayResponses"
page="component://accounting/widget/TransactionScreens.xml#FindGatewayResponses"
type="screen"/>
<view-map name="ViewGatewayResponse"
page="component://accounting/widget/TransactionScreens.xml#ViewGatewayResponse"
type="screen"/>
Modified: ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml Thu Jul 11
03:14:30 2013
@@ -34,6 +34,11 @@ under the License.
<parameter param-name="organizationPartyId"
from-field="partyId"/>
</hyperlink>
</field>
+ <field name="importexport" title=" " use-when="hasBasicPermission"
widget-style="buttontext">
+ <hyperlink target="ImportExport"
description="${uiLabelMap.CommonImportExport}">
+ <parameter param-name="organizationPartyId"
from-field="partyId"/>
+ </hyperlink>
+ </field>
</form>
<form name="ListGlAccountOrganization" list-name="listIt" target="" title="" type="list" view-size="50"
@@ -71,6 +76,55 @@ under the License.
<field name="submitButton" title="${uiLabelMap.AccountingNewCompany}"><submit
button-type="button"/></field>
</form>
+ <form name="ExportInvoice" type="single" target="PartyAccountsExportInvoicesCsv.csv" title="" >
+ <field name="organizationPartyId"><hidden
value="${parameters.organizationPartyId}"/></field>
+ <field name="invoiceId"><lookup
target-form-name="LookupInvoice"/></field>
+ <field name="startDate"><date-time/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit
button-type="button"/></field>
+ </form>
+
+ <form name="PartyAccountsExportInvoicesCsv" list-name="listIt" target="" title=""
type="list" view-size="99999"
+ odd-row-style="alternate-row" header-row-style="header-row-2"
default-table-style="basic-table hover-bar" paginate="false">
+ <actions>
+ <entity-condition entity-name="InvoiceExport">
+ <condition-list combine="and">
+ <condition-list combine="or">
+ <condition-expr field-name="partyIdFrom"
from-field="organizationPartyId" operator="equals"/>
+ <condition-expr field-name="partyId"
from-field="organizationPartyId" operator="equals"/>
+ </condition-list>
+ <condition-expr field-name="invoiceDate" operator="greater-equals"
from-field="parameters.startDate" ignore-if-empty="true"/>
+ <condition-expr field-name="invoiceId" operator="equals"
from-field="parameters.invoiceId" ignore-if-empty="true"/>
+ </condition-list>
+ <order-by field-name="invoiceId"/>
+ </entity-condition>
+ </actions>
+ <field name="organizationPartyId"><hidden
value="${organizationPartyId}"/></field>
+ <field name="invoiceId" title="invoiceId"><display/></field>
+ <field name="invoiceTypeId" title="invoiceTypeId"><display/></field>
+ <field name="invoiceDate" title="invoiceDate"><display/></field>
+ <field name="dueDate" title="dueDate"><display/></field>
+ <field name="partyIdFrom" title="partyIdFrom"><display/></field>
+ <field name="partyIdFromTrans"
title="partyIdFromTrans"><display/></field>
+ <field name="partyId" title="partyId"><display/></field>
+ <field name="partyIdTrans" title="partyIdTrans"><display/></field>
+ <field name="currencyUomId" title="currencyUomId"><display/></field>
+ <field name="description" title="description"><display/></field>
+ <field name="referenceNum" title="referenceNum"><display/></field>
+ <field name="invoiceItemSeqId"
title="invoiceItemSeqId"><display/></field>
+ <field name="invoiceItemTypeId"
title="invoiceItemTypeId"><display/></field>
+ <field name="productId" title="productId"><display/></field>
+ <field name="productIdTrans" title="productIdTrans"><display/></field>
+ <field name="itemDescription"
title="itemDescription"><display/></field>
+ <field name="quantity" title="quantity"><display/></field>
+ <field name="amount" title="amount"><display/></field>
+ </form>
+
+ <form name="ImportInvoice" type="upload" target="uploadInvoice" title="" >
+ <field name="organizationPartyId"><hidden
value="${parameters.organizationPartyId}"/></field>
+ <field name="uploadedFile"><file/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpload}"><submit
button-type="button"/></field>
+ </form>
+
<form name="AssignGlAccount" type="single" target="createGlAccountOrganization"
title="" default-map-name="account"
header-row-style="header-row" default-table-style="basic-table">
<field name="organizationPartyId"><hidden/></field>
Modified: ofbiz/trunk/applications/accounting/widget/GlSetupScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlSetupScreens.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlSetupScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlSetupScreens.xml Thu Jul 11
03:14:30 2013
@@ -51,7 +51,6 @@ under the License.
<screen name="ListCompanies">
<section>
<actions>
- <property-map resource="AccountingUiLabels" map-name="uiLabelMap"
global="true"/>
<set field="titleProperty"
value="AccountingAvailableInternalOrganizations"/>
<set field="headerItem" value="companies"/>
<set field="labelTitleProperty"
value="${uiLabelMap.AccountingAvailableInternalOrganizations}"/>
@@ -80,7 +79,6 @@ under the License.
<screen name="AddCompany">
<section>
<actions>
- <property-map resource="AccountingUiLabels" map-name="uiLabelMap"
global="true"/>
<set field="titleProperty" value="AccountingNewCompany"/>
</actions>
<widgets>
@@ -94,6 +92,32 @@ under the License.
</widgets>
</section>
</screen>
+ <screen name="ImportExport">
+ <section>
+ <actions>
+ <set field="titleProperty" value="CommonImportExport"/>
+ <entity-one entity-name="PartyGroup" value-field="partyGroup">
+ <field-map field-name="partyId"
from-field="parameters.organizationPartyId"/>
+ </entity-one>
+ </actions>
+ <widgets>
+ <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <screenlet title="${uiLabelMap.AccountingInvoice}
${uiLabelMap.CommonImportExport} ${uiLabelMap.CommonFor}: ${partyGroup.groupName}
[${parameters.organizationPartyId}]">
+ <container style="lefthalf">
+ <label
style="h2">${uiLabelMap.CommonImport}</label>
+ <include-form name="ImportInvoice"
location="component://accounting/widget/GlSetupForms.xml"/>
+ </container>
+ <container style="righthalf">
+ <label
style="h2">${uiLabelMap.CommonExport}</label>
+ <include-form name="ExportInvoice"
location="component://accounting/widget/GlSetupForms.xml"/>
+ </container>
+ </screenlet>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
<screen name="ListGlAccountOrganization">
<section>
<actions>
@@ -559,6 +583,18 @@ under the License.
</widgets>
</section>
</screen>
+ <screen name="PartyAccountsExportInvoicesCsv">
+ <section>
+ <actions>
+ <property-map resource="CommonUiLabels" map-name="uiLabelMap"
global="true"/>
+ <property-map resource="AccountingUiLabels" map-name="uiLabelMap"
global="true"/>
+ <set field="organizationPartyId"
from-field="parameters.organizationPartyId"/>
+ </actions>
+ <widgets>
+ <include-form name="PartyAccountsExportInvoicesCsv"
location="component://accounting/widget/GlSetupForms.xml"/>
+ </widgets>
+ </section>
+ </screen>
<screen name="FindGlAccountCategory">
<section>
<actions>
Added: ofbiz/trunk/framework/base/lib/commons/commons-csv-1.0.jar
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/commons/commons-csv-1.0.jar?rev=1502093&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ofbiz/trunk/framework/base/lib/commons/commons-csv-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1502093&r1=1502092&r2=1502093&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Thu Jul 11 03:14:30
2013
@@ -5166,6 +5166,12 @@
<value xml:lang="vi">Ảnh</value>
<value xml:lang="zh">å¾ç</value>
</property>
+ <property key="CommonImport">
+ <value xml:lang="en">Import</value>
+ </property>
+ <property key="CommonImportExport">
+ <value xml:lang="en">Import/Export</value>
+ </property>
<property key="CommonIn">
<value xml:lang="ar">داخÙ</value>
<value xml:lang="cs">V</value>