From: Bill Erickson Date: Thu, 9 Nov 2017 15:46:50 +0000 (-0500) Subject: LP#1723498 Patron reg/edit dupe search repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d21dcaedc2adacf4c8d4084f70f0cd1589c7d718;p=evergreen%2Fpines.git 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 --- 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 73fca5b5ff..f4a744561d 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 3a8e46063b..2a02c74156 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': @@ -1640,15 +1642,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] = ''; } }); } @@ -1723,7 +1729,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':