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>
'[% 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") %]';
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close"
- ng-click="cancel()" aria-hidden="true">×</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">×</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>
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';
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;
});
$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);
+ }
+
}])
});
}
+ 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.