LP1739288: report back on invalid barcodes in Item Status screen user/sandbergja/lp1739288
authorJane Sandberg <sandbej@linnbenton.edu>
Mon, 19 Aug 2019 19:43:33 +0000 (12:43 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Mon, 19 Aug 2019 19:52:15 +0000 (12:52 -0700)
To test:

1) Make a text file with both valid and invalid item barcodes.
2) Go to Circulation > Item Status and upload your file.
3) Note that the valid barcodes result in rows in the item status
screen, and the invalid barcodes are not displayed anywhere.
4) Apply this commit.
5) Repeat step 2.
6) Notice that the invalid barcodes are now reported in a new alert.
7) Make a text file with only valid barcodes and upload it.
8) Upload it.  Notice that the alert disappears.

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/templates/staff/cat/item/index.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js

index 785f250..5c81d46 100644 (file)
   </div>
 </div>
 
+<div class="row">
+  <div class="col-md-6">
+    <div ng-show="context.itemsNotFound.length" class="alert alert-danger" role="alert">
+      <h3>[% l('The following barcodes are incorrect or deleted') %]</h3>
+      <ul>
+        <li ng-repeat="badBarcode in context.itemsNotFound">{{badBarcode}}</li>
+      </ul>
+    </div>
+  </div>
+</div>
+
 <div ng-view></div>
 
 [% END %]
index 5e418e7..3d64f47 100644 (file)
@@ -358,6 +358,7 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
     };
 
     $scope.$watch('barcodesFromFile', function(newVal, oldVal) {
+        $scope.context.itemsNotFound = [];
         if (newVal && newVal != oldVal) {
             $scope.args.barcode = '';
             var barcodes = [];
@@ -387,7 +388,12 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
                     return;
                 }
 
-                itemSvc.fetch(barcode).then(fetch_next_copy);
+                itemSvc.fetch(barcode).then(function(item) {
+                    if (!item) {
+                        $scope.context.itemsNotFound.push(barcode);
+                    }
+                    fetch_next_copy();
+                })
             }
 
             if (barcodes.length) {