From 1524b7b033c3face2a9bbf429fb8e4d205a9d972 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 1 Jun 2018 13:50:21 -0400 Subject: [PATCH] LP#1736269: Mark Missing Pieces is non-functional In the work to separate the item service into a reusable component, a reference to $scope was left hanging around. This causes the service to die before it can complete its work. The code using $scope does seem to be necessary, so we'll have the function accept an outer_scope parameter and adjust the call sites. Signed-off-by: Mike Rylander Signed-off-by: Cesar Velez Signed-off-by: Chris Sharp --- Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js | 4 ++-- Open-ILS/web/js/ui/default/staff/circ/checkin/app.js | 2 +- Open-ILS/web/js/ui/default/staff/circ/services/item.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js b/Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js index a734e4ab38..4349bdd6d9 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js @@ -46,7 +46,7 @@ function($scope, $q, $window, $location, egCore, egConfirmDialog, egAlertDialog, } function mark_missing_pieces(copy) { - itemSvc.mark_missing_pieces(copy); + itemSvc.mark_missing_pieces(copy,$scope); } $scope.print_letter = function() { @@ -66,7 +66,7 @@ function($scope, $q, $window, $location, egCore, egConfirmDialog, egAlertDialog, $scope.selectMe = false; $scope.letter = null; - get_copy(args.barcode).then(mark_missing_pieces); + get_copy(args.barcode).then(function(c){ return mark_missing_pieces(c,$scope) }); } }]) diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index ef3944f926..6a79396a74 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -376,7 +376,7 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg angular.forEach(items, function(i){ i.acp.call_number(i.acn); i.acp.call_number().record(i.record); - itemSvc.mark_missing_pieces(i.acp); + itemSvc.mark_missing_pieces(i.acp,$scope); }); } diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index b1285af922..d931d3a6a9 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -880,7 +880,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog } } - service.mark_missing_pieces = function(copy) { + service.mark_missing_pieces = function(copy,outer_scope) { var b = copy.barcode(); var t = egCore.idl.toHash(copy.call_number()).record.title; egConfirmDialog.open( @@ -920,7 +920,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog } if (payload.letter) { - $scope.letter = payload.letter.template_output().data(); + outer_scope.letter = payload.letter.template_output().data(); } // apply patron penalty -- 2.11.0