From 6508665f0d14c9a51d7929e50a4089084ae63ed1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 9 Nov 2017 10:46:50 -0500 Subject: [PATCH] LP#1723498 Patron reg/edit dupe search repairs Avoid clobbering duplicate patron search links by managing search URLs individually by search type and displaying a search link per search type. This change includes an improvement over the XUL version in that a link will be displayed per matching phone number so each can be searched, instead of only searching the most recently entered phone number. Signed-off-by: Bill Erickson Signed-off-by: Terra McCanna Signed-off-by: Galen Charlton --- .../src/templates/staff/circ/patron/t_edit.tt2 | 24 ++++++++++++++++------ .../web/js/ui/default/staff/circ/patron/regctl.js | 12 ++++++++--- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index ce8da85675..ce365abe5a 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -25,31 +25,43 @@ [%# dupe_search_encoded is uri escaped in the JS %] -
+ + + diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index adf5c7148d..b80e307f88 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -553,6 +553,8 @@ angular.module('egCoreMod') console.log('Dupe search called with "'+ type +'" and value '+ value); + if (type.match(/phone/)) type = 'phone'; // day_phone, etc. + switch (type) { case 'name': @@ -1646,15 +1648,19 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , } $scope.dupe_value_changed = function(type, value) { + if (!$scope.dupe_search_encoded) + $scope.dupe_search_encoded = {}; + $scope.dupe_counts[type] = 0; + patronRegSvc.dupe_patron_search($scope.patron, type, value) .then(function(res) { $scope.dupe_counts[type] = res.count; if (res.count) { - $scope.dupe_search_encoded = + $scope.dupe_search_encoded[type] = encodeURIComponent(js2JSON(res.search)); } else { - $scope.dupe_search_encoded = ''; + $scope.dupe_search_encoded[type] = ''; } }); } @@ -1729,7 +1735,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , } case 'evening_phone' : case 'other_phone' : - $scope.dupe_value_changed('phone', value); + $scope.dupe_value_changed(field_name, value); break; case 'ident_value': -- 2.11.0