details:   /erp/devel/pi/rev/75738e794fde
changeset: 8762:75738e794fde
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Oct 27 14:44:39 2010 +0200
summary:   Fixed issue 15048.Purpose is set on System Info if it is null and it 
is an active instance.

diffstat:

 src/org/openbravo/erpCommon/ad_process/HeartbeatProcess.java |  21 ++++++++++-
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 5284d19837e1 -r 75738e794fde 
src/org/openbravo/erpCommon/ad_process/HeartbeatProcess.java
--- a/src/org/openbravo/erpCommon/ad_process/HeartbeatProcess.java      Wed Oct 
27 17:47:51 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_process/HeartbeatProcess.java      Wed Oct 
27 14:44:39 2010 +0200
@@ -24,6 +24,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.GeneralSecurityException;
+import java.sql.SQLException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -52,6 +53,7 @@
 import org.openbravo.database.ConnectionProvider;
 import org.openbravo.erpCommon.businessUtility.HeartbeatData;
 import org.openbravo.erpCommon.businessUtility.RegistrationData;
+import org.openbravo.erpCommon.obps.ActivationKey;
 import org.openbravo.erpCommon.utility.Alert;
 import org.openbravo.erpCommon.utility.HttpsUtils;
 import org.openbravo.erpCommon.utility.SystemInfo;
@@ -633,8 +635,23 @@
   public static boolean isShowInstancePurposeRequired() {
     final SystemInformation systemInformation = 
OBDal.getInstance().get(SystemInformation.class,
         "0");
-    return (systemInformation.getInstancePurpose() == null || systemInformation
-        .getInstancePurpose().isEmpty());
+    if (systemInformation.getInstancePurpose() == null
+        || systemInformation.getInstancePurpose().isEmpty()) {
+      if (ActivationKey.isActiveInstance()) {
+        
systemInformation.setInstancePurpose(ActivationKey.getInstance().getProperty("purpose"));
+        OBDal.getInstance().save(systemInformation);
+        OBDal.getInstance().flush();
+        try {
+          OBDal.getInstance().getConnection().commit();
+        } catch (SQLException e) {
+          // ignore exception on commit
+          log.error("Error on commit", e);
+        }
+        return false;
+      }
+      return true;
+    }
+    return false;
   }
 
   public static boolean isClonedInstance() throws ServletException {

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to