details:   https://code.openbravo.com/erp/devel/pi/rev/7c00470a19e9
changeset: 33431:7c00470a19e9
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Feb 14 10:15:36 2018 +0100
summary:   Related with issue 37681: Dont call to setAuditActive(false) in 
SL_TableAudit

The SL_TableAudit callout is invoked when changing the value of the Is Fully 
Audited flag in ad_table. When the user set this flag to false to the only 
table that was
being audited, the callout was invoking SessionInfo.setAuditActive(false); to 
notify that there were no more tables being audited.

But this can lead to problems. Suppose:
- There is one table audited, the audit trail triggers are installed
- All connections have created the ad_context_info table because of this
- The user sets to false the Is Fully Audited flag of the audited table and 
invokes SessionInfo.setAuditActive(false);
- From then on new connections will not create the ad_context_info table. But 
the triggers are still installed in the table, because the audit trail 
infrastructure is not
updated until the system is rebuilt and restarted. If there is a change in data 
of that table and the connection in charge of doing it has not created the 
ad_context_info,
the change will not be commited because the triggers will fail.

details:   https://code.openbravo.com/erp/devel/pi/rev/19cd3ba5708f
changeset: 33432:19cd3ba5708f
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Feb 14 10:21:20 2018 +0100
summary:   Related with issue 37681: Fixes typo in message, adds comment

details:   https://code.openbravo.com/erp/devel/pi/rev/d0a6cc5b94d5
changeset: 33433:d0a6cc5b94d5
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Feb 14 10:37:25 2018 +0100
summary:   Fixes issue 37681: Message is shown when enabling and disabling 
audit trail

diffstat:

 
modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
 |   5 +-
 src-db/database/sourcedata/AD_MESSAGE.xml                                      
                                                 |   2 +-
 src/org/openbravo/erpCommon/ad_callouts/SL_TableAudit.java                     
                                                 |  23 +--------
 3 files changed, 8 insertions(+), 22 deletions(-)

diffs (83 lines):

diff -r e9356b180aac -r d0a6cc5b94d5 
modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
--- 
a/modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
   Mon Feb 12 19:29:47 2018 +0100
+++ 
b/modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
   Wed Feb 14 10:37:25 2018 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014-2017 Openbravo SLU
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -80,6 +80,9 @@
         if (isReadOnlyPool(parent)) {
           initialized = true;
         } else {
+          // SessionInfo will be initialized when the SessionListener 
ServletContextListener is
+          // invoked. That listener will check if there are audited tables and 
notify SessionInfo,
+          // from them on SessionInfo will know whether the ad_context_info 
table should be created
           if (SessionInfo.isInitialized()) {
             SessionInfo.initDB(con.getConnection(), rbdms);
             initialized = true;
diff -r e9356b180aac -r d0a6cc5b94d5 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Mon Feb 12 19:29:47 2018 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Feb 14 10:37:25 2018 +0100
@@ -23186,7 +23186,7 @@
 <!--926CA161FD5F49E5A993BED838A423D6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--926CA161FD5F49E5A993BED838A423D6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--926CA161FD5F49E5A993BED838A423D6-->  
<VALUE><![CDATA[RegenerateAudit_ExcludeColumn]]></VALUE>
-<!--926CA161FD5F49E5A993BED838A423D6-->  <MSGTEXT><![CDATA[In order to 
activate this change it is necessary to build Openbravo and to restart 
Tomcat..Use "Exclude Audit" in column to exclude some columns from 
Audit.]]></MSGTEXT>
+<!--926CA161FD5F49E5A993BED838A423D6-->  <MSGTEXT><![CDATA[In order to 
activate this change it is necessary to build Openbravo and to restart Tomcat. 
Use "Exclude Audit" in column to exclude some columns from Audit.]]></MSGTEXT>
 <!--926CA161FD5F49E5A993BED838A423D6-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--926CA161FD5F49E5A993BED838A423D6-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--926CA161FD5F49E5A993BED838A423D6-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
diff -r e9356b180aac -r d0a6cc5b94d5 
src/org/openbravo/erpCommon/ad_callouts/SL_TableAudit.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_TableAudit.java        Mon Feb 
12 19:29:47 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_TableAudit.java        Wed Feb 
14 10:37:25 2018 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2010-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,7 +25,6 @@
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.database.SessionInfo;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.datamodel.Table;
 
@@ -51,26 +50,10 @@
         info.showMessage(Utility.messageBD(this, 
"RegenerateAudit_ExcludeColumn",
             info.vars.getLanguage()));
       } else {
-        OBCriteria<Table> obc = 
OBDal.getInstance().createCriteria(Table.class);
-        obc.add(Restrictions.eq(Table.PROPERTY_ISFULLYAUDITED, true));
-        boolean anyTableIsAudited = !obc.list().isEmpty();
-        if (!anyTableIsAudited) {
-          SessionInfo.setAuditActive(false);
-        }
+        info.showMessage(Utility.messageBD(this, "RegenerateAudit", 
info.vars.getLanguage()));
       }
     } else if (StringUtils.equalsIgnoreCase(strChanged, "inpisexcludeaudit")) {
-      String strIsExcludedAudit = info.getStringParameter("inpisexcludeaudit");
-      boolean currentRecordExcludeAudit = 
StringUtils.equals(strIsExcludedAudit, "Y");
-      if (currentRecordExcludeAudit) {
-        info.showMessage(Utility.messageBD(this, "RegenerateAudit", 
info.vars.getLanguage()));
-      } else {
-        OBCriteria<Table> obc = 
OBDal.getInstance().createCriteria(Table.class);
-        obc.add(Restrictions.eq(Table.PROPERTY_ISFULLYAUDITED, true));
-        boolean anyTableIsAudited = !obc.list().isEmpty();
-        if (!anyTableIsAudited) {
-          SessionInfo.setAuditActive(false);
-        }
-      }
+      info.showMessage(Utility.messageBD(this, "RegenerateAudit", 
info.vars.getLanguage()));
     }
   }
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to