details: /erp/erp/devel/main/rev/4cbeb2ff7ed3 changeset: 4818:4cbeb2ff7ed3 user: Iván Perdomo <ivan.perdomo <at> openbravo.com> date: Fri Aug 21 12:17:03 2009 +0200 summary: Fixes cyclone merge reintegration
details: /erp/erp/devel/main/rev/d6c627e21222 changeset: 4819:d6c627e21222 user: Iván Perdomo <ivan.perdomo <at> openbravo.com> date: Fri Aug 21 12:57:46 2009 +0200 summary: Reapply changset ff1b6f04b442 diffstat: src-core/src/org/openbravo/base/VariablesBase.java | 79 +++++++++++++++++++- src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java | 2 +- 2 files changed, 79 insertions(+), 2 deletions(-) diffs (115 lines): diff -r 879929fa5af6 -r d6c627e21222 src-core/src/org/openbravo/base/VariablesBase.java --- a/src-core/src/org/openbravo/base/VariablesBase.java Fri Aug 21 10:27:31 2009 +0200 +++ b/src-core/src/org/openbravo/base/VariablesBase.java Fri Aug 21 12:57:46 2009 +0200 @@ -678,7 +678,8 @@ if (!NumberFilter.instance.accept(newValue)) { log4j.error("Input: " + parameter + " not accepted by filter: " + NumberFilter.instance); - throw new ServletException("Input: " + parameter + " is not an accepted input"); + throw new ServletException("Input: " + parameter + " with value " + newValue + + " is not an accepted input"); } return newValue; @@ -1125,6 +1126,35 @@ } /** + * Checks if a certain parameter is defined in the variables base. + * + * @param parameter + * the parameter to check + * @return true if a value is present, false otherwise + */ + public boolean hasParameter(String parameter) { + Object value; + try { + if (isMultipart) { + value = getMultiParameters(parameter); + } else { + value = httpRequest.getParameterValues(parameter); + } + } catch (Exception e) { + return false; + } + return value != null; + } + + /** + * @return the parameter names of the request object + */ + @SuppressWarnings("unchecked") + public Enumeration<String> getParameterNames() { + return httpRequest.getParameterNames(); + } + + /** * Retrieves the set of string values for the parameter with the specified name as passed to the * servlet by the HTTP POST method. String returned is in the form ('value1', 'value2',...) and * can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main @@ -1216,6 +1246,53 @@ } /** + * Retrieves the set of string values for the parameter with the specified name as passed to the + * servlet by the HTTP POST/GET method. The parameter must be a multi-valued parameter. If the + * parameter is not set then a String[0] is returned. + * + * @param parameter + * Name of the parameter to be retrieved + * @param required + * If true, an exception is thrown if the parameter is not among the data submitted to + * the servlet. + * @param requestFilter + * filter used to validate the input against list of allowed inputs + * @return returns a String array with the values present in the request, if the parameter has no + * value then String[0] is returned. + * @throws ServletException + */ + public String[] getMultiValueStringParameter(String parameter, boolean required, + RequestFilter requestFilter) throws ServletException { + String[] auxStr = null; + try { + if (isMultipart) + auxStr = getMultiParameters(parameter); + else + auxStr = httpRequest.getParameterValues(parameter); + } catch (Exception e) { + if (!(required)) { + return new String[0]; + } + } + + if (auxStr == null || auxStr.length == 0) { + if (required) { + throw new ServletException("Request IN parameter required: " + parameter); + } else { + return new String[0]; + } + } + + auxStr = FormatUtilities.sanitizeInput(auxStr); + filterRequest(requestFilter, auxStr); + + if (log4j.isDebugEnabled()) + log4j.debug("Request IN parameter: " + parameter + ":..." + auxStr.toString()); + + return auxStr; + } + + /** * Retrieve a value specified by the sessionAttribute parameter from the session variables. If not * found, an empty string is returned. * diff -r 879929fa5af6 -r d6c627e21222 src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java --- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Fri Aug 21 10:27:31 2009 +0200 +++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Fri Aug 21 12:57:46 2009 +0200 @@ -159,7 +159,7 @@ : strPriceStd.replace("\"", "")), strQty, dataOrder[0].mPricelistId, dataOrder[0].id); priceActual = new BigDecimal(strPriceActual); - resultado.append("new Array(\"inppriceactual\", \"" + strPriceActual + "\"),"); + resultado.append("new Array(\"inppriceactual\", " + strPriceActual + "),"); } } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits