LP#1736269: Mark Missing Pieces is non-functional
authorMike Rylander <mrylander@gmail.com>
Fri, 1 Jun 2018 17:50:21 +0000 (13:50 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 11 Jul 2018 19:34:09 +0000 (15:34 -0400)
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 <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>

Open-ILS/web/js/ui/default/staff/cat/item/missing_pieces.js
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/circ/services/item.js

index a734e4a..4349bdd 100644 (file)
@@ -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) });
     }
 
 }])
index ef3944f..6a79396 100644 (file)
@@ -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);
         });
     }
 
index b1285af..d931d3a 100644 (file)
@@ -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