From: Bill Erickson Date: Fri, 1 Feb 2013 21:47:10 +0000 (-0500) Subject: selfcheck checkin X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f809a7b0ffac031878e4ed5b02b3612eda84884d;p=evergreen%2Fequinox.git selfcheck checkin Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/circ/selfcheck/checkin_page.tt2 b/Open-ILS/src/templates/circ/selfcheck/checkin_page.tt2 index ade3d0ac9d..3851b117c7 100644 --- a/Open-ILS/src/templates/circ/selfcheck/checkin_page.tt2 +++ b/Open-ILS/src/templates/circ/selfcheck/checkin_page.tt2 @@ -8,6 +8,7 @@ [% l('Author') %] [% l('Due Date') %] [% l('Renewals Left') %] + [% l('Status') %] @@ -18,6 +19,7 @@ + diff --git a/Open-ILS/web/js/dojo/openils/Event.js b/Open-ILS/web/js/dojo/openils/Event.js index b2bf745682..9d518ad2b7 100644 --- a/Open-ILS/web/js/dojo/openils/Event.js +++ b/Open-ILS/web/js/dojo/openils/Event.js @@ -30,6 +30,7 @@ if(!dojo._hasResource["openils.Event"]) { this.ilsperm = kwargs.ilsperm; this.ilspermloc = kwargs.ilspermloc; this.note = kwargs.note; + this.source = kwargs; // capture anything unexpected }, toString : function() { diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 54c4aec25a..2ce93b4b75 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -548,6 +548,10 @@ SelfCheckManager.prototype.drawCheckinPage = function() { SelfCheckManager.prototype.checkin = function(barcode) { var self = this; + + // clear the box now so checkins can continue + this.updateScanBox(); + this.checkinCopy({ barcode : barcode, onload : function(evts) { @@ -732,7 +736,7 @@ SelfCheckManager.prototype.updateCircSummary = function(increment) { if(increment) { // local checkout occurred. Add to the total and the session. - this.circSummary.total += 1; + this.circSummary.total += 1; // TODO += increment for checkins this.circSummary.session += 1; } @@ -1053,8 +1057,36 @@ SelfCheckManager.prototype.failPartMessage = function(result) { } } -SelfCheckManager.prototype.displayCheckin = function(result) { +SelfCheckManager.prototype.displayCheckin = function(result, statText) { console.log('display checkin results ' + result); + + var copy = result.payload.copy; + var record = result.payload.record; + var circ = result.payload.circ; + var row = this.checkinTemplate.cloneNode(true); + + if(record.isbn()) { + this.byName(row, 'jacket').setAttribute('src', + '/opac/extras/ac/jacket/small/' + record.isbn()); + } + + 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; + + 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'}); + } + + + // put new circs at the top of the list + var tbody = this.checkinTbody; + tbody.insertBefore(row, tbody.getElementsByTagName('tr')[0]); + this.updateCircSummary(); } @@ -1065,6 +1097,8 @@ SelfCheckManager.prototype.handleCheckinResult = function(item, result) { var payload = result.payload || {}; var tc = result.textcode; + console.log('checkin resulted in ' + tc); + if (tc == 'NO_SESSION') { return this.logoutStaff(); @@ -1080,6 +1114,18 @@ SelfCheckManager.prototype.handleCheckinResult = function(item, result) { displayText = 'No change ' + item; // TODO i18n this.displayCheckin(result); + } else if (tc == 'ROUTE_ITEM') { + + var statText; + if (result.source.org) { + var sn = fieldmapper.aou.findOrgUnit(result.source.org).shortname(); + displayText = 'Item needs routing to ' + sn; // TODO i18n + statText = tc + ' => ' + sn; + + } + + this.displayCheckin(result, statText); + } else if (tc == 'ASSET_COPY_NOT_FOUND') { displayText = dojo.string.substitute(