Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0019344Openbravo ERPA. Platformpublic2011-12-22 13:152012-01-12 10:26
azabaleta 
dbaz 
normalminoralways
closedfixed 
5
3.0MP6 
 
No
Core
No
0019344: Add 2 columns to the email sent audit
Hi, now, when openbravo sends an email from a document via PrintController, at the end, it makes a insert in an audit table called c_poc_email . I suggest you add 2 more columns to that table so the admin can track which table sent the email and which is the document id that was sent. I attach diff for the 2 sources that need to be modified and here I add the 2 colums needed in the database.

ALTER TABLE c_poc_email ADD COLUMN tablename character varying(60);

ALTER TABLE c_poc_email ADD COLUMN document_id character varying(32);


Thanks
diff -r f330b414cd5a src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql Tue Nov 30 08:37:26 2010 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql Thu Dec 22 13:11:15 2011 +0100
@@ -78,7 +78,9 @@
                 DATEOFEMAIL,
                 SUBJECT ,
                 BODY ,
- C_BPARTNER_ID
+ C_BPARTNER_ID,
+ TABLENAME,
+ DOCUMENT_ID
             )
             VALUES
             (
@@ -99,6 +101,8 @@
                 TO_DATE(?, 'YYYYMMDDHH24MISS'),
                 ?,
                 ?,
+ ?,
+ ?,
                 ?
             )
       ]]></Sql>
@@ -117,6 +121,8 @@
         <Parameter name="subject"/>
         <Parameter name="body"/>
         <Parameter name="cBpartnerId"/>
+ <Parameter name="tableName"/>
+ <Parameter name="documentId"/>
    </SqlMethod>
    
    <SqlMethod name="insertEmailUser" type="preparedStatement" connection="true" return="rowCount">
diff -r f330b414cd5a src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java Tue Nov 30 08:37:26 2010 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java Thu Dec 22 13:11:15 2011 +0100
@@ -747,7 +747,7 @@
 
         EmailData.insertEmail(conn, this, newEmailId, clientId, organizationId, userId,
             EmailType.OUTGOING.getStringValue(), from, to, cc, bcc, dateOfEmail, subject, body,
- bPartnerId);
+ bPartnerId, report.getDocumentType().getTableName(), documentData.documentId);
 
         releaseCommitConnection(conn);
       } catch (final NoConnectionAvailableException exception) {
No tags attached.
Issue History
2011-12-22 13:15azabaletaNew Issue
2011-12-22 13:15azabaletaAssigned To => alostale
2011-12-22 13:15azabaletaModules => Core
2011-12-27 17:33iperdomoAssigned Toalostale => dbaz
2012-01-02 13:27dbazNote Added: 0044093
2012-01-03 13:31iperdomoNote Added: 0044100
2012-01-03 13:35iperdomoStatusnew => scheduled
2012-01-03 13:35iperdomofix_in_branch => pi
2012-01-03 21:31hgbotCheckin
2012-01-03 21:31hgbotNote Added: 0044104
2012-01-03 21:31hgbotStatusscheduled => resolved
2012-01-03 21:31hgbotResolutionopen => fixed
2012-01-03 21:31hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/da9ac3c4fcbe9932536213a7db25360391adb02b [^]
2012-01-04 11:12iperdomoNote Added: 0044110
2012-01-04 11:12iperdomoStatusresolved => closed
2012-01-12 10:26hudsonbotCheckin
2012-01-12 10:26hudsonbotNote Added: 0044286

Notes
(0044093)
dbaz   
2012-01-02 13:27   
As "Openbravo Admin"
* Configure the email ("General Setup" .> "Client" -> "Client" -> "Email Configuration")
* Go to any window (example: "Sales Invoice")
* Go to any record (example: "FV/1")
* Click the "email" toolbar button
* Fill the needed elements
* Click "Send" button

As "System Administrator"
* Go to "Application Dictionary" -> "Maintenance" -> "SQL Query"
* Execute the following query: "select * from c_poc_email"
Notice that the two new columns "ad_table_id" and "document_id" have proper data for the email you have just send (ignore old existing emails)

You can find more information about email configuration and some test cases here:
http://wiki.openbravo.com/wiki/Projects/Outbound_Email [^]
(0044100)
iperdomo   
2012-01-03 13:31   
* Checked the code changes in pi-email branch
* Using ad_table_id instead of the tablename proposed by the associated patch

* Configured the smtp server at client level for the QA Testing client
* Sent a Sales Invoice through email
* Verified that the c_poc_email has a new record with the log, and ad_table_id was correct, and i could search the record using the document_id
---
* Update all modules, isindevelopment = Y
* Run Synchronize Terminology, from the application
* ant export.database
* Verify that no changes was exported - the branch is 'clean'
(0044104)
hgbot   
2012-01-03 21:31   
Repository: erp/devel/pi
Changeset: da9ac3c4fcbe9932536213a7db25360391adb02b
Author: David Baz Fayos <david.baz <at> openbravo.com>
Date: Mon Jan 02 13:31:03 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/da9ac3c4fcbe9932536213a7db25360391adb02b [^]

[email] Fixed issue 19344: Added more audit capabilities

---
M src-db/database/model/tables/C_POC_EMAIL.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
M src/org/openbravo/erpCommon/utility/reporting/printing/Email_data.xsql
M src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
---
(0044110)
iperdomo   
2012-01-04 11:12   
Tested on pi @ rev f8a00d1435e7
---
* Configured email settings at Client level
* Verified that the table and document_id is property logged
(0044286)
hudsonbot   
2012-01-12 10:26   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/e05372cda9e0 [^]

Maturity status: Test