lp1436987: Patron search parameters not retained user/vlewis/lp1436987-patron-search-parameters-not-retained
authorVictoria Lewis <vlewis@catalystitservices.com>
Mon, 7 Dec 2015 18:28:13 +0000 (10:28 -0800)
committerVictoria Lewis <vlewis@catalystitservices.com>
Fri, 11 Dec 2015 19:58:58 +0000 (11:58 -0800)
This patch ensures that OU and Profile Group parameters are retained.

To test the fix for this bug
   [1] Search for a patron using the expanded patron search fields.
   [2] Open a record and click "Patron Search" to return to the
       search form.

Signed-off-by: Victoria Lewis <vlewis@catalystitservices.com>
modified:   Open-ILS/src/templates/staff/circ/patron/t_search.tt2
modified:   Open-ILS/web/js/ui/default/staff/circ/patron/app.js

Open-ILS/src/templates/staff/circ/patron/t_search.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 9304b33..3a4a640 100644 (file)
 
             <div class="btn-group patron-search-selector" dropdown>
               <button type="button" class="btn btn-default dropdown-toggle">
-                <span style="padding-right: 5px;">{{searchArgs.profile.name() || "[% l('Profile Group') %]"}}</span>
+                <span style="padding-right: 5px;">{{searchArgs.profile.name() || searchArgs.profile || "[% l('Profile Group') %]"}}</span> 
                 <span class="caret"></span>
               </button>
               <ul class="dropdown-menu">
index d5fb95d..34a0b05 100644 (file)
@@ -792,6 +792,7 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
 
     var propagate;
     if (patronSvc.lastSearch) {
+        patronSvc.lastSearch.search.home_ou = {value :patronSvc.lastSearch.home_ou, group : 0};
         propagate = patronSvc.lastSearch.search;
     } else if (patronSvc.urlSearch) {
         propagate = patronSvc.urlSearch.search;
@@ -814,7 +815,7 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
         // populate the search form with our cached / preexisting search info
         angular.forEach(propagate, function(val, key) {
             if (key == 'profile')
-                val.value = $scope.profiles.filter(function(p) { p.id() == val.value })[0];
+                $scope.profiles.filter(function(p) {if(p.id() == (val.value)) val.value = p.name()})[0];
             if (key == 'home_ou')
                 val.value = egCore.org.get(val.value);
             $scope.searchArgs[key] = val.value;
@@ -960,7 +961,9 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
         angular.forEach(args, function(val, key) {
             if (!val) return;
             if (key == 'profile' && args.profile) {
-                search.profile = {value : args.profile.id(), group : 0};
+                if(args.profile.a){
+                  search.profile = {value : args.profile.id(), group : 0};
+                }
             } else if (key == 'home_ou' && args.home_ou) {
                 search.home_ou = args.home_ou.id(); // passed separately
             } else if (key == 'inactive') {