Fixes issue 0012628: When clicking Linked Items in Business Partner window, Accounting Transaction Details show database IDs
authorAdrián Romero <adrianromero@openbravo.com>
Fri, 23 Apr 2010 17:55:02 +0200
changeset 7142 3cef9d762a0c
parent 7141 73e50ed2313e
child 7143 197c00fa1289
Fixes issue 0012628: When clicking Linked Items in Business Partner window, Accounting Transaction Details show database IDs
src-core/src/org/openbravo/data/Parameter.java
src-core/src/org/openbravo/data/Sql.java
src-core/src/org/openbravo/data/Sqlc.java
src-core/src/org/openbravo/data/UtilSql.java
--- a/src-core/src/org/openbravo/data/Parameter.java	Fri Apr 23 17:35:08 2010 +0200
+++ b/src-core/src/org/openbravo/data/Parameter.java	Fri Apr 23 17:55:02 2010 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Copyright (C) 2001-2009 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -23,10 +23,9 @@
   String strText;
   String strIgnoreValue;
   boolean boolOptional = false;
-  String filter;
 
   public Parameter(boolean sequence, String strName, String strDefault, String strInOut,
-      String strOptional, String strAfter, String strText, String strIgnoreValue, String filter) {
+      String strOptional, String strAfter, String strText, String strIgnoreValue) {
     boolSequence = sequence;
     this.strName = strName;
     this.strDefault = strDefault;
@@ -37,7 +36,6 @@
     this.strAfter = strAfter;
     this.strText = strText;
     this.strIgnoreValue = strIgnoreValue;
-    this.filter = filter;
   }
 
 }
--- a/src-core/src/org/openbravo/data/Sql.java	Fri Apr 23 17:35:08 2010 +0200
+++ b/src-core/src/org/openbravo/data/Sql.java	Fri Apr 23 17:55:02 2010 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Copyright (C) 2001-2009 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -41,7 +41,7 @@
   }
 
   public Parameter addParameter(boolean sequence, String strName, String strDefault,
-      String strInOut, String strOptional, String strAfter, String strText, String strIgnoreValue, String filter) {
+      String strInOut, String strOptional, String strAfter, String strText, String strIgnoreValue) {
     if (log4j.isDebugEnabled())
       log4j.debug("addParameter sequence: " + sequence + " name: " + strName);
     if (strOptional != null)
@@ -49,7 +49,7 @@
     if (log4j.isDebugEnabled())
       log4j.debug("previous new Parameter");
     Parameter parameterNew = new Parameter(sequence, strName, strDefault, strInOut, strOptional,
-        strAfter, strText, strIgnoreValue, filter);
+        strAfter, strText, strIgnoreValue);
     if (log4j.isDebugEnabled())
       log4j.debug("called new Parameter");
     for (Enumeration<Parameter> e = vecParameter.elements(); e.hasMoreElements();) {
--- a/src-core/src/org/openbravo/data/Sqlc.java	Fri Apr 23 17:35:08 2010 +0200
+++ b/src-core/src/org/openbravo/data/Sqlc.java	Fri Apr 23 17:55:02 2010 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Copyright (C) 2001-2009 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -456,7 +456,6 @@
       String strAfter = null;
       String strText = null;
       String strIgnoreValue = null;
-      String filter = null;
       final int size = amap.getLength();
       for (int i = 0; i < size; i++) {
         if (amap.getQName(i).equals("name")) {
@@ -473,14 +472,12 @@
           strText = amap.getValue(i);
         } else if (amap.getQName(i).equals("ignoreValue")) {
           strIgnoreValue = amap.getValue(i);
-        } else if (amap.getQName(i).equals("filter")) {
-          filter = amap.getValue(i);
         }
       }
       if (log4j.isDebugEnabled())
         log4j.debug("Configuration: call to addParameter ");
       parameterSql = sql.addParameter(false, strName, strDefault, strInOut, strOptional, strAfter,
-          strText, strIgnoreValue, filter);
+          strText, strIgnoreValue);
     } else if (name.equals("Field")) {
       FieldAdded field = null;
       final int size = amap.getLength();
@@ -500,7 +497,7 @@
         }
       }
       parameterSql = sql
-          .addParameter(true, sql.strSequenceName, null, null, null, null, null, null, null);
+          .addParameter(true, sql.strSequenceName, null, null, null, null, null, null);
     }
   }
 
@@ -898,16 +895,6 @@
     out2.append("  }\n");
   }
 
-  private void appendFilterSQLParameter(Parameter parameter) {
-      if (parameter.filter != null && !parameter.filter.equals("")) {
-        out2.append("  UtilSql.filterSQLParameter(SqlcFilters.get");
-        out2.append(parameter.filter);
-        out2.append(", ");
-        out2.append(parameter.strName);
-        out2.append(");\n");
-      }
-  }
-
   private void printSQLBody() throws IOException {
     // codigo para imprimir trozos de Sql opcionales
     int posSQL = 0;
@@ -932,7 +919,6 @@
               out2.append("    strSql = strSql + ((" + parameter.strName + ".equals(\""
                   + parameter.strName + "\"))?\" " + parameter.strText + " \":\"\");\n");
             } else if (parameter.strInOut.equals("argument")) {
-              appendFilterSQLParameter(parameter);
               out2.append("    strSql = strSql + ((" + parameter.strName + "==null || "
                   + parameter.strName + ".equals(\"\")");
               if (parameter.strIgnoreValue != null) {
@@ -941,7 +927,6 @@
               }
               out2.append(")?\"\":\" " + parameter.strText + "\" + " + parameter.strName + ");\n");
             } else if (parameter.strInOut.equals("replace")) {
-              appendFilterSQLParameter(parameter);
               out2.append("    strSql = strSql + ((" + parameter.strName + "==null || "
                   + parameter.strName + ".equals(\"\")");
               if (parameter.strIgnoreValue != null) {
--- a/src-core/src/org/openbravo/data/UtilSql.java	Fri Apr 23 17:35:08 2010 +0200
+++ b/src-core/src/org/openbravo/data/UtilSql.java	Fri Apr 23 17:55:02 2010 +0200
@@ -17,21 +17,9 @@
 import java.sql.ResultSet;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import javax.servlet.ServletException;
-import org.openbravo.base.filter.RequestFilter;
 
 public class UtilSql {
 
-    public static void filterSQLParameter (String value, String filter) throws ServletException {
-        if (value != null && !value.equals("")) {
-            RequestFilter reqfilter = null;
-            if (!reqfilter.accept(value)) {
-              // log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
-              throw new ServletException("@CODE=@Query parameter error" );
-            }
-        }
-    }
-
   // setValue and getValue method to be used in sqlc
 
   public static boolean setValue(PreparedStatement ps, int posicion, int tipo, String strDefault,