patron holds / mark damaged / missing
authorBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 21:02:53 +0000 (17:02 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 21:02:53 +0000 (17:02 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_holds.tt2
Open-ILS/src/templates/staff/circ/share/circ_strings.tt2
Open-ILS/src/templates/staff/circ/share/t_hold_copy_quality_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/holds.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index f720a4f..e30fd4d 100644 (file)
     label="[% l('Un-Set Top of Queue') %]"></eg-grid-action>
   <eg-grid-action handler="transfer_to_marked_title"
     label="[% l('Transfer To Marked Title') %]"></eg-grid-action>
+  <eg-grid-action handler="mark_damaged"
+    label="[% l('Mark Item Damaged') %]"></eg-grid-action>
+  <eg-grid-action handler="mark_missing"
+    label="[% l('Mark Item Missing') %]"></eg-grid-action>
   <eg-grid-action handler="cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
 
index 195d502..316e64a 100644 (file)
@@ -24,6 +24,7 @@ s.LOCATION_ALERT_MSG =
   '[% l("Item [_1] needs to be routed to [_2]", 
     "{{copy.barcode()}}","{{copy.location().name()}}") %]';
 s.MARK_DAMAGED_CONFIRM = '[% l("Mark {{num_items}} items as DAMAGED?") %]';
+s.MARK_MISSING_CONFIRM = '[% l("Mark {{num_items}} items as MISSING?") %]';
 s.ABORT_TRANSIT_CONFIRM = '[% l("Abort {{num_transits}} transits?") %]';
 s.ROUTE_TO_HOLDS_SHELF = '[% l("Holds Shelf") %]';
 s.ROUTE_TO_CATALOGING = '[% l("Cataloging") %]';
index c193646..19aa885 100644 (file)
@@ -1,24 +1,24 @@
-  <div class="modal-content">
-    <div class="modal-header">
-      <button type="button" class="close" 
-        ng-click="cancel()" aria-hidden="true">&times;</button>
-      <h4 class="modal-title">
-        [% l('Accept only "Good Quality" copies?') %]
-      </h4>
-    </div>
-    <div class="modal-body">
-      <div class="form-group">
-        <div class="col-md-4">
-          <button class="btn btn-default" ng-click="good()">[% l('Good Condition') %]</button>
-        </div>
-        <div class="col-md-4">
-          <button class="btn btn-default" ng-click="any()">[% l('Any Condition') %]</button>
-        </div>
+<div class="modal-content">
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">
+      [% l('Accept only "Good Quality" copies?') %]
+    </h4>
+  </div>
+  <div class="modal-body">
+    <div class="form-group">
+      <div class="col-md-4">
+        <button class="btn btn-default" ng-click="good()">[% l('Good Condition') %]</button>
+      </div>
+      <div class="col-md-4">
+        <button class="btn btn-default" ng-click="any()">[% l('Any Condition') %]</button>
       </div>
     </div>
-    <div class="modal-footer">
-      <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
-    </div>
   </div>
+  <div class="modal-footer">
+    <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
 
 
index 9c47198..2bc4434 100644 (file)
@@ -5,9 +5,9 @@
 angular.module('egPatronApp').controller('PatronHoldsCtrl',
 
        ['$scope','$q','$routeParams','egCore','egUser','patronSvc',
-        'egGridDataProvider','egHolds','$window','$location',
+        'egGridDataProvider','egHolds','$window','$location','egCirc',
 function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,  
-        egGridDataProvider , egHolds , $window , $location) {
+        egGridDataProvider , egHolds , $window , $location , egCirc) {
 
     $scope.initTab('holds', $routeParams.id);
     $scope.holds_display = 'main';
@@ -57,6 +57,11 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
             var hold = hold_data.hold;
             hold_data.id = hold.id();
             hold.pickup_lib(egCore.org.get(hold.pickup_lib())); // flesh
+
+            // current_copy is only sometimes fleshed.  Not sure whye.
+            if (hold.current_copy() && typeof hold.current_copy() != 'object')
+                hold.current_copy(hold_data.copy);
+
             patronSvc.holds.push(hold_data);
             return hold_data;
         });
@@ -144,11 +149,25 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
     $scope.clear_top_of_queue = function(items) {
         generic_update(items, 'clear_top_of_queue');
     }
-
     $scope.transfer_to_marked_title = function(items) {
         generic_update(items, 'transfer_to_marked_title');
     }
 
+    $scope.mark_damaged = function(items) {
+        var copy_ids = items
+            .filter(function(item) { return Boolean(item.copy) })
+            .map(function(item) { return item.copy.id() });
+        if (copy_ids.length) 
+            egCirc.mark_damaged(copy_ids).then(refresh_all);
+    }
+    $scope.mark_missing = function(items) {
+        var copy_ids = items
+            .filter(function(item) { return Boolean(item.copy) })
+            .map(function(item) { return item.copy.id() });
+        if (copy_ids.length) 
+            egCirc.mark_missing(copy_ids).then(refresh_all);
+    }
+
 }])
 
 
index c2900e8..9dc405b 100644 (file)
@@ -1010,6 +1010,35 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         });
     }
 
+    service.mark_missing = function(copy_ids) {
+        return egConfirmDialog.open(
+            egCore.strings.MARK_MISSING_CONFIRM, '',
+            {   num_items : copy_ids.length,
+                ok : function() {},
+                cancel : function() {}
+            }
+        ).result.then(function() {
+            var promises = [];
+            angular.forEach(copy_ids, function(copy_id) {
+                promises.push(
+                    egCore.net.request(
+                        'open-ils.circ',
+                        'open-ils.circ.mark_item_missing',
+                        egCore.auth.token(), copy_id
+                    ).then(function(resp) {
+                        if (evt = egCore.evt.parse(resp)) {
+                            console.error('mark missing failed: ' + evt);
+                        }
+                    })
+                );
+            });
+
+            return $q.all(promises);
+        });
+    }
+
+
+
     // Mark circulations as lost via copy barcode.  As each item is 
     // processed, the returned promise is notified of the barcode.
     // No confirmation dialog is presented.