details: https://code.openbravo.com/erp/devel/pi/rev/f37f05074060 changeset: 27852:f37f05074060 user: Martin Taal <martin.taal <at> openbravo.com> date: Tue Nov 10 09:05:49 2015 +0100 summary: Related to issue 31410: Import entry process can have a stopped but not deregistered thread: tickets remain in the queue Added logging statements, add wait in ImportEntryManager loop, also make sure that the wait time computation does not round, add a catch block in ImportEntryProcessorRunnable, moved the inner loop to a separate method for readability
details: https://code.openbravo.com/erp/devel/pi/rev/cb4dec610d4b changeset: 27853:cb4dec610d4b user: Martin Taal <martin.taal <at> openbravo.com> date: Wed Nov 11 12:22:58 2015 +0100 summary: Merged heads diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java | 22 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js | 6 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js | 5 + src/org/openbravo/base/secureApp/HttpSecureAppServlet.java | 84 +--- src/org/openbravo/base/secureApp/LoginUtils.java | 134 +++++ src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html | 51 +- src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java | 128 +++- src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml | 3 +- src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql | 5 +- src/org/openbravo/erpCommon/security/Login.html | 2 +- src/org/openbravo/erpCommon/security/Login_F1.html | 2 +- src/org/openbravo/erpCommon/utility/PopupLoading.html | 4 +- src/org/openbravo/service/importprocess/ImportEntryManager.java | 9 +- src/org/openbravo/service/importprocess/ImportEntryProcessor.java | 240 +++++---- web/js/utils.js | 8 +- 15 files changed, 458 insertions(+), 245 deletions(-) diffs (truncated from 1192 to 300 lines): diff -r 710400f71264 -r cb4dec610d4b modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java Mon Nov 09 12:58:54 2015 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java Wed Nov 11 12:22:58 2015 +0100 @@ -23,6 +23,7 @@ import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; +import org.hibernate.Hibernate; import org.openbravo.base.structure.BaseOBObject; import org.openbravo.client.application.GCField; import org.openbravo.client.application.GCSystem; @@ -44,11 +45,24 @@ * @author mtaal */ public class OBViewUtil { + public static final Element createdElement; + public static final Element createdByElement; + public static final Element updatedElement; + public static final Element updatedByElement; - public static final Element createdElement = OBDal.getInstance().get(Element.class, "245"); - public static final Element createdByElement = OBDal.getInstance().get(Element.class, "246"); - public static final Element updatedElement = OBDal.getInstance().get(Element.class, "607"); - public static final Element updatedByElement = OBDal.getInstance().get(Element.class, "608"); + static { + createdElement = OBDal.getInstance().get(Element.class, "245"); + createdByElement = OBDal.getInstance().get(Element.class, "246"); + updatedElement = OBDal.getInstance().get(Element.class, "607"); + updatedByElement = OBDal.getInstance().get(Element.class, "608"); + + // force loading translations for these fields as they might be used for labels + Hibernate.initialize(createdElement.getADElementTrlList()); + Hibernate.initialize(createdByElement.getADElementTrlList()); + Hibernate.initialize(updatedElement.getADElementTrlList()); + Hibernate.initialize(updatedByElement.getADElementTrlList()); + } + private static Logger log = LoggerFactory.getLogger(OBViewUtil.class); /** diff -r 710400f71264 -r cb4dec610d4b modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js Mon Nov 09 12:58:54 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js Wed Nov 11 12:22:58 2015 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2013 Openbravo SLU + * All portions are Copyright (C) 2010-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -446,8 +446,8 @@ if (!cPopup.areParamsSet) { if (!postParams) { cPopup.getIframeHtmlObj().contentWindow.frames[0].location.href = cPopup.popupURL; - if (OB.Utilities.isIE9Strict) { - // In IE9 Strict, when the location.href or .src is defined, the previous defined opener is lost, and it should be defined again + if (OB.Utilities.isIE9Strict || OB.Utilities.isEdge) { + // In IE9 Strict and Edge, when the location.href or .src is defined, the previous defined opener is lost, and it should be defined again cPopup.getIframeHtmlObj().contentWindow.frames[0].opener = cPopup.theOpener; var setOpenerInterval; setOpenerInterval = setInterval( diff -r 710400f71264 -r cb4dec610d4b modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Mon Nov 09 12:58:54 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Wed Nov 11 12:22:58 2015 +0100 @@ -27,6 +27,11 @@ OB.Utilities.isIE9Strict = true; } +OB.Utilities.isEdge = false; +if (navigator.userAgent.toUpperCase().indexOf("EDGE") !== -1) { + OB.Utilities.isEdge = true; +} + //** {{{OB.Utilities.checkProfessionalLicense}}} ** // Checks if the current instance is using a professional license // (!= community). If the instance has a community instance then diff -r 710400f71264 -r cb4dec610d4b src/org/openbravo/base/secureApp/HttpSecureAppServlet.java --- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java Mon Nov 09 12:58:54 2015 +0100 +++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java Wed Nov 11 12:22:58 2015 +0100 @@ -31,10 +31,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import net.sf.jasperreports.engine.JRDataSource; import org.codehaus.jettison.json.JSONObject; import org.hibernate.criterion.Restrictions; @@ -56,7 +52,6 @@ import org.openbravo.erpCommon.obps.ActivationKey; import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction; import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction; -import org.openbravo.erpCommon.security.SessionLogin; import org.openbravo.erpCommon.security.UsageAudit; import org.openbravo.erpCommon.utility.JRFieldProviderDataSource; import org.openbravo.erpCommon.utility.JRScrollableFieldProviderDataSource; @@ -74,10 +69,8 @@ import org.openbravo.utils.FileUtility; import org.openbravo.utils.Replace; import org.openbravo.xmlEngine.XmlDocument; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; + +import net.sf.jasperreports.engine.JRDataSource; public class HttpSecureAppServlet extends HttpBaseServlet { private static final long serialVersionUID = 1L; @@ -299,7 +292,7 @@ strRole, strClient, strOrg, strWarehouse)) { readProperties(vars); readNumberFormat(vars, globalParameters.getFormatPath()); - saveLoginBD(request, vars, "0", "0"); + LoginUtils.saveLoginBD(request, vars, "0", "0"); } else { // Re-login log4j.error("Unable to fill session Arguments for: " + strUserAuth); @@ -1109,76 +1102,7 @@ } protected void readNumberFormat(VariablesSecureApp vars, String strFormatFile) { - String strNumberFormat = "###,##0.00"; // Default number format - String strGroupingSeparator = ","; // Default grouping separator - String strDecimalSeparator = "."; // Default decimal separator - final String formatNameforJrxml = "euroInform"; // Name of the format to use - final HashMap<String, String> formatMap = new HashMap<String, String>(); - - try { - // Reading number format configuration - final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); - final DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - final Document doc = docBuilder.parse(new File(strFormatFile)); - doc.getDocumentElement().normalize(); - final NodeList listOfNumbers = doc.getElementsByTagName("Number"); - final int totalNumbers = listOfNumbers.getLength(); - for (int s = 0; s < totalNumbers; s++) { - final Node NumberNode = listOfNumbers.item(s); - if (NumberNode.getNodeType() == Node.ELEMENT_NODE) { - final Element NumberElement = (Element) NumberNode; - final String strNumberName = NumberElement.getAttributes().getNamedItem("name") - .getNodeValue(); - // store in session all the formats - final String strFormatOutput = NumberElement.getAttributes().getNamedItem("formatOutput") - .getNodeValue(); - formatMap.put(strNumberName, strFormatOutput); - vars.setSessionValue("#FormatOutput|" + strNumberName, strFormatOutput); - vars.setSessionValue("#DecimalSeparator|" + strNumberName, NumberElement.getAttributes() - .getNamedItem("decimal").getNodeValue()); - vars.setSessionValue("#GroupSeparator|" + strNumberName, NumberElement.getAttributes() - .getNamedItem("grouping").getNodeValue()); - // set the numberFormat to be used in the renderJR function - if (strNumberName.equals(formatNameforJrxml)) { - strDecimalSeparator = NumberElement.getAttributes().getNamedItem("decimal") - .getNodeValue(); - strGroupingSeparator = NumberElement.getAttributes().getNamedItem("grouping") - .getNodeValue(); - strNumberFormat = strFormatOutput; - } - } - } - } catch (final Exception e) { - log4j.error("error reading number format", e); - } - vars.setSessionObject("#FormatMap", formatMap); - vars.setSessionValue("#AD_ReportNumberFormat", strNumberFormat); - vars.setSessionValue("#AD_ReportGroupingSeparator", strGroupingSeparator); - vars.setSessionValue("#AD_ReportDecimalSeparator", strDecimalSeparator); - } - - private void saveLoginBD(HttpServletRequest request, VariablesSecureApp vars, String strCliente, - String strOrganizacion) throws ServletException { - - if ("Y".equals(request.getSession().getAttribute("forceLogin"))) { - // don't create a DB session for bypass authentication resources - log4j.debug("Bypass session " + request.getRequestURI()); - return; - } - - final SessionLogin sl = new SessionLogin(request, strCliente, strOrganizacion, - vars.getSessionValue("#AD_User_ID")); - - // session_ID should have been created in LoginHandler - String sessionId = vars.getDBSession(); - sl.setServerUrl(strDireccion); - sl.setSessionID(sessionId); - - if (sessionId == null || sessionId.equals("")) { - sl.setStatus("S"); - sl.save(); - vars.setSessionValue("#AD_Session_ID", sl.getSessionID()); - } + LoginUtils.readNumberFormat(vars, strFormatFile); } protected void renderJR(VariablesSecureApp variables, HttpServletResponse response, diff -r 710400f71264 -r cb4dec610d4b src/org/openbravo/base/secureApp/LoginUtils.java --- a/src/org/openbravo/base/secureApp/LoginUtils.java Mon Nov 09 12:58:54 2015 +0100 +++ b/src/org/openbravo/base/secureApp/LoginUtils.java Wed Nov 11 12:22:58 2015 +0100 @@ -11,12 +11,18 @@ */ package org.openbravo.base.secureApp; +import java.io.File; +import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import org.apache.log4j.Logger; +import org.openbravo.base.HttpBaseUtils; import org.openbravo.base.exception.OBException; import org.openbravo.base.exception.OBSecurityException; import org.openbravo.dal.core.OBContext; @@ -24,6 +30,7 @@ import org.openbravo.dal.service.OBQuery; import org.openbravo.database.ConnectionProvider; import org.openbravo.erpCommon.businessUtility.Preferences; +import org.openbravo.erpCommon.security.SessionLogin; import org.openbravo.erpCommon.utility.DimensionDisplayUtility; import org.openbravo.erpCommon.utility.Utility; import org.openbravo.model.ad.access.RoleOrganization; @@ -31,6 +38,10 @@ import org.openbravo.model.ad.system.Client; import org.openbravo.service.db.DalConnectionProvider; import org.openbravo.utils.FormatUtilities; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; public class LoginUtils { @@ -433,4 +444,127 @@ public String org; public String warehouse; } + + /** + * Reads the number format from the format file and sets it in VariablesSecureApp + * + */ + public static void readNumberFormat(VariablesSecureApp vars, String strFormatFile) { + String strNumberFormat = "###,##0.00"; // Default number format + String strGroupingSeparator = ","; // Default grouping separator + String strDecimalSeparator = "."; // Default decimal separator + final String formatNameforJrxml = "euroInform"; // Name of the format to use + final HashMap<String, String> formatMap = new HashMap<String, String>(); + + try { + // Reading number format configuration + final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); + final DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + final Document doc = docBuilder.parse(new File(strFormatFile)); + doc.getDocumentElement().normalize(); + final NodeList listOfNumbers = doc.getElementsByTagName("Number"); + final int totalNumbers = listOfNumbers.getLength(); + for (int s = 0; s < totalNumbers; s++) { + final Node NumberNode = listOfNumbers.item(s); + if (NumberNode.getNodeType() == Node.ELEMENT_NODE) { + final Element NumberElement = (Element) NumberNode; + final String strNumberName = NumberElement.getAttributes().getNamedItem("name") + .getNodeValue(); + // store in session all the formats + final String strFormatOutput = NumberElement.getAttributes().getNamedItem("formatOutput") + .getNodeValue(); + formatMap.put(strNumberName, strFormatOutput); + vars.setSessionValue("#FormatOutput|" + strNumberName, strFormatOutput); + vars.setSessionValue("#DecimalSeparator|" + strNumberName, NumberElement.getAttributes() + .getNamedItem("decimal").getNodeValue()); + vars.setSessionValue("#GroupSeparator|" + strNumberName, NumberElement.getAttributes() + .getNamedItem("grouping").getNodeValue()); + // set the numberFormat to be used in the renderJR function + if (strNumberName.equals(formatNameforJrxml)) { + strDecimalSeparator = NumberElement.getAttributes().getNamedItem("decimal") + .getNodeValue(); + strGroupingSeparator = NumberElement.getAttributes().getNamedItem("grouping") + .getNodeValue(); + strNumberFormat = strFormatOutput; + } + } + } + } catch (final Exception e) { + log4j.error("error reading number format", e); + } + vars.setSessionObject("#FormatMap", formatMap); + vars.setSessionValue("#AD_ReportNumberFormat", strNumberFormat); + vars.setSessionValue("#AD_ReportGroupingSeparator", strGroupingSeparator); + vars.setSessionValue("#AD_ReportDecimalSeparator", strDecimalSeparator); + } + + /** ------------------------------------------------------------------------------ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits
