details: https://code.openbravo.com/erp/devel/pi/rev/2580ff5d8c68 changeset: 16179:2580ff5d8c68 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Tue Apr 24 12:44:32 2012 +0200 summary: Fixed issue 15092 Change OrganizationComboData instead of ComboTableData
details: https://code.openbravo.com/erp/devel/pi/rev/b1c45effac4b changeset: 16180:b1c45effac4b user: Mikel Irurita <mikel.irurita <at> openbravo.com> date: Tue Apr 24 18:16:02 2012 +0200 summary: Related to issue 15092: code review. Add validation 'AD_Org (without *)' for Orders Awaiting Delivery and Print Invoices. diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java | 26 +++++---- modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java | 17 +++++- src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql | 8 +- src/org/openbravo/erpCommon/ad_process/PrintInvoices.java | 19 +++++- 4 files changed, 47 insertions(+), 23 deletions(-) diffs (176 lines): diff -r 8f215938f06a -r b1c45effac4b modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java Tue Apr 24 17:06:29 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java Tue Apr 24 18:16:02 2012 +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) 2010-2011 Openbravo SLU + * All portions are Copyright (C) 2010-2012 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************* @@ -39,10 +39,9 @@ import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBCriteria; import org.openbravo.dal.service.OBDal; -import org.openbravo.data.FieldProvider; -import org.openbravo.erpCommon.ad_combos.OrganizationComboData; import org.openbravo.erpCommon.businessUtility.WindowTabs; import org.openbravo.erpCommon.info.SelectorUtility; +import org.openbravo.erpCommon.utility.ComboTableData; import org.openbravo.erpCommon.utility.DateTimeData; import org.openbravo.erpCommon.utility.LeftTabsBar; import org.openbravo.erpCommon.utility.NavigationBar; @@ -149,16 +148,21 @@ xmlDocument.setParameter("inpChkIsReceipt", strIsReceipt); String newOrg = strOrganizationId; - if (!"0".equals(strOrganizationId)) { + if (null != strOrganizationId) { xmlDocument.setParameter("orgId", strOrganizationId); - } else { - FieldProvider[] fp = OrganizationComboData.selectCombo(this, vars.getRole()); - if (fp != null && fp.length > 0) { - newOrg = fp[0].getField("id"); - } } - xmlDocument.setData("reportAD_ORGID", "liststructure", - OrganizationComboData.selectCombo(this, vars.getRole())); + try { + ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "", + "", Utility.getContext(this, vars, "#User_Org", "BatchPaymentExecution"), + Utility.getContext(this, vars, "#User_Client", "BatchPaymentExecution"), 0); + Utility.fillSQLParameters(this, vars, null, comboTableData, "PrintInvoices", ""); + xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false)); + comboTableData = null; + + } catch (Exception ex) { + throw new ServletException(ex); + } + xmlDocument.setParameter("dateFrom", strDateFrom); xmlDocument.setParameter("dateTo", strDateTo); diff -r 8f215938f06a -r b1c45effac4b modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java --- a/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java Tue Apr 24 17:06:29 2012 +0200 +++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java Tue Apr 24 18:16:02 2012 +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) 2009-2011 Openbravo SLU + * All portions are Copyright (C) 2009-2012 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -28,7 +28,6 @@ import org.openbravo.base.secureApp.HttpSecureAppServlet; import org.openbravo.base.secureApp.VariablesSecureApp; -import org.openbravo.erpCommon.ad_combos.OrganizationComboData; import org.openbravo.erpCommon.businessUtility.WindowTabs; import org.openbravo.erpCommon.utility.ComboTableData; import org.openbravo.erpCommon.utility.DateTimeData; @@ -153,8 +152,18 @@ xmlDocument.setParameter("orderDocNo", strOrderDocNo); xmlDocument.setParameter("orderRef", strOrderRef); xmlDocument.setParameter("adOrgId", strCOrgId); - xmlDocument.setData("reportAD_ORGID", "liststructure", - OrganizationComboData.selectCombo(this, vars.getRole())); + try { + ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "", + "49DC1D6F086945AB82F84C66F5F13F16", Utility.getContext(this, vars, "#AccessibleOrgTree", + "ReportOrderNotShipped"), Utility.getContext(this, vars, "#User_Client", + "ReportOrderNotShipped"), 0); + Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportOrderNotShipped", ""); + xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false)); + comboTableData = null; + + } catch (Exception ex) { + throw new ServletException(ex); + } response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); out.println(xmlDocument.print()); diff -r 8f215938f06a -r b1c45effac4b src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql --- a/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql Tue Apr 24 17:06:29 2012 +0200 +++ b/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql Tue Apr 24 18:16:02 2012 +0200 @@ -23,9 +23,9 @@ <SqlClass name="OrganizationComboData" package="org.openbravo.erpCommon.ad_combos" accessModifier="public"> - <SqlClassComment></SqlClassComment> + <SqlClassComment>This class is obsolete, you should use org.openbravo.erpCommon.utility.ComboTableData</SqlClassComment> <SqlMethod name="select" type="preparedStatement" return="multiple"> - <SqlMethodComment></SqlMethodComment> + <SqlMethodComment>deprecated</SqlMethodComment> <Sql><![CDATA[ SELECT A_O.AD_ORG_ID, A_O.NAME, '' AS ID FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R @@ -40,7 +40,7 @@ <Parameter name="rol"/> </SqlMethod> <SqlMethod name="selectCombo" type="preparedStatement" return="multiple"> - <SqlMethodComment></SqlMethodComment> + <SqlMethodComment>deprecated</SqlMethodComment> <Sql><![CDATA[ SELECT A_O.AD_ORG_ID AS ID, A_O.NAME FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R @@ -56,7 +56,7 @@ </SqlMethod> <SqlMethod name="isRoleOrg" type="preparedStatement" return="Boolean" default="false"> - <SqlMethodComment></SqlMethodComment> + <SqlMethodComment>deprecated</SqlMethodComment> <Sql><![CDATA[ SELECT COUNT(*) AS TOTAL FROM AD_ROLE_ORGACCESS A_R_O, AD_ROLE R diff -r 8f215938f06a -r b1c45effac4b src/org/openbravo/erpCommon/ad_process/PrintInvoices.java --- a/src/org/openbravo/erpCommon/ad_process/PrintInvoices.java Tue Apr 24 17:06:29 2012 +0200 +++ b/src/org/openbravo/erpCommon/ad_process/PrintInvoices.java Tue Apr 24 18:16:02 2012 +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-2010 Openbravo SLU + * All portions are Copyright (C) 2001-2012 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -29,12 +29,13 @@ import org.openbravo.base.secureApp.HttpSecureAppServlet; import org.openbravo.base.secureApp.VariablesSecureApp; import org.openbravo.erpCommon.ad_actionButton.ActionButtonDefaultData; -import org.openbravo.erpCommon.ad_combos.OrganizationComboData; import org.openbravo.erpCommon.businessUtility.WindowTabs; +import org.openbravo.erpCommon.utility.ComboTableData; import org.openbravo.erpCommon.utility.LeftTabsBar; import org.openbravo.erpCommon.utility.NavigationBar; import org.openbravo.erpCommon.utility.OBError; import org.openbravo.erpCommon.utility.ToolBar; +import org.openbravo.erpCommon.utility.Utility; import org.openbravo.xmlEngine.XmlDocument; public class PrintInvoices extends HttpSecureAppServlet { @@ -79,8 +80,18 @@ xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2)); xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n"); xmlDocument.setParameter("paramLanguage", "defaultLang=\"" + vars.getLanguage() + "\";"); - xmlDocument.setData("reportAD_ORGID", "liststructure", - OrganizationComboData.selectCombo(this, vars.getRole())); + + try { + ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "", + "49DC1D6F086945AB82F84C66F5F13F16", Utility.getContext(this, vars, "#AccessibleOrgTree", + "PrintInvoices"), Utility.getContext(this, vars, "#User_Client", "PrintInvoices"), 0); + Utility.fillSQLParameters(this, vars, null, comboTableData, "PrintInvoices", ""); + xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false)); + comboTableData = null; + + } catch (Exception ex) { + throw new ServletException(ex); + } xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat")); xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue("#AD_SqlDateFormat")); ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
