From 56cc18b6632360b83b8e377d4d33cf015f8bf5a5 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Sat, 23 Apr 2016 19:12:27 -0700 Subject: [PATCH] LP#1576435: Force "Include inactive patrons?" on patron reg duplicate search In the XUL client, duplicate patron checking in the patron registration interface now includes inactive patrons (see LP#1217052). However, if you click on the link "Found X patron(s) with the same name," the resulting patron search does not always include inactive patrons by default (instead, the value of the "Include inactive patrons?" checkbox is cached from your last patron search, as usual). To prevent user confusion in this scenario, this commit forces the linked patron search in the XUL client to always include inactive patrons. Signed-off-by: Jeff Davis Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/actor/user/register.js | 1 + .../xul/staff_client/server/patron/search_form.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index b48946f6dc..0927179f9f 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1884,6 +1884,7 @@ function uEditDupeSearch(type, value) { openils.Util.show(link); link.onclick = function() { search.search_sort = js2JSON(["penalties", "family_name", "first_given_name"]); + search.include_inactive = "true"; if(window.xulG) window.xulG.spawn_search(search); else diff --git a/Open-ILS/xul/staff_client/server/patron/search_form.js b/Open-ILS/xul/staff_client/server/patron/search_form.js index e62efa0913..000e70006c 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_form.js +++ b/Open-ILS/xul/staff_client/server/patron/search_form.js @@ -23,6 +23,8 @@ patron.search_form.prototype = { null : JSON2js( params.query.search_sort ); // Let's assume this is encoded as JSON + obj.include_inactive = (typeof params.query.include_inactive !== 'undefined') ? params.query.include_inactive : null; + JSAN.use('OpenILS.data'); this.OpenILS = {}; obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'}); @@ -295,12 +297,16 @@ patron.search_form.prototype = { var cb = obj.controller.view.inactive; obj.event_listeners.add(cb, 'command',function() { + obj.include_inactive = null; cb.setAttribute('value',cb.checked ? "true" : "false"); var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned); util.widgets.save_attributes(file, { 'search_depth_ml' : [ 'value' ], 'inactive' : [ 'value' ] }); }, false ); - cb.checked = cb.getAttribute('value') == "true" ? true : false; + if (obj.include_inactive !== null) + cb.checked = obj.include_inactive == "true" ? true : false; + else + cb.checked = cb.getAttribute('value') == "true" ? true : false; /* Populate the Patron Profile filter, if it exists */ if (obj.controller.view.profile) { @@ -355,6 +361,9 @@ patron.search_form.prototype = { if (node && node.value != '') { if (id == 'inactive') { query[id] = node.getAttribute('value'); + // always include inactive when include_inactive is true + if (obj.include_inactive !== null) + query[id] = obj.include_inactive; obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + node.getAttribute('value') + '\n'); } else if (id == 'profile') { query[id] = node.firstChild.getAttribute('value'); -- 2.43.2