Acq: fix unified search for not-null boolean fields
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 20 May 2010 15:47:55 +0000 (15:47 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 20 May 2010 15:47:55 +0000 (15:47 +0000)
The unified search UI produces a checkbox for these fields, but it did not
build a search query from checkboxes correctly.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16464 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/search/unified.js

index f576939..d62ea44 100644 (file)
@@ -148,8 +148,12 @@ function TermSelectorFactory(terms) {
                 }).build(
                     function(w) {
                         wStore[widgetKey] = w;
-                        if (typeof(value) != "undefined")
-                            w.attr("value", value);
+                        if (typeof(value) != "undefined") {
+                            if (w.declaredClass.match(/Check/))
+                                w.attr("checked", value == "t");
+                            else
+                                w.attr("value", value);
+                        }
                         if (!noFocus)
                             w.focus();
                         if (typeof(callback) == "function")
@@ -511,6 +515,8 @@ function TermManager() {
                             split("T")[0];
                 } else {
                     value = this.widgets[id].attr("value");
+                    if (this.widgets[id].declaredClass.match(/Check/))
+                        value = (value == "on") ? "t" : "f";
                 }
             } else {
                 value = this.widgets[id].value;
@@ -548,7 +554,7 @@ function TermManager() {
             if (!sso[attr]) sso[attr] = [];
             var  value = (
                 typeof(widget.attr) == "function" ?
-                    widget.attr("value") : widget.value
+                    widget.getFormattedValue() : widget.value
             );
             if (typeof(value) != "string")
                 value = value.join(" || ");