From 55a82b570ee8562f3d9eaedad42f22d15b1b8205 Mon Sep 17 00:00:00 2001
From: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Date: Wed, 20 Jun 2012 11:13:11 -0400
Subject: [PATCH] Acq: fix widget choice for user-linked fields in Acquisitions
 Search

The Acquisitions Search interface (which also sits underneath the
Purchase Orders inteface, My Selection Lists, and one or two others)
stopped presenting the correct widget for search terms linked to
actor.usr.  This was brought on when PCRUD control was added to
actor.usr, so that means the bug affects only master, not rel_2_2 or
earlier.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
---
 Open-ILS/web/js/ui/default/acq/search/unified.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js
index 02e1d681b5..68fb3bb25a 100644
--- a/Open-ILS/web/js/ui/default/acq/search/unified.js
+++ b/Open-ILS/web/js/ui/default/acq/search/unified.js
@@ -128,6 +128,8 @@ function TermSelectorFactory(terms) {
         ) {
             var term = this.getTerm();
             var widgetKey = this.uniq;
+            var target = termManager.getLinkTarget(term);
+
             if (matchHow.getValue() == "__in") {
                 new openils.widget.XULTermLoader({
                     "parentNode": parentNode
@@ -147,7 +149,9 @@ function TermSelectorFactory(terms) {
                     }
                 );
             } else if (term.hint == "acqlia" ||
-                (term.hint == "jub" && term.field == "eg_bib_id")) {
+                (term.hint == "jub" && term.field == "eg_bib_id") ||
+                term.datatype == "org_unit" ||
+                (term.datatype == "link" && target == "au")) {
                 /* The test for jub.eg_bib_id is a special case to prevent
                  * AutoFieldWidget from trying to render a ridiculous dropdown
                  * of every bib record ID in the system. */
-- 
2.11.0