From: Cesar Velez Date: Fri, 7 Dec 2018 23:50:43 +0000 (-0500) Subject: LP1765179 - fix issue with pending/staged user reg X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=58d7812bdb4b51be08bcac1522282841c056bfac;p=evergreen%2Fequinox.git LP1765179 - fix issue with pending/staged user reg After completing a staged user registration, the controller in regctl.js was refreshing to the same route, and trying to fetch the same staged user, but never finding it as it was no longer staged/pending. This addresses that bug and adds a bChannel refresh to the pending grid, so once the user is registered in the child tab, it closes the tab and the pending user grid is updated. Signed-off by: Cesar Velez Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/pending.js b/Open-ILS/web/js/ui/default/staff/circ/patron/pending.js index 0690b3c5fc..0912eb84c2 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/pending.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/pending.js @@ -50,6 +50,18 @@ function($scope , $q , $routeParams , $window , $location , egCore , egGridDataP provider.refresh(); } + if (typeof BroadcastChannel != 'undefined') { + // connect 2 bChannel + holdings_bChannel = new BroadcastChannel('eg.pending_usr.update'); + holdings_bChannel.onmessage = function(e){ + if (e.data && e.data.usr.home_ou == $scope.context_org.id()){ + // pending usr was registered, refresh grid! + console.log("Got broadcast from channel eg.pending_usr.update for usr id: " + e.data.usr.id); + refresh_page(); + } + } + }; + provider.get = function(offset, count) { var deferred = $q.defer(); var recv_index = 0; 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 cd8843a646..4e2e9a2586 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 @@ -1226,10 +1226,10 @@ angular.module('egCoreMod') .controller('PatronRegCtrl', ['$scope','$routeParams','$q','$uibModal','$window','egCore', 'patronSvc','patronRegSvc','egUnloadPrompt','egAlertDialog', - 'egWorkLog', + 'egWorkLog', '$timeout', function($scope , $routeParams , $q , $uibModal , $window , egCore , patronSvc , patronRegSvc , egUnloadPrompt, egAlertDialog , - egWorkLog) { + egWorkLog, $timeout) { $scope.page_data_loaded = false; $scope.hold_notify_type = { phone : null, email : null, sms : null }; @@ -2127,6 +2127,19 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , + updated_user.id(); $window.open(url, '_blank').focus(); + } else if ($window.location.href.indexOf('stage') > -1 ){ + // we're here after deleting a self-reg staged user. + // Just close tab, since refresh won't find staged user + $timeout(function(){ + if (typeof BroadcastChannel != 'undefined') { + var bChannel = new BroadcastChannel("eg.pending_usr.update"); + bChannel.postMessage({ + usr: egCore.idl.toHash(updated_user) + }); + } + + $window.close(); + }); } else { // reload the current page $window.location.href = location.href;