author | Martin Taal <martin.taal@openbravo.com> |
Wed, 11 Nov 2015 12:22:58 +0100 | |
changeset 27853 | cb4dec610d4b |
parent 27852 | f37f05074060 (current diff) |
parent 27851 | a8ad0086de56 (diff) |
child 27854 | b59a2f4e4a11 |
child 28637 | cbb05eb7f006 |
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java Tue Nov 10 09:05:49 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); /**
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js Tue Nov 10 09:05:49 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(
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Tue Nov 10 09:05:49 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
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java Tue Nov 10 09:05:49 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,
--- a/src/org/openbravo/base/secureApp/LoginUtils.java Tue Nov 10 09:05:49 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); + } + + /** + * It saves session in the DB when logging in + * + */ + public static 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(HttpBaseUtils.getLocalAddress(request)); + sl.setSessionID(sessionId); + + if (sessionId == null || sessionId.equals("")) { + sl.setStatus("S"); + sl.save(); + vars.setSessionValue("#AD_Session_ID", sl.getSessionID()); + } + } + + /** + * Returns default language + * + * @throws ServletException + * + */ + public static String getDefaultLanguage(ConnectionProvider connectionProvider, String aduserid) + throws ServletException { + DefaultOptionsData dataLanguage[] = DefaultOptionsData.defaultLanguage(connectionProvider, + aduserid); + if (dataLanguage != null && dataLanguage.length > 0) { + return dataLanguage[0].getField("DEFAULT_AD_LANGUAGE"); + } + dataLanguage = DefaultOptionsData.getDefaultLanguage(connectionProvider); + if (dataLanguage != null && dataLanguage.length > 0) { + return dataLanguage[0].getField("DEFAULT_AD_LANGUAGE"); + } + return null; + } + + /** + * Returns default value for Rtl + * + * @throws ServletException + * + */ + public static String isDefaultRtl(ConnectionProvider connectionProvider, String aduserid) + throws ServletException { + + DefaultOptionsData dataLanguage[] = DefaultOptionsData.defaultLanguage(connectionProvider, + aduserid); + if (dataLanguage != null && dataLanguage.length > 0) { + return dataLanguage[0].getField("ISRTL"); + } + dataLanguage = DefaultOptionsData.getDefaultLanguage(connectionProvider); + if (dataLanguage != null && dataLanguage.length > 0) { + return dataLanguage[0].getField("ISRTL"); + } + return null; + + } }
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html Wed Nov 11 12:22:58 2015 +0100 @@ -119,6 +119,8 @@ displayLogicElement('advancedFiltersrow3', true); displayLogicElement('advancedFiltersrow4', true); displayLogicElement('advancedFiltersrow5', true); + displayLogicElement('advancedFiltersrow6', true); + displayDocumentNo(); } else{ displayLogicElement('advancedFiltersrow0', false); @@ -127,6 +129,40 @@ displayLogicElement('advancedFiltersrow3', false); displayLogicElement('advancedFiltersrow4', false); displayLogicElement('advancedFiltersrow5', false); + displayLogicElement('advancedFiltersrow6', false); + } +} + +function displayDocumentNo(){ + switch (inpDocument.options[inpDocument.selectedIndex].value) { + case "APC": + case "API": + case "APP": + case "ARC": + case "ARI": + case "ARI_RM": + case "ARR": + case "BSF": + case "CAD": + case "DDB": + case "GLJ": + case "LDC": + case "REC": + case "REM_REM": + displayLogicElement('advancedFiltersrow2', true); + break; + case "AMZ": + case "CMC": + case "FAT": + case "LCC": + case "REM_REMCANCEL": + case "REM_REMRETURN": + displayLogicElement('advancedFiltersrow2', false); + paramDocumentNo.value = ""; + break; + default: + displayLogicElement('advancedFiltersrow2', false); + paramDocumentNo.value = ""; } } @@ -253,6 +289,7 @@ updateMenuIcon('buttonMenu'); setWindowElementFocus('firstElement'); + displayDocumentNo(); displayAdvancedFilters(); selectDocument(); openTabWhenPost(); @@ -550,14 +587,18 @@ </tr> <tr id=advancedFiltersrow1> <td class="TitleCell"><span class="LabelText">Document</span></td> - <td class="Combo_ContentCell" colspan="2"> <select name="inpDocument" id="inpDocument" class="Combo Combo_TwoCells_width"> + <td class="Combo_ContentCell" colspan="2"> <select name="inpDocument" id="inpDocument" class="Combo Combo_TwoCells_width" onchange="displayDocumentNo();"> <option value=""> <div id="reportDocument"></div></option> </select></td> <td class="TitleCell"><span class="LabelText">Initial Page Number</span></td> <td class="TextBox_ContentCell"> <input dojoType="openbravo:Textbox" class="dojoValidateValid TextBox_OneCell_width" type="text" name="inpPageNo" id="paramPageNo" size="10" maxlength="10" value=""></input><script>djConfig.searchIds.push("paramPageNo");</script> </td> </tr> - <tr id=advancedFiltersrow2> + <tr id=advancedFiltersrow2> + <td class="TitleCell"><span class="LabelText">Document No.</span></td> + <td class="TextBox_ContentCell"><input dojoType="openbravo:Textbox" class="dojoValidateValid TextBox_OneCell_width" type="text" name="inpDocumentNo" id="paramDocumentNo" size="10" maxlength="10" value=""></input><script>djConfig.searchIds.push("paramDocumentNo");</script></td> + </tr> + <tr id=advancedFiltersrow3> <td class="TitleCell"><span class="LabelText">Initial Entry Number</span></td> <td class="TextBox_ContentCell"> <input dojoType="openbravo:Textbox" class="dojoValidateValid TextBox_OneCell_width" type="text" name="inpEntryNo" @@ -569,14 +610,14 @@ <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowRegular" name="inpShowRegular" value="Y"/></td> </tr> - <tr id=advancedFiltersrow3> + <tr id=advancedFiltersrow4> <td class="TitleCell"><span class="LabelText">Show P&L Closing Entries</span></td> <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowReg" name="inpShowReg" value="Y"/></td> <td class="ContentCell"></td> <td class="TitleCell"><span class="LabelText">Show Opening Entries</span></td> <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowOpening" name="inpShowOpening" value="Y"/></td> </tr> - <tr id=advancedFiltersrow4> + <tr id=advancedFiltersrow5> <td class="TitleCell"><span class="LabelText">Show Closing Entries</span></td> <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowClosing" name="inpShowClosing" value="Y"/></td> <td class="ContentCell"></td> @@ -584,7 +625,7 @@ <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowDescription" name="inpShowDescription" value="Y"/></td> <td class="ContentCell"></td> </tr> - <tr id=advancedFiltersrow5> + <tr id=advancedFiltersrow6> <td class="TitleCell"><span class="LabelText">Show Divide Up Entries</span></td> <td class="Radio_Check_ContentCell"><input TYPE="checkbox" id="paramShowDivideUp" name="inpShowDivideUp" value="Y"/></td> <td class="ContentCell"></td>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java Wed Nov 11 12:22:58 2015 +0100 @@ -33,9 +33,12 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; +import org.hibernate.Query; import org.openbravo.base.secureApp.HttpSecureAppServlet; import org.openbravo.base.secureApp.VariablesHistory; import org.openbravo.base.secureApp.VariablesSecureApp; @@ -54,6 +57,7 @@ import org.openbravo.erpCommon.utility.OBError; import org.openbravo.erpCommon.utility.ToolBar; import org.openbravo.erpCommon.utility.Utility; +import org.openbravo.model.ad.datamodel.Table; import org.openbravo.model.common.enterprise.DocumentType; import org.openbravo.model.financialmgmt.accounting.coa.AcctSchema; import org.openbravo.model.financialmgmt.accounting.coa.AcctSchemaTable; @@ -93,6 +97,8 @@ ""); String strDocument = vars.getGlobalVariable("inpDocument", "ReportGeneralLedgerJournal|Document", ""); + String strDocumentNo = vars.getGlobalVariable("inpDocumentNo", + "ReportGeneralLedgerJournal|DocumentNo", ""); String strOrg = vars.getGlobalVariable("inpOrg", "ReportGeneralLedgerJournal|Org", "0"); String strShowClosing = vars.getGlobalVariable("inpShowClosing", "ReportGeneralLedgerJournal|ShowClosing", "Y"); @@ -143,10 +149,11 @@ strcelementvaluetodes = (strcelementvaluetodes.equals("null")) ? "" : strcelementvaluetodes; vars.setSessionValue("inpElementValueIdFrom_DES", strcelementvaluefromdes); vars.setSessionValue("inpElementValueIdTo_DES", strcelementvaluetodes); - printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strOrg, strTable, - strRecord, "", strcAcctSchemaId, strShowClosing, strShowReg, strShowOpening, strPageNo, - strEntryNo, strShowDescription, strShowRegular, strShowDivideUp, "", "", - strcelementvaluefrom, strcelementvalueto, strcelementvaluefromdes, strcelementvaluetodes); + printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strDocumentNo, + strOrg, strTable, strRecord, "", strcAcctSchemaId, strShowClosing, strShowReg, + strShowOpening, strPageNo, strEntryNo, strShowDescription, strShowRegular, + strShowDivideUp, "", "", strcelementvaluefrom, strcelementvalueto, + strcelementvaluefromdes, strcelementvaluetodes); } else if (vars.commandIn("DIRECT")) { String strTable = vars.getGlobalVariable("inpTable", "ReportGeneralLedgerJournal|Table"); String strRecord = vars.getGlobalVariable("inpRecord", "ReportGeneralLedgerJournal|Record"); @@ -172,15 +179,15 @@ } setHistoryCommand(request, "DIRECT"); vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber", "0"); - printPageDataSheet(response, vars, "", "", "", "", strTable, strRecord, "", strcAcctSchemaId, - "", "", "", "1", "1", "", "Y", "", schemas, strPosted, "", "", "", ""); + printPageDataSheet(response, vars, "", "", "", "", "", strTable, strRecord, "", + strcAcctSchemaId, "", "", "", "1", "1", "", "Y", "", schemas, strPosted, "", "", "", ""); } else if (vars.commandIn("DIRECT2")) { String strFactAcctGroupId = vars.getGlobalVariable("inpFactAcctGroupId", "ReportGeneralLedgerJournal|FactAcctGroupId"); setHistoryCommand(request, "DIRECT2"); vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber", "0"); - printPageDataSheet(response, vars, "", "", "", "", "", "", strFactAcctGroupId, "", "", "", - "", "1", "1", "", "Y", "", "", "", "", "", "", ""); + printPageDataSheet(response, vars, "", "", "", "", "", "", "", strFactAcctGroupId, "", "", + "", "", "1", "1", "", "Y", "", "", "", "", "", "", ""); } else if (vars.commandIn("FIND")) { String strcAcctSchemaId = vars.getRequestGlobalVariable("inpcAcctSchemaId", "ReportGeneralLedger|cAcctSchemaId"); @@ -190,6 +197,8 @@ "ReportGeneralLedgerJournal|DateTo"); String strDocument = vars.getRequestGlobalVariable("inpDocument", "ReportGeneralLedgerJournal|Document"); + String strDocumentNo = vars.getRequestGlobalVariable("inpDocumentNo", + "ReportGeneralLedgerJournal|DocumentNo"); String strOrg = vars.getGlobalVariable("inpOrg", "ReportGeneralLedgerJournal|Org", "0"); String strShowClosing = vars.getRequestGlobalVariable("inpShowClosing", "ReportGeneralLedgerJournal|ShowClosing"); @@ -254,10 +263,10 @@ strcelementvalueto); vars.setSessionValue("inpElementValueIdFrom_DES", strcelementvaluefromdes); vars.setSessionValue("inpElementValueIdTo_DES", strcelementvaluetodes); - printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strOrg, "", "", "", - strcAcctSchemaId, strShowClosing, strShowReg, strShowOpening, strPageNo, strEntryNo, - strShowDescription, strShowRegular, strShowDivideUp, "", "", strcelementvaluefrom, - strcelementvalueto, strcelementvaluefromdes, strcelementvaluetodes); + printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strDocumentNo, + strOrg, "", "", "", strcAcctSchemaId, strShowClosing, strShowReg, strShowOpening, + strPageNo, strEntryNo, strShowDescription, strShowRegular, strShowDivideUp, "", "", + strcelementvaluefrom, strcelementvalueto, strcelementvaluefromdes, strcelementvaluetodes); } else if (vars.commandIn("PDF", "XLS")) { if (log4j.isDebugEnabled()) log4j.debug("PDF"); @@ -269,6 +278,8 @@ "ReportGeneralLedgerJournal|DateTo"); String strDocument = vars.getRequestGlobalVariable("inpDocument", "ReportGeneralLedgerJournal|Document"); + String strDocumentNo = vars.getRequestGlobalVariable("inpDocumentNo", + "ReportGeneralLedgerJournal|DocumentNo"); String strOrg = vars.getGlobalVariable("inpOrg", "ReportGeneralLedgerJournal|Org", "0"); String strShowClosing = vars.getRequestGlobalVariable("inpShowClosing", "ReportGeneralLedgerJournal|ShowClosing"); @@ -341,10 +352,10 @@ "ReportGeneralLedgerJournal|C_ElementValue_IDFROM"); String strcelementvalueto = vars.getRequestGlobalVariable("inpcElementValueIdTo", "ReportGeneralLedgerJournal|C_ElementValue_IDTO"); - printPagePDF(request, response, vars, strDateFrom, strDateTo, strDocument, strOrg, strTable, - strRecord, strFactAcctGroupId, strcAcctSchemaId, strShowClosing, strShowReg, - strShowOpening, strPageNo, strEntryNo, "Y".equals(strShowDescription) ? "Y" : "", - strShowRegular, strShowDivideUp, strcelementvaluefrom, strcelementvalueto); + printPagePDF(request, response, vars, strDateFrom, strDateTo, strDocument, strDocumentNo, + strOrg, strTable, strRecord, strFactAcctGroupId, strcAcctSchemaId, strShowClosing, + strShowReg, strShowOpening, strPageNo, strEntryNo, "Y".equals(strShowDescription) ? "Y" + : "", strShowRegular, strShowDivideUp, strcelementvaluefrom, strcelementvalueto); } else if (vars.commandIn("PREVIOUS_RELATION")) { String strInitRecord = vars.getSessionValue("ReportGeneralLedgerJournal.initRecordNumber"); String strPreviousRecordRange = vars.getSessionValue(PREVIOUS_RANGE); @@ -404,13 +415,13 @@ } private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars, - String strDateFrom, String strDateTo, String strDocument, String strOrg, String strTable, - String strRecord, String strFactAcctGroupId, String strcAcctSchemaId, String strShowClosing, - String strShowReg, String strShowOpening, String strPageNo, String strEntryNo, - String strShowDescription, String strShowRegular, String strShowDivideUp, String accShemas, - String strPosted, String strcelementvaluefrom, String strcelementvalueto, - String strcelementvaluefromdes, String strcelementvaluetodes) throws IOException, - ServletException { + String strDateFrom, String strDateTo, String strDocument, String strDocumentNo, + String strOrg, String strTable, String strRecord, String strFactAcctGroupId, + String strcAcctSchemaId, String strShowClosing, String strShowReg, String strShowOpening, + String strPageNo, String strEntryNo, String strShowDescription, String strShowRegular, + String strShowDivideUp, String accShemas, String strPosted, String strcelementvaluefrom, + String strcelementvalueto, String strcelementvaluefromdes, String strcelementvaluetodes) + throws IOException, ServletException { String strAllaccounts = "Y"; if (strcelementvaluefrom != null && !strcelementvaluefrom.equals("")) strAllaccounts = "N"; @@ -447,8 +458,8 @@ Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, - strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, - strcelementvalueto); + getDocumentNo(vars.getClient(), strDocument, strDocumentNo), strcAcctSchemaId, + strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, strcelementvalueto); String strInitAcctEntries = vars.getSessionValue(PREVIOUS_ACCTENTRIES); int acctEntries = (strInitAcctEntries.equals("") ? 0 : Integer.parseInt(strInitAcctEntries .split(",")[0])); @@ -503,15 +514,17 @@ Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, - strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, - strcelementvalueto, vars.getLanguage(), initRecordNumber, intRecordRangeUsed); + getDocumentNo(vars.getClient(), strDocument, strDocumentNo), strcAcctSchemaId, + strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, strcelementvalueto, + vars.getLanguage(), initRecordNumber, intRecordRangeUsed); if (data != null && data.length > 0) strPosition = ReportGeneralLedgerJournalData.selectCount(this, Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, - strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, - strcelementvalueto, data[0].dateacct, data[0].identifier); + getDocumentNo(vars.getClient(), strDocument, strDocumentNo), strcAcctSchemaId, + strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, strcelementvalueto, + data[0].dateacct, data[0].identifier); } else { data = ReportGeneralLedgerJournalData.selectDirect(this, "Y".equals(strShowDescription) ? "'Y'" : "'N'", @@ -654,6 +667,7 @@ vars.setSessionValue("ReportGeneralLedgerJournal|Record", strRecord); vars.setSessionValue("ReportGeneralLedgerJournal|Table", strTable); xmlDocument.setParameter("inpPageNo", strPageNo); + xmlDocument.setParameter("inpDocumentNo", strDocumentNo); xmlDocument.setParameter("inpEntryNo", strEntryNo); // If none of the "show" flags is active, then regular is checked xmlDocument.setParameter("showRegular", ("".equals(strShowRegular)) ? "N" : strShowRegular); @@ -686,11 +700,11 @@ private void printPagePDF(HttpServletRequest request, HttpServletResponse response, VariablesSecureApp vars, String strDateFrom, String strDateTo, String strDocument, - String strOrg, String strTable, String strRecord, String strFactAcctGroupId, - String strcAcctSchemaId, String strShowClosing, String strShowReg, String strShowOpening, - String strPageNo, String strEntryNo, String strShowDescription, String strShowRegular, - String strShowDivideUp, String strcelementvaluefrom, String strcelementvalueto) - throws IOException, ServletException { + String strDocumentNo, String strOrg, String strTable, String strRecord, + String strFactAcctGroupId, String strcAcctSchemaId, String strShowClosing, String strShowReg, + String strShowOpening, String strPageNo, String strEntryNo, String strShowDescription, + String strShowRegular, String strShowDivideUp, String strcelementvaluefrom, + String strcelementvalueto) throws IOException, ServletException { ReportGeneralLedgerJournalData[] data = null; @@ -711,7 +725,8 @@ data = ReportGeneralLedgerJournalData.select(this, "Y".equals(strShowDescription) ? "'Y'" : "'N'", Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), Utility .getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, - DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, strcAcctSchemaId, + DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, + getDocumentNo(vars.getClient(), strDocument, strDocumentNo), strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, strcelementvalueto, vars .getLanguage()); } else @@ -894,6 +909,49 @@ } + /** + * Builds dynamic SQL to filter by document No + */ + private String getDocumentNo(String strClient, String strDocument, String strDocumentNo) { + if (StringUtils.isBlank(strDocument) || StringUtils.isBlank(strDocumentNo)) { + return null; + } + + try { + OBContext.setAdminMode(); + String documentNo = StringEscapeUtils.escapeSql(strDocumentNo); + documentNo = documentNo.replaceAll(";", ""); + + StringBuffer where = new StringBuffer(); + where.append(" select t." + Table.PROPERTY_DBTABLENAME); + where.append(" from " + DocumentType.ENTITY_NAME + " as d"); + where.append(" join d." + DocumentType.PROPERTY_TABLE + " as t"); + where.append(" where d." + DocumentType.PROPERTY_DOCUMENTCATEGORY + " = :document"); + where.append(" and d." + DocumentType.PROPERTY_CLIENT + ".id = :client"); + where.append(" group by d." + DocumentType.PROPERTY_DOCUMENTCATEGORY); + where.append(" , t." + Table.PROPERTY_DBTABLENAME); + Query qry = OBDal.getInstance().getSession().createQuery(where.toString()); + qry.setMaxResults(1); + qry.setParameter("document", strDocument); + qry.setParameter("client", strClient); + String tablename = (String) qry.uniqueResult(); + + if (StringUtils.isBlank(tablename)) { + return null; + } + + StringBuffer existsSubQuery = new StringBuffer("( SELECT 1 FROM "); + existsSubQuery.append(tablename); + existsSubQuery.append(" dt WHERE f.record_id = dt.").append(tablename).append("_id"); + existsSubQuery.append(" AND dt.documentno = '").append(documentNo).append("' )"); + return existsSubQuery.toString(); + } catch (Exception ignore) { + return null; + } finally { + OBContext.restorePreviousMode(); + } + } + @Override public String getServletInfo() { return "Servlet ReportGeneralLedgerJournal. This Servlet was made by Pablo Sarobe modified by everybody";
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml Wed Nov 11 12:22:58 2015 +0100 @@ -12,7 +12,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) 2001-2014 Openbravo SLU +* All portions are Copyright (C) 2001-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -47,6 +47,7 @@ <PARAMETER id="inpParamschemas" name="cAcctschemas" attribute="value" default=""/> <PARAMETER id="posted" name="posted" attribute="value" default=""/> <PARAMETER id="paramPageNo" name="inpPageNo" attribute="value" default="1"/> + <PARAMETER id="paramDocumentNo" name="inpDocumentNo" attribute="value" default=""/> <PARAMETER id="paramEntryNo" name="inpEntryNo" attribute="value" default="1"/> <PARAMETER id="fieldCheck" name="check" default="Y"/> <PARAMETER id="paramShowRegular" name="showRegular" boolean="checked" withId="fieldCheck"/>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql Wed Nov 11 12:22:58 2015 +0100 @@ -12,7 +12,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) 2001-2014 Openbravo SLU + * All portions are Copyright (C) 2001-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -70,6 +70,7 @@ <Parameter name="parDateFrom" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct >= TO_DATE(?)]]></Parameter> <Parameter name="parDateTo" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct < TO_DATE(?)]]></Parameter> <Parameter name="docbasetype" optional="true" after="AND 1=1"><![CDATA[ AND f.DOCBASETYPE = ?]]></Parameter> + <Parameter name="documentNo" optional="true" after="AND 1=1" type="argument"><![CDATA[ AND EXISTS ]]></Parameter> <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter> <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/> <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/> @@ -137,6 +138,7 @@ <Parameter name="parDateFrom" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct >= TO_DATE(?)]]></Parameter> <Parameter name="parDateTo" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct < TO_DATE(?)]]></Parameter> <Parameter name="docbasetype" optional="true" after="AND 1=1"><![CDATA[ AND f.DOCBASETYPE = ?]]></Parameter> + <Parameter name="documentNo" optional="true" after="AND 1=1" type="argument"><![CDATA[ AND EXISTS ]]></Parameter> <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter> <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/> <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/> @@ -193,6 +195,7 @@ <Parameter name="parDateFrom" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct >= TO_DATE(?)]]></Parameter> <Parameter name="parDateTo" optional="true" after="AND 1=1"><![CDATA[ AND f.dateacct < TO_DATE(?)]]></Parameter> <Parameter name="docbasetype" optional="true" after="AND 1=1"><![CDATA[ AND f.DOCBASETYPE = ?]]></Parameter> + <Parameter name="documentNo" optional="true" after="AND 1=1" type="argument"><![CDATA[ AND EXISTS ]]></Parameter> <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter> <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/> <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/>
--- a/src/org/openbravo/erpCommon/security/Login.html Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/security/Login.html Wed Nov 11 12:22:58 2015 +0100 @@ -406,7 +406,7 @@ } catch (e) { } - if ((!revisionControl('27290')) || (isOpsInstance() != isOpsInstanceCached())) { + if ((!revisionControl('27851')) || (isOpsInstance() != isOpsInstanceCached())) { maskLoginWindow(cacheMsg); setLoginMessage('Warning', '', cacheMsg); }
--- a/src/org/openbravo/erpCommon/security/Login_F1.html Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/security/Login_F1.html Wed Nov 11 12:22:58 2015 +0100 @@ -126,7 +126,7 @@ clearForm(); } catch (e) {} setWindowElementFocus('firstElement'); - if ((!revisionControl('27290')) || (isOpsInstance() != isOpsInstanceCached())) { + if ((!revisionControl('27851')) || (isOpsInstance() != isOpsInstanceCached())) { alert(cacheMsg); }
--- a/src/org/openbravo/erpCommon/utility/PopupLoading.html Tue Nov 10 09:05:49 2015 +0100 +++ b/src/org/openbravo/erpCommon/utility/PopupLoading.html 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) 2008-2012 Openbravo SLU + * All portions are Copyright (C) 2008-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -38,7 +38,7 @@ <script language="javascript"> function onLoadDo() { moreOnLoadDoFunctions(); - if (isIE9Strict) { + if (isIE9Strict || isEdge) { var i=0; var setOpenerInterval = setInterval( function() {
--- a/web/js/utils.js Tue Nov 10 09:05:49 2015 +0100 +++ b/web/js/utils.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) 2001-2014 Openbravo SLU + * All portions are Copyright (C) 2001-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -29,6 +29,9 @@ if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1 && getBrowserInfo('documentMode') >= 9 && parseInt(getBrowserInfo('majorVersion'), 10) >= 9) { isIE9Strict = true; } + if (navigator.userAgent.toUpperCase().indexOf("EDGE") !== -1) { + isEdge = true; + } isWindowInMDIPopup = checkWindowInMDIPopup(); isWindowInMDITab = checkWindowInMDITab(); isWindowInMDIPage = checkWindowInMDIPage(); @@ -40,6 +43,7 @@ } var isIE9Strict = false; +var isEdge = false; var isRTL = false; var isWindowInMDIPopup = false; var isWindowInMDITab = false; @@ -101,7 +105,7 @@ * Return a number that would be checked at the Login screen to know if the file is cached with the correct version */ function getCurrentRevision() { - var number = '27290'; + var number = '27851'; return number; }