pcrudfilterdialog: suppressFilterFields argument now supported
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Sat, 7 Jan 2012 21:07:26 +0000 (16:07 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Sat, 7 Jan 2012 21:07:26 +0000 (16:07 -0500)
You need this, because otherwise we'll try to do very stupid things like
provide dropdowns for all bib IDs in the system when a class happens to
have a field that links to bre.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/conify/global/booking/resource_type.tt2
Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js

index d4c00ae..3783aa2 100644 (file)
@@ -24,7 +24,6 @@
             suppressEditFields="['record']"
             query="{id: '*'}"
             fmClass='brt'
-            showLoadFilter='true'
             showPaginator='true'
             autoHeight='true'
             editOnEnter='true'>
index 7ceb628..921f977 100644 (file)
@@ -23,6 +23,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             editReadOnly : false,
             suppressFields : null,
             suppressEditFields : null,
+            suppressFilterFields : null,
             hideSelector : false,
             selectorWidth : '1.5',
             showColumnPicker : false,
@@ -120,7 +121,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                                 href : 'javascript:void(0);', 
                                 onclick : function() { 
                                     if (!self.filterDialog) {
-                                        self.filterDialog = new openils.widget.PCrudFilterDialog({fmClass:self.fmClass})
+                                        self.filterDialog = new openils.widget.PCrudFilterDialog({fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields})
                                         self.filterDialog.onApply = function(filter) {
                                             self.resetStore();
                                             self.loadAll(self.cachedQueryOpts, filter);
index c44ca65..8ce549f 100644 (file)
@@ -486,7 +486,21 @@ if(!dojo._hasResource['openils.widget.PCrudFilterDialog']) {
                 this.inherited(arguments);
                 this.initAutoEnv();
                 var realFieldList = this.sortedFieldList.filter(
-                    function(item) { return !(item.virtual || item.nonIdl); });
+                    function(item) { return !(item.virtual || item.nonIdl); }
+                );
+
+                if (dojo.isArray(this.suppressFilterFields)) {
+                    realFieldList = realFieldList.filter(
+                        function(item) {
+                            for (var i = 0; i < self.suppressFilterFields.length; i++) {
+                                if (item.name == self.suppressFilterFields[i])
+                                    return false;
+                            }
+                            return true;
+                        }
+                    );
+                }
+
                 this.fieldStore = new dojo.data.ItemFileReadStore({
                     "data": {
                         "identifier": "name",