details: https://code.openbravo.com/erp/devel/pi/rev/692c7a5ece6b changeset: 32032:692c7a5ece6b user: Armaignac <collazoandy4 <at> gmail.com> date: Thu May 04 16:06:19 2017 -0400 summary: Fixes issue 35781: Product Movement Report collapse the system
The data in report was limit to the LimitsReports preference value and a warning is shown to inform that data is being limited. details: https://code.openbravo.com/erp/devel/pi/rev/19dbeb49b487 changeset: 32033:19dbeb49b487 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Fri May 05 09:50:29 2017 +0200 summary: Related to issue 35781: Code review improvements Don't read ReportsLimit preference when opening the report but just when running it. Fix select query when running it in Oracle. diffstat: src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java | 25 ++++++++- src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql | 6 ++- 2 files changed, 27 insertions(+), 4 deletions(-) diffs (106 lines): diff -r 3851147e5fd8 -r 19dbeb49b487 src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java --- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java Thu May 04 13:08:22 2017 -0400 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java Fri May 05 09:50:29 2017 +0200 @@ -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-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang.StringUtils; import org.openbravo.base.secureApp.HttpSecureAppServlet; import org.openbravo.base.secureApp.VariablesSecureApp; import org.openbravo.erpCommon.businessUtility.WindowTabs; @@ -141,13 +142,23 @@ localStrDateTo = DateTimeData.today(this); localStrDateFrom = DateTimeData.weekBefore(this); } + + int limit = 0; if (vars.commandIn("FIND", "DIRECT")) { + limit = Integer.parseInt(Utility.getPreference(vars, "ReportsLimit", "")); + String pgLimit = null, oraLimit = null; + if (StringUtils.equals(this.myPool.getRDBMS(), "ORACLE")) { + oraLimit = String.valueOf(limit + 1); + } else { + pgLimit = String.valueOf(limit + 1); + } + if (strInout.equals("-1")) { data = ReportProductMovementData.select(this, vars.getLanguage(), Utility.getContext(this, vars, "#User_Client", "ReportProductMovement"), Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductMovement"), localStrDateFrom, DateTimeData.nDaysAfter(this, localStrDateTo, "1"), strcBpartnerId, - strmProductId, strmAttributesetinstanceId, "N"); + strmProductId, strmAttributesetinstanceId, "N", pgLimit, oraLimit); if (data == null || data.length == 0) { discard[0] = "selEliminar1"; data = ReportProductMovementData.set(); @@ -162,7 +173,7 @@ Utility.getContext(this, vars, "#User_Client", "ReportProductMovement"), Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductMovement"), localStrDateFrom, DateTimeData.nDaysAfter(this, localStrDateTo, "1"), strcBpartnerId, - strmProductId, strmAttributesetinstanceId, "Y"); + strmProductId, strmAttributesetinstanceId, "Y", pgLimit, oraLimit); if (data5 == null || data5.length == 0) { discard[5] = "selEliminar6"; data5 = ReportProductMovementData.set(); @@ -268,6 +279,14 @@ } { OBError myMessage = vars.getMessage("ReportProductMovement"); + if (limit > 0 && data.length > limit) { + myMessage = new OBError(); + myMessage.setType("Warning"); + myMessage.setTitle(""); + String msgbody = Utility.messageBD(this, "ReportsLimit", vars.getLanguage()); + msgbody = msgbody.replace("@limit@", String.valueOf(limit + 1)); + myMessage.setMessage(msgbody); + } vars.removeMessage("ReportProductMovement"); if (myMessage != null) { xmlDocument.setParameter("messageType", myMessage.getType()); diff -r 3851147e5fd8 -r 19dbeb49b487 src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql --- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql Thu May 04 13:08:22 2017 -0400 +++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql Fri May 05 09:50:29 2017 +0200 @@ -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-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -28,6 +28,7 @@ <SqlMethodComment></SqlMethodComment> <Sql> <![CDATA[ + SELECT B.* FROM ( SELECT M_PRODUCT.VALUE, M_PRODUCT.NAME, M_TRANSACTION.MOVEMENTDATE, C_BPARTNER.NAME AS PARTNERNAME,M_ATTRIBUTESETINSTANCE.DESCRIPTION AS ATTR, (CASE M_INOUT.ISSOTRX WHEN 'Y' THEN TO_CHAR(M_WAREHOUSE.NAME) ELSE '-' END)AS WA_ORIGIN, (CASE M_INOUT.ISSOTRX WHEN 'Y' THEN TO_CHAR(M_LOCATOR.X) ELSE '-' END) AS X_ORIGIN, @@ -59,6 +60,7 @@ M_LOCATOR.Z, M_INOUT.ISSOTRX, C_UOM.NAME, M_INOUT.M_INOUT_ID, M_INOUT.DOCUMENTNO, M_ATTRIBUTESETINSTANCE.DESCRIPTION, M_WAREHOUSE.NAME ORDER BY C_BPARTNER.NAME, M_TRANSACTION.MOVEMENTDATE DESC + ) B ]]></Sql> <Parameter name="adLanguage"/> <Field name="rownum" value="count"/> @@ -70,6 +72,8 @@ <Parameter name="mProductId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID = ?]]></Parameter> <Parameter name="parmAttributeSetInstanceId" optional="true" after="AND 1=1"><![CDATA[AND M_TRANSACTION.M_ATTRIBUTESETINSTANCE_ID = ?]]></Parameter> <Parameter name="isReturn" optional="true" after="AND 1=1"><![CDATA[AND C_DOCTYPE.ISRETURN = ?]]></Parameter> + <Parameter name="pgLimit" type="argument" optional="true" after=") B"><![CDATA[LIMIT ]]></Parameter> + <Parameter name="oraLimit1" type="argument" optional="true" after=") B"><![CDATA[WHERE ROWNUM <= ]]></Parameter> </SqlMethod> <SqlMethod name="selectInventory" type="preparedStatement" return="multiple"> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits