JBAS-2185 Batch MARC CN class repair
authorBill Erickson <berickxx@gmail.com>
Mon, 1 Apr 2019 15:28:08 +0000 (15:28 +0000)
committerBill Erickson <berickxx@gmail.com>
Mon, 1 Apr 2019 15:28:27 +0000 (15:28 +0000)
Be sure MARC call numbers are fetched using the correct call number
classification in the batch call number editor.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 05d1077..b42ec32 100644 (file)
@@ -1075,14 +1075,41 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                 if ($scope.defaults.auto_gen_barcode) itemSvc.auto_gen_barcode = true;
             }
 
+            populateBatchCallNumbers();
+        });
+    }
+
+    function populateBatchCallNumbers() {
+
+        var promise;
+
+        if (!$scope.defaults.classification) {
+            promise = egCore.org.settings(
+                ['cat.default_classification_scheme'], 
+                // In batch mode there's no context org unit,
+                // so default to the classification of the workstation org.
+                egCore.auth.user().ws_ou()
+            ).then(function (val) {
+                $scope.defaults.classification = 
+                    $scope.batch.classification = 
+                    val['cat.default_classification_scheme'] || 1;
+            });
+        } else {
+            promise = $q.resolve();
+        }
+
+        promise.then(function() {
+
             // Fetch the list of bib-level callnumbers based on the applied
             // classification scheme.  If none is defined, default to "1"
             // (Generic) since it provides the most options.
+            console.debug('fetching call numbers for scheme ', 
+                $scope.batch.classification);
+
             egCore.net.request(
                 'open-ils.cat',
                 'open-ils.cat.biblio.record.marc_cn.retrieve',
-                $scope.record_id,
-                $scope.batch.classification || 1
+                $scope.record_id, $scope.batch.classification
             ).then(function(list) {
                 $scope.batch.marcCallNumbers = [];
                 list.forEach(function(hash) {