details:   https://code.openbravo.com/erp/devel/pi/rev/48255571a970
changeset: 17699:48255571a970
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Thu Aug 16 17:03:20 2012 +0530
summary:   Fixes Issue 21215 : Setting End time for incomplete Process Instance 
on System Restart

Setting the end time as current time for incomplete process instances and 
setting the status as 'System Restart'

details:   https://code.openbravo.com/erp/devel/pi/rev/8f50e2b6343a
changeset: 17700:8f50e2b6343a
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Aug 16 18:11:54 2012 +0200
summary:   Fixes issue 21169: URLs work on login page

If the URL defined in the System Info window did not start with http://, the 
link will use it as a relative path. Now, if the URL does not begin with http 
(to support http and https protocols), the suffix 'http://' will be added.

diffstat:

 src-db/database/sourcedata/AD_REF_LIST.xml                 |  12 +++++
 src/org/openbravo/base/OBSchedulerInitializerListener.java |  31 +++++++++++++-
 src/org/openbravo/erpCommon/security/Login.java            |   7 +++
 3 files changed, 49 insertions(+), 1 deletions(-)

diffs (103 lines):

diff -r 0e82e9b7585a -r 8f50e2b6343a src-db/database/sourcedata/AD_REF_LIST.xml
--- a/src-db/database/sourcedata/AD_REF_LIST.xml        Thu Aug 16 17:58:49 
2012 +0530
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml        Thu Aug 16 18:11:54 
2012 +0200
@@ -9902,6 +9902,18 @@
 <!--AA7D726DDDEE4C51944D5FB0B17521FD-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--AA7D726DDDEE4C51944D5FB0B17521FD--></AD_REF_LIST>
 
+<!--ABA3318229E648A18D3A1F7C03B61A5D--><AD_REF_LIST>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  
<AD_REF_LIST_ID><![CDATA[ABA3318229E648A18D3A1F7C03B61A5D]]></AD_REF_LIST_ID>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  <VALUE><![CDATA[SYR]]></VALUE>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  <NAME><![CDATA[System 
Restart]]></NAME>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  <DESCRIPTION><![CDATA[A Process that 
was failed due to System Restart]]></DESCRIPTION>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  
<AD_REFERENCE_ID><![CDATA[7DB6D4792CDC4ED297C70A4F4282A52E]]></AD_REFERENCE_ID>
+<!--ABA3318229E648A18D3A1F7C03B61A5D-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ABA3318229E648A18D3A1F7C03B61A5D--></AD_REF_LIST>
+
 <!--ABA6CABC9E7F4D81B1652C1D9C619D26--><AD_REF_LIST>
 <!--ABA6CABC9E7F4D81B1652C1D9C619D26-->  
<AD_REF_LIST_ID><![CDATA[ABA6CABC9E7F4D81B1652C1D9C619D26]]></AD_REF_LIST_ID>
 <!--ABA6CABC9E7F4D81B1652C1D9C619D26-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 0e82e9b7585a -r 8f50e2b6343a 
src/org/openbravo/base/OBSchedulerInitializerListener.java
--- a/src/org/openbravo/base/OBSchedulerInitializerListener.java        Thu Aug 
16 17:58:49 2012 +0530
+++ b/src/org/openbravo/base/OBSchedulerInitializerListener.java        Thu Aug 
16 18:11:54 2012 +0200
@@ -10,11 +10,16 @@
 import static 
org.openbravo.base.ConnectionProviderContextListener.POOL_ATTRIBUTE;
 import static 
org.quartz.ee.servlet.QuartzInitializerListener.QUARTZ_FACTORY_KEY;
 
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
 import org.apache.log4j.Logger;
+import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.scheduling.OBScheduler;
 import org.quartz.Scheduler;
 import org.quartz.impl.StdSchedulerFactory;
@@ -109,10 +114,34 @@
       log.info("Storing ConfigParameters and ConnectionProvider in " + 
"Scheduler Context.");
       scheduler.getContext().put(POOL_ATTRIBUTE, 
servletContext.getAttribute(POOL_ATTRIBUTE));
       scheduler.getContext().put(CONFIG_ATTRIBUTE, 
servletContext.getAttribute(CONFIG_ATTRIBUTE));
-
       log.info("Initalizing singleton instance of " + 
OBScheduler.class.getName());
       OBScheduler.getInstance().initialize(scheduler);
 
+      // Update Interrupted Process Instance's End time with current time.
+      try {
+        String dburl = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
+            .getProperty("bbdd.url");
+        String database = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
+            .getProperty("bbdd.sid");
+        String systemUser = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
+            .getProperty("bbdd.systemUser");
+        String systemPassword = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
+            .getProperty("bbdd.systemPassword");
+        Class.forName("org.postgresql.Driver");
+        Connection connection = DriverManager.getConnection(dburl + "/" + 
database, systemUser,
+            systemPassword);
+        if (connection != null) {
+          Statement s = connection.createStatement();
+          String query = "UPDATE AD_PROCESS_RUN SET 
END_TIME=NOW(),STATUS='SYR' WHERE END_TIME IS NULL";
+          int executeUpdate = s.executeUpdate(query);
+          log.info("Number of rows updated" + executeUpdate);
+        } else {
+          System.out.println("Connection Failed!");
+        }
+
+      } catch (Exception e) {
+        log.error("Error updating Process Instance " + e.toString(), e);
+      }
     } catch (final Exception e) {
       log.error("Quartz Scheduler failed to initialize: " + e.toString(), e);
     }
diff -r 0e82e9b7585a -r 8f50e2b6343a 
src/org/openbravo/erpCommon/security/Login.java
--- a/src/org/openbravo/erpCommon/security/Login.java   Thu Aug 16 17:58:49 
2012 +0530
+++ b/src/org/openbravo/erpCommon/security/Login.java   Thu Aug 16 18:11:54 
2012 +0200
@@ -25,6 +25,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.StringUtils;
 import org.hibernate.Query;
 import org.openbravo.base.HttpBaseServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
@@ -265,7 +266,13 @@
       showForgeLogo = !ActivationKey.getInstance().isActive()
           || (ActivationKey.getInstance().isActive() && 
sysInfo.isShowForgeLogoInLogin());
       itLink = sysInfo.getSupportContact() == null ? "" : 
sysInfo.getSupportContact();
+      if (!itLink.isEmpty() && !StringUtils.startsWithIgnoreCase(itLink, 
"http")) {
+        itLink = "http://"; + itLink;
+      }
       companyLink = sysInfo.getYourCompanyURL() == null ? "" : 
sysInfo.getYourCompanyURL();
+      if (!companyLink.isEmpty() && 
!StringUtils.startsWithIgnoreCase(companyLink, "http")) {
+        companyLink = "http://"; + companyLink;
+      }
     }
 
     XmlDocument xmlDocument = 
xmlEngine.readXmlTemplate("org/openbravo/erpCommon/security/Login")

------------------------------------------------------------------------------
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
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to