LP#172113 - Patron Search Form Reset Enhancement user/stompro/lp1721131_patron_search_reset
authorJosh Stompro <stompro@stompro.org>
Fri, 28 Feb 2020 16:36:22 +0000 (10:36 -0600)
committerJosh Stompro <stompro@stompro.org>
Fri, 28 Feb 2020 16:36:22 +0000 (10:36 -0600)
The patron search "Clear Form" button clears the value
from the Home Library selector and sets it to undefined.

This can cause some strange results for subsequent
searches, where the workstation ou can get inserted
unintentionally.

This branch changes the Clear Form input from a reset button to
just a button, so the clearForm() function does all the work.

The clearForm() function is changed to set the Home Lib to cons
and the Include Inactive to true, so a reset results in the broadest
search possible.

Testing Notes:
1. Clear browser pref for eg.circ.patron.search.ou in admin ->
  workstation -> stored preferences.
2. Load patron search.
3. Press clear form. (Home library gets cleared)
4. Add some search args and perform a search that returns some patrons.
5. Open a patron.
6. Click on patron search in upper right corner to return to results.
7. Note that home library is now set to workstation ou.

After fix applied.

Perform above steps, but note that clear form sets Home Lib to cons,
and doesn't unset Include Inactive.

Signed-off-by: Josh Stompro <stompro@stompro.org>
Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
Open-ILS/web/js/ui/default/staff/services/patron_search.js

index dd1a9dc..3ed5d5a 100644 (file)
@@ -68,7 +68,7 @@
             ng-model="searchArgs.email" placeholder="[% l('Email') %]"/>
         </div>
         <div class="col-md-2" ng-mouseover="setLastFormElement()">
-          <input type="reset" class="btn btn-primary" ng-click="clearForm()" 
+          <input type="button" class="btn btn-primary" ng-click="clearForm()" 
             value="[% l('Clear Form') %]"/>
         </div>
       </div>
index 07e961e..108e1da 100644 (file)
@@ -740,7 +740,11 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
     }
 
     $scope.clearForm = function () {
-        $scope.searchArgs={};
+        //reset values to broadest possible search
+        $scope.searchArgs={
+            home_ou : egCore.org.tree(),
+            inactive : true
+        };
         if (lastFormElement) lastFormElement.focus();
     }