details:   https://code.openbravo.com/erp/devel/pi/rev/661e839cd9ab
changeset: 16676:661e839cd9ab
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon May 28 16:57:22 2012 +0200
summary:   fixed bug 20625: Reload license as admin

diffstat:

 src/org/openbravo/erpCommon/obps/ActivationKey.java |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (29 lines):

diff -r d89c76a4681d -r 661e839cd9ab 
src/org/openbravo/erpCommon/obps/ActivationKey.java
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java       Mon May 28 
16:51:46 2012 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java       Mon May 28 
16:57:22 2012 +0200
@@ -267,13 +267,18 @@
    * Reloads ActivationKey instance from information in DB.
    */
   public static synchronized ActivationKey reload() {
-    ActivationKey ak = getInstance();
-    org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
-        org.openbravo.model.ad.system.System.class, "0");
-    ak.loadInfo(sys.getActivationKey());
-    ak.loadRestrictions();
-    ak.lastUpdateTimestamp = sys.getUpdated();
-    return ak;
+    OBContext.setAdminMode();
+    try {
+      ActivationKey ak = getInstance();
+      org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
+          org.openbravo.model.ad.system.System.class, "0");
+      ak.loadInfo(sys.getActivationKey());
+      ak.loadRestrictions();
+      ak.lastUpdateTimestamp = sys.getUpdated();
+      return ak;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
   }
 
   /**

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to