From 2224e8533610251f5aff30e2554babdcaf19b4f0 Mon Sep 17 00:00:00 2001
From: Mike Rylander <mrylander@gmail.com>
Date: Fri, 14 Sep 2018 09:52:03 -0400
Subject: [PATCH] LP#1792188: Record -> View Holds fails to refresh on
 Next/Prev record

Here we clean up and add back a call to refresh the holds list when navigating
between records in a result set.

To test
-------
[1] In the web staff client, perform a catalog search, bring up a record,
    and change to the View Holds tab.
[2] Click the "Next" button to navigate to the next hold. Note that
    the list of holds doesn't change.
[3] Apply the patch, refresh, and repeat steps #1 and #2. This time,
    the list of holds should get updated as you navigate between
    records in the results list.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: John Yorio <jyorio@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
---
 Open-ILS/web/js/ui/default/staff/cat/catalog/app.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
index 7d525c5f43..8d3ed24a78 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
@@ -591,6 +591,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
                 $scope.conjoinedGridDataProvider.refresh();
             });
             init_parts_url();
+            $scope.grid_actions.refresh();
             $location.update_path('/cat/catalog/record/' + $scope.record_id);
             // update_path() bypasses the controller for path 
             // /cat/catalog/record/:record_id. Manually set title here too.
@@ -1734,13 +1735,14 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
     // ------------------------------------------------------------------
     // Holds 
     var provider = egGridDataProvider.instance({});
+    var holds = []; // current list of holds
+    var hold_count = 0;
+
     $scope.hold_grid_data_provider = provider;
     $scope.grid_actions = egHoldGridActions;
     $scope.grid_actions.refresh = function () { holds = []; hold_count = 0; provider.refresh() };
     $scope.hold_grid_controls = {};
 
-    var holds = []; // current list of holds
-    var hold_count = 0;
     provider.get = function(offset, count) {
         if ($scope.record_tab != 'holds') return $q.when();
 
-- 
2.11.0