'ITEM_RENTAL_FEE_REQUIRED',
'PATRON_EXCEEDS_LOST_COUNT',
'COPY_CIRC_NOT_ALLOWED',
- 'COPY_NOT_AVAILABLE', // HM?
+ 'COPY_NOT_AVAILABLE',
'COPY_IS_REFERENCE',
'COPY_ALERT_MESSAGE',
'ITEM_ON_HOLDS_SHELF'
switch(evt.textcode) {
case 'COPY_NOT_AVAILABLE':
return service.copy_not_avail_dialog(evt, params, options);
+ case 'COPY_ALERT_MESSAGE':
+ return service.copy_alert_dialog(evt, params, options, 'checkout');
default:
return service.override_dialog(evt, params, options);
}
}
- //TODO: copy_alert_dialog
-
service.handle_checkout_resp = function(evt, params, options) {
var final_resp = {evt : evt, params : params, options : options};
case 'PATRON_ACCOUNT_EXPIRED':
return service.exit_alert(egCore.strings[evt.textcode]);
+
/* stuff yet to consider
PERM_FAILURE
CIRC_CLAIMS_RETURNED
- COPY_ALERT_MESSAGE
*/
default:
);
}
+ // find the open transit for the given copy barcode; flesh the org
+ // units locally.
+ service.find_copy_transit = function(evt, params, options) {
+
+ if (evt && evt.payload && (transit = evt.payload.transit)) { // not ==
+ transit.source(egCore.org.get(transit.source()));
+ transit.dest(egCore.org.get(transit.dest()));
+ return $q.when(transit);
+ }
+
+ return egCore.pcrud.search('atc',
+ { dest_recv_time : null},
+ { flesh : 1,
+ flesh_fields : {atc : ['target_copy']},
+ join : {
+ acp : {
+ filter : {
+ barcode : params.copy_barcode,
+ deleted : 'f'
+ }
+ }
+ },
+ limit : 1,
+ order_by : {atc : 'source_send_time desc'},
+ }
+ ).then(function(transit) {
+ transit.source(egCore.org.get(transit.source()));
+ transit.dest(egCore.org.get(transit.dest()));
+ return transit;
+ });
+ }
+
service.copy_in_transit_dialog = function(evt, params, options) {
return $modal.open({
templateUrl: './circ/share/t_copy_in_transit_dialog',
resolve : {
// fetch the conflicting open transit w/ fleshed copy
transit : function() {
- return egCore.pcrud.search('atc',
- { dest_recv_time : null},
- { flesh : 1,
- flesh_fields : {atc : ['target_copy']},
- join : {
- acp : {
- filter : {
- barcode : params.copy_barcode,
- deleted : 'f'
- }
- }
- },
- limit : 1,
- order_by : {atc : 'source_send_time desc'},
- }
- ).then(function(transit) {
- transit.source(egCore.org.get(transit.source()));
- transit.dest(egCore.org.get(transit.dest()));
- return transit;
- });
+ return service.find_copy_transit(evt, params, options);
}
}
}).result.then(
case 'SUCCESS':
case 'NO_CHANGE':
- // inform user if the item is on the local holds shelf
if (copy.status() == 8 // on holds shelf
&& hold
&& hold.pickup_lib() == egCore.auth.user().ws_ou()) {
+ // inform user if the item is on the local holds shelf
+
return service.route_dialog(
'./circ/share/t_hold_shelf_dialog',
evt, params, options
return $q.when(final_resp);
}
- // show the route dialog
case 'ROUTE_ITEM':
return service.route_dialog(
'./circ/share/t_transit_dialog',
evt, params, options
).then(function() { return final_resp });
-
- // show the copy not found alert dialog
case 'ASSET_COPY_NOT_FOUND':
- // FIXME: where can we put strings that don't live within
- // a specific page?
return egAlertDialog.open(
egCore.strings.UNCAT_ALERT_DIALOG, params)
.result.then(function() {return final_resp});
case 'COPY_ALERT_MESSAGE':
- // FIXME: where can we put strings that don't live within
- // a specific page?
-
- return egConfirmDialog.open(
- egCore.strings.COPY_ALERT_MSG_DIALOG_TITLE,
- evt.payload, // payload == alert message text
- { copy_barcode : params.copy_barcode,
- ok : function() {},
- cancel : function() {
- // TODO: do we return the final_resp so
- // the user can display the copy even though
- // the checkin did not take place?
- }
- }
- ).result.then(function() {
- options.override = true;
- return service.checkin(params, options);
- });
+ return service.copy_alert_dialog(evt, params, options, 'checkin');
default:
console.warn('unhandled checkin response : ' + evt.textcode);
return $modal.open({
templateUrl: tmpl,
controller: [
- '$scope', '$modalInstance', 'destAddr', 'holdUser',
- function($scope, $modalInstance, destAddr, holdUser) {
+ '$scope','$modalInstance','destAddr','holdUser','transit',
+ function($scope , $modalInstance , destAddr , holdUser , transit) {
// TODO: synchronize scope variables with print context vars.
$scope.print = function() {
$modalInstance.close();
- var transit = evt.payload.transit;
-
var print_context = {
transit : egCore.idl.toHash(transit),
title : evt.payload.record.title(),
flesh_fields : {'au' : ['card']}
}
);
+ },
+ transit : function() {
+ return service.find_copy_transit(evt, params, options);
}
}
}).result;
}
+ // action == what action to take if the user confirms the alert
+ service.copy_alert_dialog = function(evt, params, options, action) {
+ return egConfirmDialog.open(
+ egCore.strings.COPY_ALERT_MSG_DIALOG_TITLE,
+ evt.payload, // payload == alert message text
+ { copy_barcode : params.copy_barcode,
+ ok : function() {},
+ cancel : function() {}
+ }
+ ).result.then(function() {
+ options.override = true;
+ return service[action](params, options);
+ });
+ }
+
// check the barcode. If it's no good, show the warning dialog
// Resolves on success, rejected on error
service.test_barcode = function(bc) {