LP#1706124: Make include inactive patrons checkbox sticky user/dyrcona/lp1706124-sticky-include-inactive-patrons-checkbox-signoff
authorKathy Lussier <klussier@masslnc.org>
Wed, 13 Sep 2017 17:07:29 +0000 (13:07 -0400)
committerJason Stephenson <jason@sigio.com>
Tue, 19 Sep 2017 21:09:32 +0000 (17:09 -0400)
The state of the 'include inactive' checkbox on the patron search page will now
be remembered when users return to the page. Many thanks to Cesar Velez,
whose code for bug 1697754 inspired this patch!

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
Open-ILS/web/js/ui/default/staff/services/patron_search.js

index 816076c..d84a2f8 100644 (file)
         <div class="col-md-2">
           <div class="checkbox">
             <label>
-              <input type="checkbox" ng-model="searchArgs.inactive"/>
+              <input type="checkbox" ng-model="searchArgs.inactive" ng-change="onSearchInactiveChanged()"/>
               [% l('Include Inactive?') %]
             </label>
           </div>
index c27274f..7897671 100644 (file)
@@ -745,7 +745,17 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
     egCore.hatch.getItem('eg.circ.patron.search.show_extras')
     .then(function(val) {$scope.showExtras = val});
 
-    // map form arguments into search params
+// check searchArgs.inactive setting
+    egCore.hatch.getItem('searchArgs.inactive')
+                .then(function(searchInactive){
+                    if (searchInactive) $scope.searchArgs.inactive = searchInactive; 
+                });    
+
+     $scope.onSearchInactiveChanged = function(){
+        egCore.hatch.setItem('searchArgs.inactive', $scope.searchArgs.inactive);
+    }
+
+// map form arguments into search params
     function compileSearch(args) {
         var search = {};
         angular.forEach(args, function(val, key) {