From: Galen Charlton Date: Tue, 4 Apr 2023 15:10:21 +0000 (-0400) Subject: LP#1716479: (follow-up) fix handling of onSave callbacks for AngularJS MARC edit X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=e7290cfaa27678f96a9f5d184e62a52d55e1774b 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 --- 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 f132cc6..8f5f5f2 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 () {