dojo.require('openils.Util');
dojo.require('openils.User');
dojo.require('openils.Event');
+dojo.require('openils.PermaCrud');
dojo.require('openils.widget.ProgressDialog');
dojo.require('openils.widget.OrgUnitFilteringSelect');
// true if we are exposing staff-only features (e.g. checkin)
this.staffMode = false;
+ this.copyStatusMap = {};
+
// Construct a mock checkout for debugging purposes
if(this.mockCheckouts = this.cgi.param('mock-circ')) {
this.setupStaffLogin();
this.loadOrgSettings();
+ this.loadCopyStatuses();
// are we in staff mode?
new openils.User().getPermOrgList(['SELFCHECK_STAFF_MODE'],
}
+SelfCheckManager.prototype.loadCopyStatuses = function() {
+ var self = this;
+ var pcrud = new openils.PermaCrud();
+ pcrud.retrieveAll('ccs', {
+ async : true,
+ oncomplete : function(r) {
+ var list = openils.Util.readResponse(r);
+ dojo.forEach(list, function(stat) {
+ self.copyStatusMap[stat.id()] = stat;
+ });
+ }
+ });
+};
+
SelfCheckManager.prototype.getSelectedFinesTotal = function() {
var total = 0;
dojo.forEach(
var self = this;
this.updateScanBox({
- msg : 'Please enter an item barcode', // TODO i18n
+ msg : dojo.string.substitute(localeStrings.CHECKOUT_PROMPT),
handler : function(barcode) { self.checkout(barcode); }
});
var self = this;
this.updateScanBox({
- msg : 'Please enter an item barcode', // TODO i18n
+ msg : dojo.string.substitute(localeStrings.CHECKIN_PROMPT),
handler : function(barcode) { self.checkin(barcode); }
});
};
]}
);
- // TODO: staffMode : handle/report events better
-
if(!resp.length) resp = [resp];
for(var i = 0; i < resp.length; i++) {
var tc = openils.Event.parse(resp[i]).textcode;
}
}
-SelfCheckManager.prototype.displayCheckin = function(result, statText) {
+SelfCheckManager.prototype.displayCheckin = function(result, outcomeText) {
console.log('display checkin results ' + result);
var copy = result.payload.copy;
this.byName(row, 'barcode').innerHTML = copy.barcode();
this.byName(row, 'title').innerHTML = record.title();
this.byName(row, 'author').innerHTML = record.author();
- this.byName(row, 'status').innerHTML = statText || result.textcode;
+ this.byName(row, 'status').innerHTML = this.copyStatusMap[copy.status()].name();
+ this.byName(row, 'outcome').innerHTML = outcomeText || result.textcode;
if (circ) {
- this.byName(row, 'remaining').innerHTML = circ.renewal_remaining();
var date = dojo.date.stamp.fromISOString(circ.due_date());
this.byName(row, 'due_date').innerHTML =
dojo.date.locale.format(date, {selector : 'date'});
} else if (tc == 'SUCCESS') {
- //displayText = dojo.string.substitute(localeStrings.CHECKOUT_SUCCESS, [item]);
- displayText = 'Checkin Succeeded ' + item; // TODO i18n
+ displayText = dojo.string.substitute(
+ localeStrings.CHECKIN_SUCCESS, [item]);
this.displayCheckin(result);
} else if (tc == 'NO_CHANGE') {
- displayText = 'No change ' + item; // TODO i18n
+ displayText = dojo.string.substitute(
+ localeStrings.CHECKIN_NO_CHANGE, [item]);
this.displayCheckin(result);
} else if (tc == 'ROUTE_ITEM') {
- var statText;
+ var outcomeText;
if (result.source.org) {
var sn = fieldmapper.aou.findOrgUnit(result.source.org).shortname();
- displayText = 'Item needs routing to ' + sn; // TODO i18n
- statText = tc + ' => ' + sn;
-
+ displayText = dojo.string.substitute(
+ localeStrings.CHECKIN_ROUTE_ITEM, [item, sn]);
+ outcomeText = tc + ' => ' + sn;
}
- this.displayCheckin(result, statText);
+ this.displayCheckin(result, outcomeText);
} else if (tc == 'ASSET_COPY_NOT_FOUND') {