details:   /erp/devel/pi/rev/fe89aad08526
changeset: 8212:fe89aad08526
user:      Stefan Hühner <stefan.huehner <at> openbravo.com>
date:      Tue Aug 24 16:53:08 2010 +0200
summary:   Fixed 14274: Fix 'db has local changes' after enabling/disabling a 
module
When disabling or enabling a module do not update the 'updated'-column to not
trigger the 'db has local changes' check.
- Split out enable module code into enable helper function similar to disable
- wrap enable/disable code in don't update audit info block to get calling
  sequence: setPreventUpdateInfoChange(true),
  change,flush (in finishEnabling),
  setPreventUpdateInfoChange(false)

diffstat:

 src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java |  38 ++++++++++---
 1 files changed, 28 insertions(+), 10 deletions(-)

diffs (63 lines):

diff -r 28457ff0e027 -r fe89aad08526 
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Tue Aug 
24 15:10:48 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Tue Aug 
24 16:53:08 2010 +0200
@@ -155,10 +155,7 @@
       disable(vars);
       response.sendRedirect(strDireccion + request.getServletPath() + 
"?Command=DEFAULT");
     } else if (vars.commandIn("ENABLE")) {
-      ArrayList<String> notEnabledModules = new ArrayList<String>();
-      
enableDisableModule(OBDal.getInstance().get(org.openbravo.model.ad.module.Module.class,
-          vars.getStringParameter("inpcRecordId")), true, notEnabledModules);
-      finishEnabling(notEnabledModules, vars);
+      enable(vars);
       response.sendRedirect(strDireccion + request.getServletPath() + 
"?Command=DEFAULT");
     } else if (vars.commandIn("SCAN")) {
       printScan(response, vars);
@@ -1781,6 +1778,21 @@
   }
 
   /**
+   * Enable the passed in module
+   */
+  private void enable(VariablesSecureApp vars) throws ServletException {
+    try {
+      OBInterceptor.setPreventUpdateInfoChange(true);
+      ArrayList<String> notEnabledModules = new ArrayList<String>();
+      
enableDisableModule(OBDal.getInstance().get(org.openbravo.model.ad.module.Module.class,
+          vars.getStringParameter("inpcRecordId")), true, notEnabledModules);
+      finishEnabling(notEnabledModules, vars);
+    } finally {
+      OBInterceptor.setPreventUpdateInfoChange(false);
+    }
+  }
+
+  /**
    * Disables all the selected modules
    */
   private void disable(VariablesSecureApp vars) throws ServletException {
@@ -1797,13 +1809,19 @@
     String[] moduleIds = modules.replace("(", "").replace(")", "").replace(" 
", "")
         .replace("'", "").split(",");
     ArrayList<String> notEnabledModules = new ArrayList<String>();
-    for (String moduleId : moduleIds) {
-      org.openbravo.model.ad.module.Module module = OBDal.getInstance().get(
-          org.openbravo.model.ad.module.Module.class, moduleId);
-      enableDisableModule(module, false, notEnabledModules);
+    try {
+      OBInterceptor.setPreventUpdateInfoChange(true);
+
+      for (String moduleId : moduleIds) {
+        org.openbravo.model.ad.module.Module module = OBDal.getInstance().get(
+            org.openbravo.model.ad.module.Module.class, moduleId);
+        enableDisableModule(module, false, notEnabledModules);
+      }
+
+      finishEnabling(notEnabledModules, vars);
+    } finally {
+      OBInterceptor.setPreventUpdateInfoChange(false);
     }
-
-    finishEnabling(notEnabledModules, vars);
   }
 
   /**

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to