details:   http://code.openbravo.com/erp/devel/pi/rev/c7de31e1031d
changeset: 3869:c7de31e1031d
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu May 14 08:16:05 2009 +0200
summary:   reformat

details:   http://code.openbravo.com/erp/devel/pi/rev/9859ac217a3f
changeset: 3870:9859ac217a3f
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu May 14 08:18:39 2009 +0200
summary:   issue 0008972: Not possible to use attribute as a filter field
fixed attribute set instance reference for filters

diffstat:

 src/org/openbravo/erpCommon/businessUtility/Buscador.java   |  51 
+++++++++--------
 src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java |  10 ++-
 2 files changed, 35 insertions(+), 26 deletions(-)

diffs (157 lines):

diff --git a/src/org/openbravo/erpCommon/businessUtility/Buscador.java 
b/src/org/openbravo/erpCommon/businessUtility/Buscador.java
--- a/src/org/openbravo/erpCommon/businessUtility/Buscador.java
+++ b/src/org/openbravo/erpCommon/businessUtility/Buscador.java
@@ -20,8 +20,8 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Random;
 import java.util.Vector;
-import java.util.Random;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -471,8 +471,8 @@
           strHtml.append("checked");
         strHtml.append("></input></span>\n");
       } else if (fields[i].reference.equals("30") || 
fields[i].reference.equals("21")
-          || fields[i].reference.equals("31") || 
fields[i].reference.equals("35")
-          || fields[i].reference.equals("25") || 
fields[i].reference.equals("800011")) { // Search
+          || fields[i].reference.equals("31") || 
fields[i].reference.equals("25")
+          || fields[i].reference.equals("800011")) { // Search
         strHtml.append("<td class=\"TextBox_btn_ContentCell\" 
colspan=\"3\">\n");
         strHtml.append("<table border=\"0\" cellspacing=\"0\" 
cellpadding=\"0\" summary=\"\">\n");
         scriptSearch = true;
@@ -557,11 +557,13 @@
         strHtml.append("value=\"").append(fields[i].value).append("\" ");
         if (Utility.isDecimalNumber(fields[i].reference))
           strHtml
-              
.append("onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, true, 
true, event);return true;\" ")
+              .append(
+                  
"onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, true, true, 
event);return true;\" ")
               .append("id=\"").append(randomId4Num1).append("\" ");
         else if (Utility.isIntegerNumber(fields[i].reference))
           strHtml
-              
.append("onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, false, 
false, event);return true;\" ")
+              .append(
+                  
"onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, false, false, 
event);return true;\" ")
               .append("id=\"").append(randomId4Num1).append("\" ");
         strHtml.append(">");
         if (Utility.isDecimalNumber(fields[i].reference)
@@ -584,10 +586,10 @@
                   "<img alt=\"Calculator\" class=\"FieldButton_Icon 
FieldButton_Icon_Calc\" title=\"Calculator\" src=\"")
               .append(strReplaceWith).append("/images/blank.gif\" 
border=\"0\"></img>\n");
           
strHtml.append("</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n</a>\n");
-          strHtml
-              .append("<span class=\"invalid\" style=\"display: none;\" 
id=\"").append(randomId4Num1).append("invalidSpan\">* The value entered is not 
valid.</span>");
-          strHtml
-              .append("<span class=\"missing\" style=\"display: none;\" 
id=\"").append(randomId4Num1).append("missingSpan\">* This value is 
required.</span>");
+          strHtml.append("<span class=\"invalid\" style=\"display: none;\" 
id=\"").append(
+              randomId4Num1).append("invalidSpan\">* The value entered is not 
valid.</span>");
+          strHtml.append("<span class=\"missing\" style=\"display: none;\" 
id=\"").append(
+              randomId4Num1).append("missingSpan\">* This value is 
required.</span>");
           strHtml
               .append("<span class=\"range\" style=\"display: none;\">* This 
value is out of range.</span>");
           strHtml.append("</td>");
@@ -628,7 +630,8 @@
           strHtml.append("id=\"").append(randomId4Num2).append("\" ");
         } else if (Utility.isIntegerNumber(fields[i].reference)) {
           scriptCalculator = true;
-          strHtml.append("onkeydown=\"autoCompleteNumber(this, false, false, 
event);return true;\" ");
+          strHtml
+              .append("onkeydown=\"autoCompleteNumber(this, false, false, 
event);return true;\" ");
           strHtml.append("id=\"").append(randomId4Num2).append("\" ");
         }
         strHtml.append(">");
@@ -659,11 +662,13 @@
           strHtml.append("value=\"").append(value).append("\" ");
           if (Utility.isDecimalNumber(fields[i].reference))
             strHtml
-                
.append("onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, true, 
true, event);return true;\" ")
+                .append(
+                    
"onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, true, true, 
event);return true;\" ")
                 .append("id=\"").append(randomId4Num3).append("\" ");
           else if (Utility.isIntegerNumber(fields[i].reference))
             strHtml
-                
.append("onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, false, 
false, event);return true;\" ")
+                .append(
+                    
"onkeydown=\"validateNumberBox(this.id);autoCompleteNumber(this, false, false, 
event);return true;\" ")
                 .append("id=\"").append(randomId4Num3).append("\" ");
           strHtml.append(">");
 
@@ -682,10 +687,10 @@
                   "<img alt=\"Calculator\" class=\"FieldButton_Icon 
FieldButton_Icon_Calc\" title=\"Calculator\" src=\"")
               .append(strReplaceWith).append("/images/blank.gif\" 
border=\"0\"></img>\n");
           strHtml.append("</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n");
-          strHtml
-              .append("<span class=\"invalid\" style=\"display: none;\" 
id=\"").append(randomId4Num3).append("invalidSpan\">* The value entered is not 
valid.</span>");
-          strHtml
-              .append("<span class=\"missing\" style=\"display: none;\" 
id=\"").append(randomId4Num3).append("missingSpan\">* This value is 
required.</span>");
+          strHtml.append("<span class=\"invalid\" style=\"display: none;\" 
id=\"").append(
+              randomId4Num3).append("invalidSpan\">* The value entered is not 
valid.</span>");
+          strHtml.append("<span class=\"missing\" style=\"display: none;\" 
id=\"").append(
+              randomId4Num3).append("missingSpan\">* This value is 
required.</span>");
           strHtml
               .append("<span class=\"range\" style=\"display: none;\">* This 
value is out of range.</span>");
           strHtml.append("</td>");
@@ -750,16 +755,16 @@
       // strHtml.append("</td></tr></table>\n");
       strHtml.append("</td></tr>\n");
     }
-    //vecKeys.addElement("new keyArrayItem(\"B\", \"aceptar()\", null, 
\"ctrlKey\")");
-    //vecKeys.addElement("new keyArrayItem(\"ESCAPE\", \"window.close()\", 
null, null)");
+    // vecKeys.addElement("new keyArrayItem(\"B\", \"aceptar()\", null, 
\"ctrlKey\")");
+    // vecKeys.addElement("new keyArrayItem(\"ESCAPE\", \"window.close()\", 
null, null)");
     script.append("\nfunction enableLocalShortcuts() {\n");
     if (vecKeys.size() > 0) {
-      //script.append("var keyArray = new Array();\n");
+      // script.append("var keyArray = new Array();\n");
       for (int i = 0; i < vecKeys.size(); i++) {
         script.append("  keyArray[keyArray.length] = 
").append(vecKeys.elementAt(i).toString())
             .append(";\n");
       }
-      //script.append("enableShortcuts();\n");
+      // script.append("enableShortcuts();\n");
     } else {
       script.append("\n");
     }
@@ -785,10 +790,8 @@
           "/js/default/DateTextBox.js\" type=\"text/javascript\"></script>");
     }
     if (scriptCalculator) {
-      scrScr
-          .append("<script language=\"JavaScript\" src=\"")
-          .append(strReplaceWith)
-          .append("/js/default/ValidationNumberBox.js\" 
type=\"text/javascript\"></script>");
+      scrScr.append("<script language=\"JavaScript\" 
src=\"").append(strReplaceWith).append(
+          "/js/default/ValidationNumberBox.js\" 
type=\"text/javascript\"></script>");
       scrScr.append("<script language=\"JavaScript\" 
src=\"").append(strReplaceWith).append(
           "/js/calculator.js\" type=\"text/javascript\"></script>");
     }
diff --git a/src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java 
b/src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java
--- a/src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java
+++ b/src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java
@@ -132,8 +132,9 @@
         if (!aux.equals("")) {
           if (!aux.equals("%")
               || (!prop.getProperty("AD_Reference_ID").equals("10")
-                  && !prop.getProperty("AD_Reference_ID").equals("14") && 
!prop.getProperty(
-                  "AD_Reference_ID").equals("34"))) {
+                  && !prop.getProperty("AD_Reference_ID").equals("14")
+                  && !prop.getProperty("AD_Reference_ID").equals("34") || 
!prop.getProperty(
+                  "AD_Reference_ID").equals("35"))) {
             filter.addElement(formatFilter(tableSQL.getTableName(), 
prop.getProperty("ColumnName"),
                 prop.getProperty("AD_Reference_ID"), true));
             filterParams.addElement("Param" + prop.getProperty("ColumnName"));
@@ -241,6 +242,11 @@
       text.append(aux).append("(");
       text.append(tablename).append(".").append(columnname).append(") LIKE ");
       text.append(aux).append("(?)");
+    } else if (reference.equals("35")) {
+      text
+          .append(
+              "(SELECT UPPER(DESCRIPTION) FROM M_ATTRIBUTESETINSTANCE WHERE 
M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID = ")
+          .append(tablename).append(".").append(columnname).append(") LIKE 
C_IGNORE_ACCENT(?)");
     } else {
       text.append(tablename).append(".").append(columnname).append(" = ?");
     }

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to