From 1d3541d7a1c6e34fb32f868f10b0e157f77f423a Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 4 Apr 2023 11:10:21 -0400 Subject: [PATCH] LP#1716479: (follow-up) fix handling of onSave callbacks for AngularJS MARC edit This patch fixes an issue that has been present for a while but clarified by Beth Wills in the course of testing the base patch for this bug. Specifically, the routine to process onSave callbacks was not bound to the scope properly, meaning that the wrong onSave callbacks could be run when dealing with mutiple active egMarcEditRecords. Signed-off-by: Galen Charlton --- Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index f132cc6a3a..8f5f5f297c 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -1320,7 +1320,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) { id : $scope.recordId, desc : evt.desc } ); } else { - loadRecord().then(processOnSaveCallbacks); + loadRecord().then($scope.processOnSaveCallbacks); } }); } else { @@ -1345,7 +1345,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) ); } else { ngToast.create(egCore.strings.SUCCESS_UNDELETE_RECORD); - loadRecord().then(processOnSaveCallbacks); + loadRecord().then($scope.processOnSaveCallbacks); } }); } @@ -1390,7 +1390,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) }); } - processOnSaveCallbacks = function() { + $scope.processOnSaveCallbacks = function() { var deferred = $q.defer(); if (typeof $scope.onSaveCallback !== 'undefined') { var promise = deferred.promise; @@ -1475,7 +1475,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) $scope.bibSource = $scope.bib_source.id; } - return $timeout(processOnSaveCallbacks); + return $timeout($scope.processOnSaveCallbacks); } $scope.mangle_005(); @@ -1514,7 +1514,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) alert('Could not create anonymous cache key!'); } }); - }).then(loadRecord).then(processOnSaveCallbacks); + }).then(loadRecord).then($scope.processOnSaveCallbacks); }; $scope.seeBreaker = function () { -- 2.11.0