Fixes issue 11996: The jasper report linked to MM Shipment/Receipt is not printed
authorHarikrishnan Raja <harikrishnan.raja@openbravo.com>
Tue, 20 Apr 2010 11:21:28 +0530
changeset 7093 098eeb5c3218
parent 7092 7fdc688179fe
child 7094 e765cd806d02
Fixes issue 11996: The jasper report linked to MM Shipment/Receipt is not printed
src-util/modulescript/build/classes/org/openbravo/modulescript/CreateDoctypeTemplate.class
src-util/modulescript/build/classes/org/openbravo/modulescript/CreateDoctypeTemplateData.class
src-util/modulescript/src/org/openbravo/modulescript/CreateDoctypeTemplate.java
src-util/modulescript/src/org/openbravo/modulescript/CreateDoctypeTemplate_Data.xsql
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/CreateDoctypeTemplate.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/CreateDoctypeTemplateData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/CreateDoctypeTemplate.java	Tue Apr 20 11:21:28 2010 +0530
@@ -0,0 +1,40 @@
+package org.openbravo.modulescript;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.UUID;
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.database.ConnectionProvider;
+
+public class CreateDoctypeTemplate extends ModuleScript{
+
+	@Override
+	//Inserting Doctype template for shipment and receipt.
+	public void execute() {
+		try {
+		      ConnectionProvider cp = getConnectionProvider();
+		      CreateDoctypeTemplateData[] data = CreateDoctypeTemplateData.select(cp);
+		      for (int i = 0; i < data.length; i++) {
+				
+		    	  if(data[i].vCount.equals("0")){
+		    		  String strReportFileName="Goods Shipment-@our_ref@";
+		    		  if(data[i].docbasetype.equals("MMR")){
+		    			  strReportFileName="Goods Receipt-@our_ref@";
+		    		  }
+		    		  String strDoctypeTemplate_id=UUID.randomUUID().toString().replace("-", "").toUpperCase();
+		    		  CreateDoctypeTemplateData.insertDoctypeTemplate(cp.getConnection(), cp, strDoctypeTemplate_id, data[i].adClientId, data[i].cDoctypeId, data[i].name+" Report Template", "@basedesign@/org/openbravo/erpReports", strReportFileName, "RptM_InOut.jrxml");
+		    		  CreateDoctypeTemplateData.insertEmailDefinition(cp.getConnection(), cp, data[i].adClientId, strDoctypeTemplate_id);
+		    	  }
+			}
+		    } catch (Exception e) {
+		    	handleError(e);
+		    }
+
+	}
+	
+	
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/CreateDoctypeTemplate_Data.xsql	Tue Apr 20 11:21:28 2010 +0530
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ******************************************************************************
+ * The contents of this file are subject to the   Compiere License  Version 1.1
+ * ("License"); You may not use this file except in compliance with the License
+ * You may obtain a copy of the License at http://www.compiere.org/license.html
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is                  Compiere  ERP & CRM  Business Solution
+ * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
+ * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
+ * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
+ * Contributor(s): Openbravo SLU
+ * Contributions are Copyright (C) 2001-2009 Openbravo S.L.U.
+ ******************************************************************************
+-->
+<SqlClass name="CreateDoctypeTemplateData" package="org.openbravo.modulescript">
+   <SqlClassComment></SqlClassComment>
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+      select c_doctype_id, ad_client_id, name,(select count(*) from c_poc_doctype_template ct where ct.c_doctype_id = c_doctype.c_doctype_id) AS v_count, docBaseType 
+      from c_doctype where docbasetype in ('MMR','MMS')
+      ]]>
+    </Sql>
+  </SqlMethod>
+<SqlMethod name="insertDoctypeTemplate" type="preparedStatement" connection="true" return="rowCount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+      INSERT INTO c_poc_doctype_template(
+            c_poc_doctype_template_id, ad_client_id, ad_org_id, isactive, 
+            created, createdby, updated, updatedby, c_doctype_id, name, 
+            templatelocation, reportfilename, templatefilename)
+      VALUES (?, ?, '0', 'Y', 
+            now(), '0', now(), '0', ?, ?, 
+            ?, ?, ?)
+      ]]>
+    </Sql>
+    <Parameter name="doctypetemplateId"/>
+    <Parameter name="clientId"/>
+    <Parameter name="doctypeId"/>
+    <Parameter name="name"/>
+    <Parameter name="templatelocation"/>
+    <Parameter name="reportfilename"/>
+    <Parameter name="templatefilename"/>
+  </SqlMethod>
+  <SqlMethod name="insertEmailDefinition" type="preparedStatement" connection="true" return="rowCount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+      INSERT INTO c_poc_emaildefinition(
+            c_poc_emaildefinition_id, ad_client_id, ad_org_id, isactive, 
+            created, createdby, updated, updatedby, c_poc_doctype_template_id, 
+            subject, body, isdefault, ad_language)
+      VALUES (GET_UUID(), ?, '0', 'Y', 
+            now(), '0', now(), '0', ?, 
+            '', '', 'Y', 'en_US')
+      ]]>
+    </Sql>
+    <Parameter name="clientId"/>
+    <Parameter name="doctypetemplateId"/>
+  </SqlMethod>
+</SqlClass>
\ No newline at end of file