Simplified Hold Pull List: Fix broken filters
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 10 Aug 2012 22:14:23 +0000 (18:14 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Thu, 16 Aug 2012 13:25:02 +0000 (09:25 -0400)
Only two filterable fields were available, and at least
one didn't even work.

Now we have a few more, and they seem to all work for me in testing.

This problem was reported to me by Thomas Berezansky.

While we're at it, also make sure the list of shelving locations in that
filter dropdown is sorted alphabetically.  This was Kathy Lussier's
request.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>

Open-ILS/src/templates/circ/hold_pull_list.tt2
Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Open-ILS/web/js/dojo/openils/widget/FlattenerFilterPane.js
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js
Open-ILS/web/js/dojo/openils/widget/PCrudFilterPane.js

index 8355ffe..b468136 100644 (file)
@@ -5,6 +5,10 @@
     dojo.require("openils.widget.OrgUnitFilteringSelect");
     dojo.require("openils.widget.FlattenerGrid");
 
+    /* We're going to supress copy_circ_lib from the actual filter dialog later,
+       but we still want it here so we can use a special widget ot filter on
+       it.  This is the widget that's basically saying, "show me the pull list
+       for /what/ library." */
     var map_extras = {
         "copy_circ_lib": {
             "path": "current_copy.circ_lib",
         fmClass="'ahopl'"
         defaultSort="['copy_location_order_position','call_number_sort_key']"
         mapExtras="map_extras"
+        suppressFilterFields="['copy_circ_lib']"
         sortFieldReMap="{call_number_label:'call_number_sort_key',shelving_loc:'copy_location_order_position'}"
         fetchLock="true"
         query="{}">
         <thead>
             <tr>
                 <th field="shelving_loc" fpath="current_copy.location.name" ffilter="true">Shelving Location</th>
-                <th field="call_number_label" fpath="call_number_label"></th>
-                <th field="author" fpath="current_copy.call_number.record.simple_record.author">Author</th>
-                <th field="title" fpath="current_copy.call_number.record.simple_record.title">Title</th>
-                <th field="barcode" fpath="current_copy.barcode"></th>
+                <th field="call_number_label" fpath="call_number_label" ffilter="true"></th>
+                <th field="author" fpath="current_copy.call_number.record.simple_record.author" ffilter="true">Author</th>
+                <th field="title" fpath="current_copy.call_number.record.simple_record.title" ffilter="true">Title</th>
+                <th field="barcode" fpath="current_copy.barcode" ffilter="true"></th>
                 <th field="parts" fpath="current_copy.parts.label" fsort="false">Parts</th>
                 <th field="notes" fpath="notes.body" fsort="false" _visible="false">Hold Notes</th>
-                <th field="patron_barcode" fpath="usr.card.barcode" _visible="false">Patron Barcode</th>
-                <th field="pickup_lib_name" fpath="pickup_lib.name" _visible="false">Pickup Library</th>
-                <th field="pickup_lib_shortname" fpath="pickup_lib.shortname" _visible="false">Pickup Library (Shortname)</th>
-                <th field="request_lib_name" fpath="request_lib.name" _visible="false">Request Library</th>
-                <th field="request_lib_shortname" fpath="request_lib.shortname" _visible="false">Request Library (Shortname)</th>
-                <th field="selection_ou" fpath="selection_ou.shortname" _visible="false">Selection Locus</th>
-                <th field="sms_carrier_name" fpath="sms_carrier.name" _visible="false">SMS Carrier</th>
+                <th field="patron_barcode" fpath="usr.card.barcode" _visible="false" ffilter="true">Patron Barcode</th>
+                <th field="pickup_lib_name" fpath="pickup_lib.name" _visible="false" ffilter="true">Pickup Library</th>
+                <th field="pickup_lib_shortname" fpath="pickup_lib.shortname" _visible="false" ffilter="true">Pickup Library (Shortname)</th>
+                <th field="request_lib_name" fpath="request_lib.name" _visible="false" ffilter="true">Request Library</th>
+                <th field="request_lib_shortname" fpath="request_lib.shortname" _visible="false" ffilter="true">Request Library (Shortname)</th>
+                <th field="selection_ou" fpath="selection_ou.shortname" _visible="false" ffilter="true">Selection Locus</th>
+                <th field="sms_carrier_name" fpath="sms_carrier.name" _visible="false" ffilter="true">SMS Carrier</th>
             </tr>
         </thead>
     </table>
index 50d1a4f..6e4c88f 100644 (file)
@@ -557,9 +557,17 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                         oncomplete(openils.Util.readResponse(r, false, true));
                     };
 
+                    /* XXX LFW: I want to uncomment the following three lines that refer to ob, but haven't had the time to properly test. */
+
+                    //var ob = {};
+                    //ob[linkClass] = vfield.selector || vfield.name;
+
                     this.searchOptions = dojo.mixin(
-                        {async : !this.forceSync, oncomplete : _cb},
-                        this.searchOptions
+                        {
+                            async : !this.forceSync,
+                            oncomplete : _cb
+                            //order_by : ob
+                        }, this.searchOptions
                     );
 
                     if (this.searchFilter) {
@@ -705,6 +713,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             var self = this;
             new openils.PermaCrud().search('acpl', {owning_lib : orgs}, {
                 async : !this.forceSync,
+                order_by : {"acpl": "name"},
                 oncomplete : function(r) {
                     var list = openils.Util.readResponse(r, false, true);
                     if(!list) return;
index 5b74a99..23e7384 100644 (file)
@@ -24,7 +24,7 @@ if (!dojo._hasResource["openils.widget.FlattenerFilterPane"]) {
                         if (self.suppressFilterFields &&
                             dojo.indexOf(
                                 self.suppressFilterFields, o.simple_name
-                            ) >= -1
+                            ) > -1
                         ) {
                             return false;
                         }
index 9a350c5..03166da 100644 (file)
@@ -46,6 +46,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
             "editStyle": "dialog",      /* "dialog" or "pane" */
             "requiredFields": null,     /* affects create/edit dialogs */
             "suppressEditFields": null, /* affects create/edit dialogs */
+            "suppressFilterFields": null, /* affects filter dialog */
 
             /* _generateMap() lives to interpret the attributes of the
              * FlattenerGrid dijit itself plus those definined in
@@ -495,7 +496,8 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                             "useDiv": this.filterAlwaysInDiv,
                             "compact": true,
                             "initializers": this.filterInitializers,
-                            "widgetBuilders": this.filterWidgetBuilders
+                            "widgetBuilders": this.filterWidgetBuilders,
+                            "suppressFilterFields": this.suppressFilterFields
                         });
 
                     this.filterUi.onApply = dojo.hitch(
index 5a88701..205deb4 100644 (file)
@@ -147,6 +147,8 @@ if (!dojo._hasResource['openils.widget.PCrudFilterPane']) {
      * the right place. */
     function _clause_was_negative(clause) {
         /* clause objects really only ever have one property */
+        if (clause === null) return false; /* early out for special operator */
+
         var ops = openils.Util.objectProperties(clause);
         var op = ops.pop();
         var matches = op.match(/^not (\w+)$/);
@@ -474,7 +476,7 @@ if (!dojo._hasResource['openils.widget.PCrudFilterPane']) {
             }
         };
 
-        /* for ugly special cases in compliation */
+        /* for ugly special cases in compilation */
         this._null_clause = function() {
             var opname = this.get_selected_operator_name();
             if (opname == "not null")
@@ -593,6 +595,7 @@ if (!dojo._hasResource['openils.widget.PCrudFilterPane']) {
             "initializers": null,
             "compact": false,
             "widgetBuilders": null,
+            "suppressFilterFields": null,
 
             "constructor": function(args) {
                 for(var k in args)