Apply patch to add a patron profile filter to the "Search for Patrons" UI
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 13 Mar 2011 22:02:19 +0000 (22:02 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 13 Mar 2011 22:02:19 +0000 (22:02 +0000)
Thanks to Michael Peters <mrpeters@library.in.gov> and
Thomas Berezansky <tsbere@mvlc.org> for their work on this additional
functionality to the patron search UI, supplied as a patch in LP# 715837.

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

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/patron/search_form.js
Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul
Open-ILS/xul/staff_client/server/patron/search_result.js

index 07e5404..d22cfd1 100644 (file)
 <!ENTITY staff.patron_search_form.phone.label 'Phone:'>
 <!ENTITY staff.patron_search_form.post_code.accesskey ''>
 <!ENTITY staff.patron_search_form.post_code.label 'ZIP:'>
+<!ENTITY staff.patron_search_form.profile.accesskey ''>
+<!ENTITY staff.patron_search_form.profile.label 'Filter by Permission Profile:'>
 <!ENTITY staff.patron_search_form.search.accesskey 'S'>
 <!ENTITY staff.patron_search_form.search.label 'Search'>
 <!ENTITY staff.patron_search_form.second_given_name.accesskey ''>
index 2426200..b472252 100644 (file)
@@ -232,6 +232,10 @@ patron.search_form.prototype = {
                             };
                         }
                     ],
+                    'profile' : [ ['render'],function(e) {
+                            return function() {};
+                        } 
+                    ],
                     'inactive' : [ ['render'], function(e) { 
                             return function() {}; 
                         } 
@@ -295,6 +299,14 @@ patron.search_form.prototype = {
         );
         cb.checked = cb.getAttribute('value') == "true" ? true : false;
 
+        var menupopup = document.getElementById('profile').firstChild;
+        for (var i = 0; i < obj.OpenILS.data.list.pgt.length; i++) { 
+            var my_pgt = obj.OpenILS.data.list.pgt[i]; 
+            var menuitem = document.createElement('menuitem'); 
+            menuitem.setAttribute('label',my_pgt.name()); 
+            menuitem.setAttribute('value',my_pgt.id());
+            menupopup.appendChild(menuitem); 
+        };
     },
 
     'on_submit' : function(q) {
@@ -313,6 +325,9 @@ patron.search_form.prototype = {
                 if (id == 'inactive') {
                     query[id] = node.getAttribute('value');
                     obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + node.getAttribute('value') + '\n');
+                } else if (id == 'profile') {
+                    query[id] = node.selectedItem.getAttribute('value');
+                    obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + node.getAttribute('value') + '\n');
                 } else {
                     if (id == 'search_depth') {
                         query[id] = node.firstChild.getAttribute('value'); 
@@ -331,7 +346,7 @@ patron.search_form.prototype = {
                             obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + value + '\n');
                         }
                     }
-                }
+                } 
             }
         }
         if (typeof obj.on_submit == 'function') {
index 58f54d0..ad71b41 100644 (file)
                 accesskey="&staff.patron_search_form.post_code.accesskey;"/>
             <textbox id="post_code" group="1" context="clipboard"/>
         </row>
+        <vbox flex="1" style="overflow: auto">
+            <groupbox flex="1">
+                <caption label="&staff.patron_search_form.profile.label;" />
+                <menulist id="profile">
+                    <menupopup>
+                        <menuitem label="" value=""/>
+                    </menupopup>
+                </menulist>
+            </groupbox>
+        </vbox>
         <row id="psr12">
             <spacer id="pss12"/>
             <button id="search" label="&staff.patron_search_form.search.label;" 
index d313cbb..fadbb68 100644 (file)
@@ -187,7 +187,7 @@ patron.search_result.prototype = {
                     obj.search_term_count++;
                 break;
 
-                case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname':
+                case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname': case 'profile':
 
                     search_hash[ i ] = {};
                     search_hash[ i ].value = query[i];