Acq: POs can only be created with active providers (vendors)
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 16 Feb 2010 15:11:37 +0000 (15:11 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 16 Feb 2010 15:11:37 +0000 (15:11 +0000)
Added a new feature to AutoFieldWidget to make this as simple: there's now
a searchFilter option that you can give to the constructor, enabling you
to constrain the set of objects that you'll get back for, say, a
FilteringSelect widget.

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

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Open-ILS/web/js/ui/default/acq/common/li_table.js

index afde4b5..b895e38 100644 (file)
@@ -385,13 +385,18 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 oncomplete();
 
             } else {
-                new openils.PermaCrud().retrieveAll(linkClass, {   
-                    async : !this.forceSync,
-                    oncomplete : function(r) {
-                        var list = openils.Util.readResponse(r, false, true);
-                        oncomplete(list);
-                    }
-                });
+                var _cb = function(r) {
+                    oncomplete(openils.Util.readResponse(r, false, true));
+                };
+                if (this.searchFilter) {
+                    new openils.PermaCrud().search(linkClass, this.searchFilter, {
+                        async : !this.forceSync, oncomplete : _cb
+                    });
+                } else {
+                    new openils.PermaCrud().retrieveAll(linkClass, {
+                        async : !this.forceSync, oncomplete : _cb
+                    });
+                }
             }
 
             return true;
index bed0e8f..b605fec 100644 (file)
@@ -973,6 +973,7 @@ function AcqLiTable() {
                     var widget = new openils.widget.AutoFieldWidget({
                         fmField : 'provider',
                         fmClass : 'acqpo',
+                        searchFilter: {"active": "t"},
                         parentNode : dojo.byId('acq-lit-po-provider'),
                     });
                     widget.build(