1 dump('entering circ.checkin.js\n');
3 if (typeof patron == 'undefined') patron = {};
4 circ.checkin = function (params) {
6 JSAN.use('util.error'); this.error = new util.error();
7 JSAN.use('util.network'); this.network = new util.network();
8 this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
11 circ.checkin.prototype = {
13 'init' : function( params ) {
17 obj.session = params['session'];
19 JSAN.use('circ.util');
20 var columns = circ.util.columns(
22 'barcode' : { 'hidden' : false },
23 'title' : { 'hidden' : false },
24 'status' : { 'hidden' : false },
27 dump('columns = ' + js2JSON(columns) + '\n');
29 JSAN.use('util.list'); obj.list = new util.list('checkin_list');
33 'map_row_to_column' : circ.util.std_map_row_to_column,
37 JSAN.use('util.controller'); obj.controller = new util.controller();
41 'checkin_barcode_entry_textbox' : [
44 if (ev.keyCode && ev.keyCode == 13) {
51 function() { alert('Not Yet Implemented'); }
53 'cmd_checkin_submit_barcode' : [
59 'cmd_checkin_print' : [
64 'cmd_checkin_reprint' : [
69 'cmd_checkin_done' : [
77 this.controller.view.checkin_barcode_entry_textbox.focus();
81 'checkin' : function() {
84 var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
85 var checkin = obj.network.request(
86 api.checkin_via_barcode.app,
87 api.checkin_via_barcode.method,
88 [ obj.session, barcode, obj.patron_id ]
94 'circ' : checkin.circ,
95 'mvr' : checkin.record,
99 //I could override map_row_to_column here
102 if (typeof obj.on_checkin == 'function') {
103 obj.on_checkin(checkin);
105 if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
106 obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_checkin()\n');
107 window.xulG.on_checkin(checkin);
109 obj.error.sdump('D_CIRC','circ.checkin: No external .on_checkin()\n');
113 alert('FIXME: need special alert and error handling\n'
115 if (typeof obj.on_failure == 'function') {
118 if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
119 obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_failure()\n');
120 window.xulG.on_failure(E);
122 obj.error.sdump('D_CIRC','circ.checkin: No external .on_failure()\n');
128 'on_checkin' : function() {
129 this.controller.view.checkin_barcode_entry_textbox.value = '';
130 this.controller.view.checkin_barcode_entry_textbox.focus();
133 'on_failure' : function() {
134 this.controller.view.checkin_barcode_entry_textbox.select();
135 this.controller.view.checkin_barcode_entry_textbox.focus();
139 dump('exiting circ.checkin.js\n');