in house use - handle copy not found
authorBill Erickson <berick@esilibrary.com>
Tue, 13 May 2014 20:11:07 +0000 (16:11 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 13 May 2014 20:11:07 +0000 (16:11 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/in_house_use/index.tt2
Open-ILS/web/js/ui/default/staff/circ/in_house_use/app.js

index 6b87db2..2299603 100644 (file)
@@ -31,8 +31,7 @@
       </div>
     </div>
 
-    <div class="col-md-10">
-
+    <div class="col-md-6">
       <div class="input-group">
         <div class="input-group-btn" dropdown>
           <button type="button" class="btn btn-default dropdown-toggle">
           class="form-control" ng-model="args.barcode"
           ng-disabled="args.noncat_type != 'barcode'"/>
         <input class="btn btn-default" type="submit" value="[% l('Submit') %]"/>
-      </div>
-
+      </div><!-- input group -->
     </div><!-- col -->
   </div><!-- row -->
 </form>
 
+<div clas="row" ng-if="copyNotFound">
+  <div class="col-md-6 alert alert-danger">[% l('Copy Not Found') %]</div>
+</div>
+
 <eg-grid
   id-field="index"
   features="-display,-sort,-multisort"
index 5f7723e..4ae79ff 100644 (file)
@@ -59,6 +59,8 @@ function($scope,  egCore,  egGridDataProvider , egConfirmDialog) {
     }
 
     $scope.checkout = function(args) {
+        $scope.copyNotFound = false;
+
         var coArgs = {
             count : args.num_uses,
             'location' : egCore.auth.user().ws_ou()
@@ -76,7 +78,13 @@ function($scope,  egCore,  egGridDataProvider , egConfirmDialog) {
                     },
                     select : { bre : ['id'] } // avoid fleshing MARC
                 }
-            ).then(null, null, function(copy) {
+            ).then(function(copy) {
+
+                if (!copy) {
+                    $scope.copyNotFound = true;
+                    return;
+                }
+
                 coArgs.copyid = copy.id();
 
                 performCheckout(