[email] Fixed issue 19344: Added more audit capabilities
authorDavid Baz Fayos <david.baz@openbravo.com>
Mon, 02 Jan 2012 13:31:03 +0100
changeset 15063 da9ac3c4fcbe
parent 15062 d895851f84c2
child 15064 f8a00d1435e7
[email] Fixed issue 19344: Added more audit capabilities
src-db/database/model/tables/C_POC_EMAIL.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql
src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
--- a/src-db/database/model/tables/C_POC_EMAIL.xml	Fri Dec 30 21:49:17 2011 +0100
+++ b/src-db/database/model/tables/C_POC_EMAIL.xml	Mon Jan 02 13:31:03 2012 +0100
@@ -69,12 +69,23 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="AD_TABLE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="DOCUMENT_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="C_POC_EMAIL_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="C_POC_EMAIL_AD_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_TABLE" name="C_POC_EMAIL_AD_TABLE">
+        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_POC_EMAIL_C_BPARTNER">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Fri Dec 30 21:49:17 2011 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Jan 02 13:31:03 2012 +0100
@@ -213706,6 +213706,40 @@
 <!--00FA42F2239C49ACA79CAC3A030F8DCD-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
 <!--00FA42F2239C49ACA79CAC3A030F8DCD--></AD_COLUMN>
 
+<!--0228220C3302481EB86E7B9D50DBA20F--><AD_COLUMN>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_COLUMN_ID><![CDATA[0228220C3302481EB86E7B9D50DBA20F]]></AD_COLUMN_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <NAME><![CDATA[AD_Table_ID]]></NAME>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <DESCRIPTION><![CDATA[A dictionary table used for this tab that points to the database table.]]></DESCRIPTION>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <HELP><![CDATA[The Table indicates the table in which a field or fields reside.]]></HELP>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <COLUMNNAME><![CDATA[AD_Table_ID]]></COLUMNNAME>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_TABLE_ID><![CDATA[1000500002]]></AD_TABLE_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <SEQNO><![CDATA[180]]></SEQNO>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_ELEMENT_ID><![CDATA[126]]></AD_ELEMENT_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <POSITION><![CDATA[18]]></POSITION>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--0228220C3302481EB86E7B9D50DBA20F-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--0228220C3302481EB86E7B9D50DBA20F--></AD_COLUMN>
+
 <!--02470569EE0849CCAFA8953C00B0E665--><AD_COLUMN>
 <!--02470569EE0849CCAFA8953C00B0E665-->  <AD_COLUMN_ID><![CDATA[02470569EE0849CCAFA8953C00B0E665]]></AD_COLUMN_ID>
 <!--02470569EE0849CCAFA8953C00B0E665-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -240024,6 +240058,39 @@
 <!--6E55794836094404BC74A196392B0648-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
 <!--6E55794836094404BC74A196392B0648--></AD_COLUMN>
 
+<!--6F0994A158ED428A981DE19CDE293665--><AD_COLUMN>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_COLUMN_ID><![CDATA[6F0994A158ED428A981DE19CDE293665]]></AD_COLUMN_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6F0994A158ED428A981DE19CDE293665-->  <NAME><![CDATA[Document_ID]]></NAME>
+<!--6F0994A158ED428A981DE19CDE293665-->  <HELP><![CDATA[The document id that has sent the email.]]></HELP>
+<!--6F0994A158ED428A981DE19CDE293665-->  <COLUMNNAME><![CDATA[Document_ID]]></COLUMNNAME>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_TABLE_ID><![CDATA[1000500002]]></AD_TABLE_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--6F0994A158ED428A981DE19CDE293665-->  <SEQNO><![CDATA[190]]></SEQNO>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_ELEMENT_ID><![CDATA[636D464FBE474F4E87F3003F1E009031]]></AD_ELEMENT_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--6F0994A158ED428A981DE19CDE293665-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--6F0994A158ED428A981DE19CDE293665-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--6F0994A158ED428A981DE19CDE293665-->  <POSITION><![CDATA[19]]></POSITION>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--6F0994A158ED428A981DE19CDE293665-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--6F0994A158ED428A981DE19CDE293665-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--6F0994A158ED428A981DE19CDE293665-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--6F0994A158ED428A981DE19CDE293665--></AD_COLUMN>
+
 <!--6F387D3737CA3635E040007F01002312--><AD_COLUMN>
 <!--6F387D3737CA3635E040007F01002312-->  <AD_COLUMN_ID><![CDATA[6F387D3737CA3635E040007F01002312]]></AD_COLUMN_ID>
 <!--6F387D3737CA3635E040007F01002312-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Dec 30 21:49:17 2011 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Jan 02 13:31:03 2012 +0100
@@ -24035,6 +24035,19 @@
 <!--6302F6EDDA7C4B6A9A5A4533C28387E2-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--6302F6EDDA7C4B6A9A5A4533C28387E2--></AD_ELEMENT>
 
+<!--636D464FBE474F4E87F3003F1E009031--><AD_ELEMENT>
+<!--636D464FBE474F4E87F3003F1E009031-->  <AD_ELEMENT_ID><![CDATA[636D464FBE474F4E87F3003F1E009031]]></AD_ELEMENT_ID>
+<!--636D464FBE474F4E87F3003F1E009031-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--636D464FBE474F4E87F3003F1E009031-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--636D464FBE474F4E87F3003F1E009031-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--636D464FBE474F4E87F3003F1E009031-->  <COLUMNNAME><![CDATA[Document_ID]]></COLUMNNAME>
+<!--636D464FBE474F4E87F3003F1E009031-->  <NAME><![CDATA[Document_ID]]></NAME>
+<!--636D464FBE474F4E87F3003F1E009031-->  <PRINTNAME><![CDATA[Document_ID]]></PRINTNAME>
+<!--636D464FBE474F4E87F3003F1E009031-->  <HELP><![CDATA[The document id that has sent the email.]]></HELP>
+<!--636D464FBE474F4E87F3003F1E009031-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--636D464FBE474F4E87F3003F1E009031-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--636D464FBE474F4E87F3003F1E009031--></AD_ELEMENT>
+
 <!--63874B9705CB4B1F829ED815A16A46B3--><AD_ELEMENT>
 <!--63874B9705CB4B1F829ED815A16A46B3-->  <AD_ELEMENT_ID><![CDATA[63874B9705CB4B1F829ED815A16A46B3]]></AD_ELEMENT_ID>
 <!--63874B9705CB4B1F829ED815A16A46B3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql	Fri Dec 30 21:49:17 2011 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql	Mon Jan 02 13:31:03 2012 +0100
@@ -43,7 +43,9 @@
 			DATEOFEMAIL, 
 			SUBJECT ,
 			BODY ,
-			C_BPARTNER_ID
+			C_BPARTNER_ID,
+			AD_TABLE_ID,
+			DOCUMENT_ID
 		from
 			C_POC_EMAIL
 		where
@@ -78,7 +80,9 @@
 				DATEOFEMAIL, 
 				SUBJECT ,
 				BODY ,
-				C_BPARTNER_ID
+				C_BPARTNER_ID,
+				AD_TABLE_ID,
+				DOCUMENT_ID
         	)
         	VALUES
         	(
@@ -99,6 +103,8 @@
 				TO_DATE(?, 'YYYYMMDDHH24MISS'),
 				?,
 				?,
+				?,
+				?,
 				?
 			)
       ]]></Sql>
@@ -117,6 +123,8 @@
         <Parameter name="subject"/>
         <Parameter name="body"/>
         <Parameter name="cBpartnerId"/>
+        <Parameter name="adTableId"/>
+        <Parameter name="documentId"/>
    </SqlMethod>
    
    <SqlMethod name="insertEmailUser" type="preparedStatement" connection="true" return="rowCount">
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Fri Dec 30 21:49:17 2011 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Mon Jan 02 13:31:03 2012 +0100
@@ -747,7 +747,8 @@
 
         EmailData.insertEmail(conn, this, newEmailId, clientId, organizationId, userId,
             EmailType.OUTGOING.getStringValue(), from, to, cc, bcc, dateOfEmail, subject, body,
-            bPartnerId);
+            bPartnerId, ToolsData.getTableId(this, report.getDocumentType().getTableName()),
+            documentData.documentId);
 
         releaseCommitConnection(conn);
       } catch (final NoConnectionAvailableException exception) {