details: https://code.openbravo.com/erp/devel/pi/rev/cbc952986b64 changeset: 32600:cbc952986b64 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Mon Aug 28 21:49:52 2017 +0530 summary: Fixes issue 36736: Adapt read only pool connection provider in ob reports
details: https://code.openbravo.com/erp/devel/pi/rev/53dd072df834 changeset: 32601:53dd072df834 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Tue Aug 29 16:03:12 2017 +0200 summary: Related to issue 36736: Use read only pool also in Aging reports details: https://code.openbravo.com/erp/devel/pi/rev/90a1381fae84 changeset: 32602:90a1381fae84 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Tue Aug 29 16:10:25 2017 +0200 summary: Related to issue 36736: Revert changes in reports launched after creating a document (post document, print document, etc.) diffstat: modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java | 358 ++++--- modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java | 446 +++++---- modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java | 77 +- src/org/openbravo/common/actionhandler/AgingBalanceReportActionHandler.java | 6 +- src/org/openbravo/common/actionhandler/CashflowForecastReportActionHandler.java | 3 +- src/org/openbravo/erpCommon/ad_reports/AgingDao.java | 18 +- src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java | 199 ++- src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java | 185 ++- src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance.java | 125 +- src/org/openbravo/erpCommon/ad_reports/ReportAssetDepreciationSchedule.java | 68 +- src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel.java | 228 ++-- src/org/openbravo/erpCommon/ad_reports/ReportExpense.java | 206 ++- src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java | 369 ++++--- src/org/openbravo/erpCommon/ad_reports/ReportGuaranteeDateJR.java | 53 +- src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java | 471 +++++---- src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerJR.java | 132 +- src/org/openbravo/erpCommon/ad_reports/ReportInvoiceDiscountJR.java | 89 +- src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR.java | 231 ++-- src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorJR.java | 74 +- src/org/openbravo/erpCommon/ad_reports/ReportInvoicesJR.java | 97 +- src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java | 212 ++- src/org/openbravo/erpCommon/ad_reports/ReportMaterialTransactionEditionJR.java | 60 +- src/org/openbravo/erpCommon/ad_reports/ReportNotPosted.java | 32 +- src/org/openbravo/erpCommon/ad_reports/ReportOffer.java | 56 +- src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java | 82 +- src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java | 97 +- src/org/openbravo/erpCommon/ad_reports/ReportPendingProductionJr.java | 36 +- src/org/openbravo/erpCommon/ad_reports/ReportPricelist.java | 87 +- src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java | 116 +- src/org/openbravo/erpCommon/ad_reports/ReportProductionCost.java | 212 ++-- src/org/openbravo/erpCommon/ad_reports/ReportProductionJR.java | 59 +- src/org/openbravo/erpCommon/ad_reports/ReportProductionRunJR.java | 144 +- src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitabilityJR.java | 158 +- src/org/openbravo/erpCommon/ad_reports/ReportProjectProgress.java | 183 ++- src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR.java | 211 ++- src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR.java | 312 +++--- src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderInvoicedJasper.java | 171 +- src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderJR.java | 82 +- src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderProvidedJR.java | 178 ++- src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java | 338 +++--- src/org/openbravo/erpCommon/ad_reports/ReportShipmentEditionJR.java | 59 +- src/org/openbravo/erpCommon/ad_reports/ReportShipper.java | 82 +- src/org/openbravo/erpCommon/ad_reports/ReportStandardCostJR.java | 72 +- src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java | 426 +++++---- src/org/openbravo/erpCommon/ad_reports/ReportValuationStock.java | 110 +- src/org/openbravo/erpCommon/ad_reports/ReportWarehouseControl.java | 47 +- src/org/openbravo/erpCommon/ad_reports/ReportWarehousePartnerJR.java | 61 +- src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementJR.java | 59 +- 48 files changed, 3903 insertions(+), 3274 deletions(-) diffs (truncated from 15648 to 300 lines): diff -r bda39bc4acd3 -r 90a1381fae84 modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java --- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java Tue Aug 29 14:46:37 2017 +0200 +++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java Tue Aug 29 16:10:25 2017 +0200 @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang.StringUtils; import org.openbravo.base.exception.OBException; import org.openbravo.base.filter.IsIDFilter; import org.openbravo.base.filter.ValueListFilter; @@ -37,6 +38,7 @@ import org.openbravo.dal.service.OBDal; import org.openbravo.data.FieldProvider; import org.openbravo.data.Sqlc; +import org.openbravo.database.ConnectionProvider; import org.openbravo.erpCommon.businessUtility.WindowTabs; import org.openbravo.erpCommon.info.SelectorUtilityData; import org.openbravo.erpCommon.utility.ComboTableData; @@ -54,6 +56,7 @@ import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount; import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod; import org.openbravo.model.project.Project; +import org.openbravo.service.db.DalConnectionProvider; import org.openbravo.xmlEngine.XmlDocument; public class PaymentReport extends HttpSecureAppServlet { @@ -120,8 +123,9 @@ strConvertCurrency = vars.getGlobalVariable("inpConvertCurrencyId", "PaymentReport|ConvertCurrency", ""); } + ConnectionProvider readOnlyCP = DalConnectionProvider.getReadOnlyConnectionProvider(); String strConversionDate = vars.getGlobalVariable("inpConversionDate", - "PaymentReport|ConversionDate", DateTimeData.today(this)); + "PaymentReport|ConversionDate", DateTimeData.today(readOnlyCP)); String strPaymType = vars.getGlobalVariable("inpPaymType", "PaymentReport|PaymentType", "FINPR_RecPay"); String strOverdue = vars.getGlobalVariable("inpOverdue", "PaymentReport|Overdue", ""); @@ -152,12 +156,12 @@ "PaymentReport|ExpectedDateFrom"); String strExpectedDateTo = vars.getRequestGlobalVariable("inpExpectedDateTo", "PaymentReport|ExpectedDateTo"); - if (vars.getNumericParameter("inpAmountFrom").isEmpty()) { + if (StringUtils.isEmpty(vars.getNumericParameter("inpAmountFrom"))) { vars.removeSessionValue("PaymentReport|AmountFrom"); } String strAmountFrom = vars.getNumericRequestGlobalVariable("inpAmountFrom", "PaymentReport|AmountFrom"); - if (vars.getNumericParameter("inpAmountTo").isEmpty()) { + if (StringUtils.isEmpty(vars.getNumericParameter("inpAmountTo"))) { vars.removeSessionValue("PaymentReport|AmountTo"); } String strAmountTo = vars.getNumericRequestGlobalVariable("inpAmountTo", @@ -282,10 +286,11 @@ vars.setSessionValue("PaymentReport|IncludePaymentUsingCredit", strInclPaymentUsingCredit); String strsalesrepId = vars.getRequestGlobalVariable("inpSalesrepId", "PaymentReport|SalesRepId", IsIDFilter.instance); - if (vars.commandIn("PDF")) + if (vars.commandIn("PDF")) { strOutput = "pdf"; - else if (vars.commandIn("XLS")) + } else if (vars.commandIn("XLS")) { strOutput = "xls"; + } printPage(request, response, vars, strOrg, strInclSubOrg, strDueDateFrom, strDueDateTo, strExpectedDateFrom, strExpectedDateTo, strAmountFrom, strAmountTo, strDocumentDateFrom, @@ -301,13 +306,13 @@ String strRecordId = vars.getRequiredStringParameter("inpRecordId", IsIDFilter.instance); HashMap<String, String> data = PaymentReportDao.getLinkParameters(strTableId, strIsReceipt); - if (data == null || data.size() == 0) + if (data == null || data.size() == 0) { bdError(request, response, "RecordError", vars.getLanguage()); - else { + } else { String inputName = "inp" + Sqlc.TransformaNombreColumna(data.get("adColumnName")); String strWindowPath = Utility.getTabURL(data.get("adTabId"), "R", true); - if (strWindowPath.equals("")) { + if (StringUtils.isEmpty(strWindowPath)) { strWindowPath = strDefaultServlet; } response.sendRedirect(strWindowPath + "?" + "Command=DIRECT&" + inputName + "=" @@ -327,8 +332,11 @@ String strGroupCrit, String strOrdCrit, String strInclPaymentUsingCredit, String strPaymentDateFrom, String strPaymentDateTo, String strsalesrepId) throws IOException, ServletException { - if (log4j.isDebugEnabled()) + + ConnectionProvider readOnlyCP = DalConnectionProvider.getReadOnlyConnectionProvider(); + if (log4j.isDebugEnabled()) { log4j.debug("Output: dataSheet"); + } XmlDocument xmlDocument = null; ArrayList<String> discardAL = new ArrayList<String>(); FieldProvider[] data = null; @@ -359,13 +367,14 @@ xmlDocument.setParameter("messageType", "WARNING"); xmlDocument.setParameter("messageTitle", - Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage())); + Utility.messageBD(readOnlyCP, "ProcessStatus-W", vars.getLanguage())); String noConversionFound = ""; - if (e.getMessage() != null && e.getMessage().contains("->")) - noConversionFound = Utility - .messageBD(this, "FINPR_NoConversionFound", vars.getLanguage()); + if (e.getMessage() != null && e.getMessage().contains("->")) { + noConversionFound = Utility.messageBD(readOnlyCP, "FINPR_NoConversionFound", + vars.getLanguage()); + } xmlDocument.setParameter("messageMessage", - noConversionFound + Utility.messageBD(this, e.getMessage(), vars.getLanguage())); + noConversionFound + Utility.messageBD(readOnlyCP, e.getMessage(), vars.getLanguage())); } if (data != null && data.length == 0) { @@ -383,15 +392,15 @@ xmlDocument.setParameter("messageType", "WARNING"); xmlDocument.setParameter("messageTitle", - Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage())); + Utility.messageBD(readOnlyCP, "ProcessStatus-W", vars.getLanguage())); xmlDocument.setParameter("messageMessage", - Utility.messageBD(this, "FINPR_NoDataFound", vars.getLanguage())); + Utility.messageBD(readOnlyCP, "FINPR_NoDataFound", vars.getLanguage())); } else if (data != null && data.length == 1 && data[0].getField("conversionDate") != null) { - String transCurrency = OBDal.getInstance() + String transCurrency = OBDal.getReadOnlyInstance() .get(Currency.class, data[0].getField("transCurrency")).getISOCode(); - String baseCurrency = OBDal.getInstance() + String baseCurrency = OBDal.getReadOnlyInstance() .get(Currency.class, data[0].getField("baseCurrency")).getISOCode(); String message = transCurrency + " -> " + baseCurrency + " " @@ -410,13 +419,13 @@ xmlDocument.setParameter("messageType", "WARNING"); xmlDocument.setParameter("messageTitle", - Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage())); + Utility.messageBD(readOnlyCP, "ProcessStatus-W", vars.getLanguage())); xmlDocument.setParameter("messageMessage", - Utility.messageBD(this, "FINPR_NoConversionFound", vars.getLanguage()) + message); + Utility.messageBD(readOnlyCP, "FINPR_NoConversionFound", vars.getLanguage()) + message); } else if (data != null) { - if (strGroupCrit.isEmpty()) { + if (StringUtils.isEmpty(strGroupCrit)) { discardAL.add("sectionGroupCrit"); discardAL.add("sectionTotal2"); discardAL.add("sectionSubtotalGroupCrit"); @@ -430,10 +439,11 @@ "org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport", discardAL.toArray(discard)).createXmlDocument(); - if (strGroupCrit.equals("")) + if (StringUtils.isEmpty(strGroupCrit)) { xmlDocument.setData("structure1", data); - else + } else { xmlDocument.setData("structure2", data); + } } } else { @@ -450,7 +460,7 @@ discardAL.toArray(discard)).createXmlDocument(); } - ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "PaymentReport", false, "", "", + ToolBar toolbar = new ToolBar(readOnlyCP, vars.getLanguage(), "PaymentReport", false, "", "", "printPDF();return false;", false, "ad_reports", strReplaceWith, false, true); toolbar.setEmail(false); toolbar.prepareSimpleToolBarTemplate(); @@ -458,16 +468,16 @@ xmlDocument.setParameter("toolbar", toolbar.toString()); try { - WindowTabs tabs = new WindowTabs(this, vars, + WindowTabs tabs = new WindowTabs(readOnlyCP, vars, "org.openbravo.financial.paymentreport.erpCommon.ad_reports.PaymentReport"); xmlDocument.setParameter("parentTabContainer", tabs.parentTabs()); xmlDocument.setParameter("mainTabContainer", tabs.mainTabs()); xmlDocument.setParameter("childTabContainer", tabs.childTabs()); xmlDocument.setParameter("theme", vars.getTheme()); - NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "PaymentReport.html", + NavigationBar nav = new NavigationBar(readOnlyCP, vars.getLanguage(), "PaymentReport.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb()); xmlDocument.setParameter("navigationBar", nav.toString()); - LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "PaymentReport.html", + LeftTabsBar lBar = new LeftTabsBar(readOnlyCP, vars.getLanguage(), "PaymentReport.html", strReplaceWith); xmlDocument.setParameter("leftTabs", lBar.manualTemplate()); } catch (Exception ex) { @@ -488,10 +498,10 @@ xmlDocument.setParameter("paramLanguage", "defaultLang=\"" + vars.getLanguage() + "\";"); xmlDocument.setParameter("org", strOrg); try { - ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "", - "", Utility.getContext(this, vars, "#User_Org", "PaymentReport"), Utility.getContext( - this, vars, "#User_Client", "PaymentReport"), 0); - Utility.fillSQLParameters(this, vars, null, comboTableData, "PaymentReport", strOrg); + ComboTableData comboTableData = new ComboTableData(vars, readOnlyCP, "TABLEDIR", "AD_Org_ID", + "", "", Utility.getContext(readOnlyCP, vars, "#User_Org", "PaymentReport"), + Utility.getContext(readOnlyCP, vars, "#User_Client", "PaymentReport"), 0); + Utility.fillSQLParameters(readOnlyCP, vars, null, comboTableData, "PaymentReport", strOrg); xmlDocument.setData("reportAD_Org_ID", "liststructure", comboTableData.select(false)); comboTableData = null; } catch (Exception ex) { @@ -524,16 +534,18 @@ xmlDocument.setData( "paramcBPartnerId_IN", "liststructure", - SelectorUtilityData.selectBpartner(this, - Utility.getContext(this, vars, "#AccessibleOrgTree", ""), - Utility.getContext(this, vars, "#User_Client", ""), strcBPartnerIdIN)); + SelectorUtilityData.selectBpartner(readOnlyCP, + Utility.getContext(readOnlyCP, vars, "#AccessibleOrgTree", ""), + Utility.getContext(readOnlyCP, vars, "#User_Client", ""), strcBPartnerIdIN)); xmlDocument.setParameter("cBPGroupId_IN", strcBPGroupIdIN); try { - ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "C_BP_Group_ID", - "", "", Utility.getContext(this, vars, "#AccessibleOrgTree", "PaymentReport"), - Utility.getContext(this, vars, "#User_Client", "PaymentReport"), 0); - Utility.fillSQLParameters(this, vars, null, comboTableData, "PaymentReport", strcBPGroupIdIN); + ComboTableData comboTableData = new ComboTableData(vars, readOnlyCP, "TABLEDIR", + "C_BP_Group_ID", "", "", Utility.getContext(readOnlyCP, vars, "#AccessibleOrgTree", + "PaymentReport"), Utility.getContext(readOnlyCP, vars, "#User_Client", + "PaymentReport"), 0); + Utility.fillSQLParameters(readOnlyCP, vars, null, comboTableData, "PaymentReport", + strcBPGroupIdIN); xmlDocument.setData("reportBPGroupId_IN", "liststructure", comboTableData.select(false)); comboTableData = null; } catch (Exception ex) { @@ -545,16 +557,18 @@ xmlDocument.setData( "paramcProjectId_IN", "liststructure", - SelectorUtilityData.selectProject(this, - Utility.getContext(this, vars, "#AccessibleOrgTree", ""), - Utility.getContext(this, vars, "#User_Client", ""), strcProjectIdIN)); + SelectorUtilityData.selectProject(readOnlyCP, + Utility.getContext(readOnlyCP, vars, "#AccessibleOrgTree", ""), + Utility.getContext(readOnlyCP, vars, "#User_Client", ""), strcProjectIdIN)); xmlDocument.setParameter("selectedStatuses", strfinPaymSt); try { - ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "", - "FIN_Payment status", "", Utility.getContext(this, vars, "#AccessibleOrgTree", - "PaymentReport"), Utility.getContext(this, vars, "#User_Client", "PaymentReport"), 0); - Utility.fillSQLParameters(this, vars, null, comboTableData, "PaymentReport", strfinPaymSt); + ComboTableData comboTableData = new ComboTableData(vars, readOnlyCP, "LIST", "", + "FIN_Payment status", "", Utility.getContext(readOnlyCP, vars, "#AccessibleOrgTree", + "PaymentReport"), Utility.getContext(readOnlyCP, vars, "#User_Client", + "PaymentReport"), 0); + Utility.fillSQLParameters(readOnlyCP, vars, null, comboTableData, "PaymentReport", + strfinPaymSt); xmlDocument.setData("reportStatus", "liststructure", comboTableData.select(false)); comboTableData = null; } catch (Exception ex) { @@ -563,11 +577,11 @@ xmlDocument.setParameter("paymentMethodId", strPaymentMethodId); try { - ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", - "FIN_PaymentMethod_ID", "", "FIN_PaymentMethodsWithAccount", Utility.getContext(this, - vars, "#AccessibleOrgTree", "PaymentReport"), Utility.getContext(this, vars, - "#User_Client", "PaymentReport"), 0); - Utility.fillSQLParameters(this, vars, null, comboTableData, "PaymentReport", + ComboTableData comboTableData = new ComboTableData(vars, readOnlyCP, "TABLEDIR", + "FIN_PaymentMethod_ID", "", "FIN_PaymentMethodsWithAccount", Utility.getContext( + readOnlyCP, vars, "#AccessibleOrgTree", "PaymentReport"), Utility.getContext( + readOnlyCP, vars, "#User_Client", "PaymentReport"), 0); + Utility.fillSQLParameters(readOnlyCP, vars, null, comboTableData, "PaymentReport", strPaymentMethodId); xmlDocument.setData("reportPaymentMethod_ID", "liststructure", comboTableData.select(false)); comboTableData = null; @@ -577,10 +591,11 @@ xmlDocument.setParameter("financialAccountId", strFinancialAccountId); try { - ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", - "FIN_Financial_Account_ID", "", "", Utility.getContext(this, vars, "#AccessibleOrgTree", - "PaymentReport"), Utility.getContext(this, vars, "#User_Client", "PaymentReport"), 0); - Utility.fillSQLParameters(this, vars, null, comboTableData, "PaymentReport", + ComboTableData comboTableData = new ComboTableData(vars, readOnlyCP, "TABLEDIR", + "FIN_Financial_Account_ID", "", "", Utility.getContext(readOnlyCP, vars, + "#AccessibleOrgTree", "PaymentReport"), Utility.getContext(readOnlyCP, vars, + "#User_Client", "PaymentReport"), 0); + Utility.fillSQLParameters(readOnlyCP, vars, null, comboTableData, "PaymentReport", strFinancialAccountId); xmlDocument.setData("reportFinancialAccount_ID", "liststructure", comboTableData.select(false)); @@ -591,10 +606,12 @@ xmlDocument.setParameter("cCurrencyId", strcCurrency); ------------------------------------------------------------------------------ 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