# HG changeset patch
# User Augusto Mauch <augusto.mauch@openbravo.com>
# Date 1477573026 -7200
#      Thu Oct 27 14:57:06 2016 +0200
# Node ID 9f2340a268a1ee4344185f6f4ee3cfe41457077f
# Parent  309ac3557a9fa7f0bac17fd11fc3f8d8452e4b20
Fixes issue 34323: TriggerHandler only removes the entries created by itself

The TriggerHandler class adds entries to AD_SESSION_STATUS with the isimporting column set to 'Y' to soft-disable the Openbravo triggers. Other processes may want to use the AD_SESSION_STATUS table to disable/reenable other features. The problem is that when TriggerHandler reenables the triggers, it removes all the contents of AD_SESSION_STATUS, not only the records created by the TriggerHandler itself.

To fix this, now TriggerHandler only removes from AD_SESSION_STATUS the rows whose isimporting column is 'Y'.

diff --git a/src/org/openbravo/dal/core/TriggerHandler.java b/src/org/openbravo/dal/core/TriggerHandler.java
--- a/src/org/openbravo/dal/core/TriggerHandler.java
+++ b/src/org/openbravo/dal/core/TriggerHandler.java
@@ -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) 2008-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -104,7 +104,7 @@
     Connection con = OBDal.getInstance().getConnection();
     PreparedStatement ps = null;
     try {
-      ps = con.prepareStatement("DELETE FROM AD_SESSION_STATUS");
+      ps = con.prepareStatement("DELETE FROM AD_SESSION_STATUS WHERE isimporting = 'Y'");
       ps.executeUpdate();
     } catch (Exception e) {
       throw new OBException("Couldn't disable triggers: ", e);
