details: /erp/devel/pi/rev/8eb3b7375175
changeset: 8210:8eb3b7375175
user: Stefan Hühner <stefan.huehner <at> openbravo.com>
date: Tue Aug 24 15:08:05 2010 +0200
summary: Issue 14276: small improvements
- enhance javadoc, mention only works in admin mode
- change parameter from Boolean -> boolean (&update all callers)
details: /erp/devel/pi/rev/28457ff0e027
changeset: 8211:28457ff0e027
user: Stefan Hühner <stefan.huehner <at> openbravo.com>
date: Tue Aug 24 15:10:48 2010 +0200
summary: Fixed 14262: Do not update audit info, to not trigger the 'local
changes' check
For changing maturity level (per module) skip audit info as its a local config
change which should not trigger the 'db has local changes' check
diffstat:
src-test/org/openbravo/test/dal/IssuesTest.java | 2 +-
src/org/openbravo/dal/core/DalRequestFilter.java | 2 +-
src/org/openbravo/dal/core/OBInterceptor.java | 6 ++--
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java | 18 ++++++++++---
4 files changed, 18 insertions(+), 10 deletions(-)
diffs (79 lines):
diff -r dec4c41f6f8e -r 28457ff0e027
src-test/org/openbravo/test/dal/IssuesTest.java
--- a/src-test/org/openbravo/test/dal/IssuesTest.java Tue Aug 24 14:02:32
2010 +0200
+++ b/src-test/org/openbravo/test/dal/IssuesTest.java Tue Aug 24 15:10:48
2010 +0200
@@ -512,7 +512,7 @@
assertFalse(oldName.equals(table.getName()));
assertTrue(table.getUpdated().getTime() == oldUpdated.getTime());
} finally {
- OBInterceptor.setPreventUpdateInfoChange(null);
+ OBInterceptor.setPreventUpdateInfoChange(false);
}
// now do the same with preventupdate disabled
diff -r dec4c41f6f8e -r 28457ff0e027
src/org/openbravo/dal/core/DalRequestFilter.java
--- a/src/org/openbravo/dal/core/DalRequestFilter.java Tue Aug 24 14:02:32
2010 +0200
+++ b/src/org/openbravo/dal/core/DalRequestFilter.java Tue Aug 24 15:10:48
2010 +0200
@@ -94,7 +94,7 @@
OBContext.clearAdminModeStack();
- OBInterceptor.setPreventUpdateInfoChange(null);
+ OBInterceptor.setPreventUpdateInfoChange(false);
super.doFinal(errorOccured);
}
diff -r dec4c41f6f8e -r 28457ff0e027
src/org/openbravo/dal/core/OBInterceptor.java
--- a/src/org/openbravo/dal/core/OBInterceptor.java Tue Aug 24 14:02:32
2010 +0200
+++ b/src/org/openbravo/dal/core/OBInterceptor.java Tue Aug 24 15:10:48
2010 +0200
@@ -62,12 +62,12 @@
private static ThreadLocal<Boolean> preventUpdateInfoChange = new
ThreadLocal<Boolean>();
/**
- * If true is passed then the update info (updated/updatedBy) is not updated
when an object gets
- * updated.
+ * If true is passed and we are in adminMode then the update info
(updated/updatedBy) is not
+ * updated when an object gets updated.
*
* @param value
*/
- public static void setPreventUpdateInfoChange(Boolean value) {
+ public static void setPreventUpdateInfoChange(boolean value) {
preventUpdateInfoChange.set(value);
}
diff -r dec4c41f6f8e -r 28457ff0e027
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java Tue Aug
24 14:02:32 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java Tue Aug
24 15:10:48 2010 +0200
@@ -39,6 +39,7 @@
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.core.OBInterceptor;
import org.openbravo.dal.service.OBCriteria;
import org.openbravo.dal.service.OBDal;
import org.openbravo.data.FieldProvider;
@@ -1485,12 +1486,19 @@
org.openbravo.model.ad.module.Module mod = OBDal.getInstance().get(
org.openbravo.model.ad.module.Module.class, moduleId);
if (mod != null) {
- if (vars.commandIn("SETTINGS_ADD")) {
- mod.setMaturityUpdate(vars.getStringParameter("inpModuleLevel"));
- } else {
- mod.setMaturityUpdate(null);
+ // do not update the audit info here, as its a local config change,
which should not be
+ // treated as 'local changes' by i.e. update.database
+ try {
+ OBInterceptor.setPreventUpdateInfoChange(true);
+ if (vars.commandIn("SETTINGS_ADD")) {
+ mod.setMaturityUpdate(vars.getStringParameter("inpModuleLevel"));
+ } else {
+ mod.setMaturityUpdate(null);
+ }
+ OBDal.getInstance().flush();
+ } finally {
+ OBInterceptor.setPreventUpdateInfoChange(false);
}
- OBDal.getInstance().flush();
} else {
log4j.error("Module does not exists ID:" + moduleId);
}
------------------------------------------------------------------------------
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