]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/checkout.js
*** empty log message ***
[Evergreen.git] / Open-ILS / xul / staff_client / server / circ / checkout.js
1 dump('entering circ.checkout.js\n');
2
3 if (typeof circ == 'undefined') circ = {};
4 circ.checkout = function (params) {
5
6         JSAN.use('util.error'); this.error = new util.error();
7         JSAN.use('util.network'); this.network = new util.network();
8         JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
9 }
10
11 circ.checkout.prototype = {
12
13         'init' : function( params ) {
14
15                 var obj = this;
16
17                 obj.patron_id = params['patron_id'];
18                 obj.patron = obj.network.simple_request('FM_AU_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
19
20                 JSAN.use('circ.util');
21                 var columns = circ.util.columns( 
22                         { 
23                                 'barcode' : { 'hidden' : false },
24                                 'title' : { 'hidden' : false },
25                                 'due_date' : { 'hidden' : false },
26                         } 
27                 );
28
29                 JSAN.use('util.list'); obj.list = new util.list('checkout_list');
30                 obj.list.init(
31                         {
32                                 'columns' : columns,
33                                 'map_row_to_column' : circ.util.std_map_row_to_column(),
34                         }
35                 );
36                 
37                 JSAN.use('util.controller'); obj.controller = new util.controller();
38                 obj.controller.init(
39                         {
40                                 'control_map' : {
41                                         'checkout_menu_placeholder' : [
42                                                 ['render'],
43                                                 function(e) {
44                                                         return function() {
45                                                                 JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
46                                                                 var items = [ [ 'Barcode:' , 'barcode' ] ].concat(
47                                                                         util.functional.map_list(
48                                                                                 util.functional.filter_list(
49                                                                                         obj.data.list.cnct,
50                                                                                         function(o) {
51                                                                                                 return util.fm_utils.compare_aou_a_is_b_or_ancestor(o.owning_lib(), obj.data.list.au[0].ws_ou());
52                                                                                         }
53                                                                                 ),
54                                                                                 function(o) {
55                                                                                         return [ o.name(), o.id() ];
56                                                                                 }
57                                                                         )
58                                                                 );
59                                                                 g.error.sdump('D_TRACE','items = ' + js2JSON(items));
60                                                                 util.widgets.remove_children( e );
61                                                                 var ml = util.widgets.make_menulist(
62                                                                         items
63                                                                 );
64                                                                 e.appendChild( ml );
65                                                                 ml.setAttribute('id','checkout_menulist');
66                                                                 ml.setAttribute('accesskey','');
67                                                                 ml.addEventListener(
68                                                                         'command',
69                                                                         function(ev) {
70                                                                                 var tb = obj.controller.view.checkout_barcode_entry_textbox;
71                                                                                 var db = document.getElementById('duedate_hbox');
72                                                                                 if (ev.target.value == 'barcode') {
73                                                                                         db.hidden = false;
74                                                                                         tb.disabled = false;
75                                                                                         tb.value = '';
76                                                                                         tb.focus();
77                                                                                 } else {
78                                                                                         db.hidden = true;
79                                                                                         tb.disabled = true;
80                                                                                         tb.value = 'Non-Cataloged';
81                                                                                 }
82                                                                         }, false
83                                                                 );
84                                                                 obj.controller.view.checkout_menu = ml;
85                                                         };
86                                                 },
87                                         ],
88                                         'checkout_barcode_entry_textbox' : [
89                                                 ['keypress'],
90                                                 function(ev) {
91                                                         if (ev.keyCode && ev.keyCode == 13) {
92                                                                 obj.checkout( { barcode: ev.target.value } );
93                                                         }
94                                                 }
95                                         ],
96                                         'checkout_duedate_menu' : [
97                                                 ['change'],
98                                                 function(ev) { 
99                                                         try {
100                                                                 obj.check_date(ev.target);
101                                                                 ev.target.parentNode.setAttribute('style','');
102                                                         } catch(E) {
103                                                                 ev.target.parentNode.setAttribute('style','background-color: red');
104                                                                 alert(E + '\nUse this format: YYYY-MM-DD');
105                                                                 try {
106                                                                         ev.target.inputField.select();
107                                                                         ev.target.inputField.focus();
108                                                                 } catch(E) { /* this should work, let me try on other platforms */ 
109                                                                         obj.error.sdump('D_ERROR','menulist.inputField: ' + E);
110                                                                 }
111                                                         }
112                                                 }
113                                         ],
114                                         'cmd_broken' : [
115                                                 ['command'],
116                                                 function() { alert('Not Yet Implemented'); }
117                                         ],
118                                         'cmd_checkout_submit' : [
119                                                 ['command'],
120                                                 function() {
121                                                         var params = {}; var count = 1;
122
123                                                         if (obj.controller.view.checkout_menu.value == 'barcode' ||
124                                                                 obj.controller.view.checkout_menu.value == '') {
125                                                                 params.barcode = obj.controller.view.checkout_barcode_entry_textbox.value;
126                                                         } else {
127                                                                 params.noncat = 1;
128                                                                 params.noncat_type = obj.controller.view.checkout_menu.value;
129                                                                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
130                                                                 var r = window.prompt('Enter the number of ' + obj.data.hash.cnct[ params.noncat_type].name() + ' circulating:','1','Non-cataloged Items');
131                                                                 if (r) {
132                                                                         count = Number(r);
133                                                                         if (count > 0) {
134                                                                                 if (count > 99) {
135                                                                                         obj.error.yns_alert('You tried to circulate ' + count + ' ' + obj.data.hash.cnct[ params.noncat_type].name() + '.  The maximum is 99 per action.','Non-cataloged Circulation','OK',null,null,'Check here to confirm this message.');
136                                                                                         return;
137                                                                                 } else if (count > 20) {
138                                                                                         r = obj.error.yns_alert('Are you sure you want to circulate ' + count + ' ' + obj.data.hash.cnct[ params.noncat_type].name() + '?','Non-cataloged Circulation','Yes','No',null,'Check here to confirm this message.');
139                                                                                         if (r != 0) return;
140                                                                                 }
141                                                                         } else {
142                                                                                 r = obj.error.yns_alert('Error with non-cataloged checkout.  ' + r + ' is not a valid number.','Non-cataloged Circulation','Ok',null,null,'Check here to confirm this message.');
143                                                                                 return;
144                                                                         }
145                                                                 } else {
146                                                                         return;
147                                                                 }
148                                                         }
149                                                         for (var i = 0; i < count; i++) {
150                                                                 obj.checkout( params );
151                                                         }
152                                                 }
153                                         ],
154                                         'cmd_checkout_print' : [
155                                                 ['command'],
156                                                 function() {
157                                                         try {
158                                                                 obj.print();
159                                                         } catch(E) {
160                                                                 obj.error.standard_unexpected_error_alert('cmd_checkout_print',E);
161                                                         }
162
163                                                 }
164                                         ],
165                                         'cmd_checkout_reprint' : [
166                                                 ['command'],
167                                                 function() {
168                                                         JSAN.use('util.print'); var print = new util.print();
169                                                         print.reprint_last();
170                                                 }
171                                         ],
172                                         'cmd_checkout_done' : [
173                                                 ['command'],
174                                                 function() {
175                                                         try {
176                                                                 if (document.getElementById('checkout_auto').checked) {
177                                                                         obj.print(true,function() { 
178                                                                                 obj.list.clear();
179                                                                                 xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); 
180                                                                         });
181                                                                 } else {
182                                                                         obj.print(false,function() {
183                                                                                 obj.list.clear();
184                                                                                 xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
185                                                                         });
186                                                                 }
187                                                         } catch(E) {
188                                                                 obj.error.standard_unexpected_error_alert('cmd_checkout_done',E);
189                                                         }
190                                                 }
191                                         ],
192                                 }
193                         }
194                 );
195                 this.controller.render();
196                 this.controller.view.checkout_barcode_entry_textbox.focus();
197
198                 this.check_disable();
199
200         },
201
202         'check_disable' : function() {
203                 var obj = this;
204                 try {
205                         if (typeof xulG.check_stop_checkouts == 'function') {
206                                 var disable = xulG.check_stop_checkouts();
207                                 if (disable) {
208                                         document.getElementById('checkout_submit_barcode_button').disabled = true;
209                                         document.getElementById('checkout_done').disabled = true;
210                                         obj.controller.view.checkout_menu.disabled = true;
211                                         obj.controller.view.checkout_barcode_entry_textbox.disabled = true;
212                                 } else {
213                                         document.getElementById('checkout_submit_barcode_button').disabled = false;
214                                         document.getElementById('checkout_done').disabled = false;
215                                         obj.controller.view.checkout_menu.disabled = false;
216                                         obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
217                                 }
218                         }
219                 } catch(E) {
220                         obj.error.standard_unexpected_error_alert('Error determining whether to disable checkout.',E);
221                 }
222         },
223
224         'print' : function(silent,f) {
225                 var obj = this;
226                 try {
227                         obj.list.on_all_fleshed = function() {
228                                 try {
229                                         var params = { 
230                                                 'patron' : obj.patron, 
231                                                 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
232                                                 'staff' : obj.data.list.au[0],
233                                                 'header' : obj.data.print_list_templates.checkout.header,
234                                                 'line_item' : obj.data.print_list_templates.checkout.line_item,
235                                                 'footer' : obj.data.print_list_templates.checkout.footer,
236                                                 'type' : obj.data.print_list_templates.checkout.type,
237                                                 'list' : obj.list.dump(),
238                                         };
239                                         if (silent) params.no_prompt = true;
240                                         JSAN.use('util.print'); var print = new util.print();
241                                         print.tree_list( params );
242                                         setTimeout(function(){obj.list.on_all_fleshed = null;if (typeof f == 'function') f();},0);
243                                 } catch(E) {
244                                         obj.error.standard_unexpected_error_alert('print',E);
245                                 }
246                         }
247                         obj.list.full_retrieve();
248                 } catch(E) {
249                         obj.error.standard_unexpected_error_alert('print',E);
250                 }
251         },
252
253         'check_date' : function(node) {
254                 JSAN.use('util.date');
255                 try {
256                         if (node.value == 'Normal') return true;
257                         var pattern = node.value.match(/Today \+ (\d+) days/);
258                         if (pattern) {
259                                 var today = new Date();
260                                 var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*pattern[1] );
261                                 node.value = util.date.formatted_date(todayPlus,"%F");
262                         }
263                         if (! util.date.check('YYYY-MM-DD',node.value) ) { throw('Invalid Date'); }
264                         if (util.date.check_past('YYYY-MM-DD',node.value) ) { throw('Due date needs to be after today.'); }
265                         if ( util.date.formatted_date(new Date(),'%F') == node.value) { throw('Due date needs to be after today.'); }
266                         return true;
267                 } catch(E) {
268                         throw(E);
269                 }
270         },
271
272         'checkout' : function(params) {
273                 var obj = this;
274
275                 try { obj.check_date(obj.controller.view.checkout_duedate_menu); } catch(E) { return; }
276                 if (obj.controller.view.checkout_duedate_menu.value != 'Normal') {
277                         params.due_date = obj.controller.view.checkout_duedate_menu.value;
278                 }
279
280                 if (! (params.barcode||params.noncat)) return;
281
282                 /**********************************************************************************************************************/
283                 /* This does the actual checkout/renewal, but is called after a permit test further below */
284                 function check_out(params) {
285
286                         var checkout = obj.network.request(
287                                 api.CHECKOUT.app,
288                                 api.CHECKOUT.method,
289                                 [ ses(), params ]
290                         );
291
292                         if (checkout.ilsevent == 0) {
293
294                                 if (!checkout.payload) checkout.payload = {};
295
296                                 if (!checkout.payload.circ) {
297                                         checkout.payload.circ = new aoc();
298                                         /*********************************************************************************************/
299                                         /* Non Cat */
300                                         if (checkout.payload.noncat_circ) {
301                                                 checkout.payload.circ.circ_lib( checkout.payload.noncat_circ.circ_lib() );
302                                                 checkout.payload.circ.circ_staff( checkout.payload.noncat_circ.staff() );
303                                                 checkout.payload.circ.usr( checkout.payload.noncat_circ.patron() );
304                                                 
305                                                 JSAN.use('util.date');
306                                                 var c = checkout.payload.noncat_circ.circ_time();
307                                                 var d = c == "now" ? new Date() : util.date.db_date2Date( c );
308                                                 var t =obj.data.hash.cnct[ checkout.payload.noncat_circ.item_type() ];
309                                                 var cd = t.circ_duration() || "14 days";
310                                                 var i = util.date.interval_to_seconds( cd ) * 1000;
311                                                 d.setTime( Date.parse(d) + i );
312                                                 checkout.payload.circ.due_date( util.date.formatted_date(d,'%F') );
313
314                                         }
315                                 }
316
317                                 if (!checkout.payload.record) {
318                                         checkout.payload.record = new mvr();
319                                         /*********************************************************************************************/
320                                         /* Non Cat */
321                                         if (checkout.payload.noncat_circ) {
322                                                 checkout.payload.record.title(
323                                                         obj.data.hash.cnct[ checkout.payload.noncat_circ.item_type() ].name()
324                                                 );
325                                         }
326                                 }
327
328                                 if (!checkout.payload.copy) {
329                                         checkout.payload.copy = new acp();
330                                         checkout.payload.copy.barcode( '' );
331                                 }
332
333                                 /*********************************************************************************************/
334                                 /* Override mvr title/author with dummy title/author for Pre cat */
335                                 if (checkout.payload.copy.dummy_title())  checkout.payload.record.title( checkout.payload.copy.dummy_title() );
336                                 if (checkout.payload.copy.dummy_author())  checkout.payload.record.author( checkout.payload.copy.dummy_author() );
337
338                                 obj.list.append(
339                                         {
340                                                 'row' : {
341                                                         'my' : {
342                                                         'circ' : checkout.payload.circ,
343                                                         'mvr' : checkout.payload.record,
344                                                         'acp' : checkout.payload.copy
345                                                         }
346                                                 }
347                                         //I could override map_row_to_column here
348                                         }
349                                 );
350                                 if (typeof obj.on_checkout == 'function') {
351                                         obj.on_checkout(checkout.payload);
352                                 }
353                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_list_change == 'function') {
354                                         window.xulG.on_list_change(checkout.payload);
355                                 } else {
356                                         obj.error.sdump('D_CIRC','circ.checkout: No external .on_checkout()\n');
357                                 }
358                         } else {
359                                 throw(checkout);
360                         }
361                 }
362
363                 /**********************************************************************************************************************/
364                 /* Permissibility test before checkout */
365                 try {
366
367                         params.patron = obj.patron_id;
368
369                         var permit = obj.network.request(
370                                 api.CHECKOUT_PERMIT.app,
371                                 api.CHECKOUT_PERMIT.method,
372                                 [ ses(), params ],
373                                 null,
374                                 {
375                                         'title' : 'Override Checkout Failure?',
376                                         'overridable_events' : [ 
377                                                 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */,
378                                                 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */,
379                                                 7003 /* COPY_CIRC_NOT_ALLOWED */,
380                                                 7004 /* COPY_NOT_AVAILABLE */, 
381                                                 7006 /* COPY_IS_REFERENCE */, 
382                                                 7010 /* COPY_ALERT_MESSAGE */,
383                                                 7013 /* PATRON_EXCEEDS_FINES */,
384                                         ],
385                                         'text' : {
386                                                 '7004' : function(r) {
387                                                         //return obj.data.hash.ccs[ r.payload ].name();
388                                                         return r.payload.status().name();
389                                                         //return r.payload.name();
390                                                         //return r.payload;
391                                                 },
392                                                 '7010' : function(r) {
393                                                         return r.payload;
394                                                 },
395                                         }
396                                 }
397                         );
398
399                         if (!permit) throw(permit);
400
401                         function test_event(list,ev) {
402                                 if (typeof list.ilsevent != 'undefined' ) {
403                                         if (list.ilsevent == ev) {
404                                                 return list;
405                                         } else {
406                                                 return false;
407                                         }
408                                 } else {
409                                         for (var i = 0; i < list.length; i++) {
410                                                 if (typeof list[i].ilsevent != 'undefined') {
411                                                         if (list[i].ilsevent == ev) return list[i];
412                                                 }
413                                         }
414                                         return false;
415                                 }
416                         }
417
418                         /**********************************************************************************************************************/
419                         /* Normal case, proceed with checkout */
420                         if (permit.ilsevent == 0) {
421
422                                 JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
423                                 params.permit_key = permit.payload;
424                                 check_out( params );
425
426                         /**********************************************************************************************************************/
427                         /* Item not cataloged or barcode mis-scan.  Prompt for pre-cat option */
428                         } else {
429                         
430                                 var found_handled = false; var found_not_handled = false; var msg = ''; 
431
432                                 if (test_event(permit,1202 /* ITEM_NOT_CATALOGED */)) {
433
434                                         if ( 1 == obj.error.yns_alert(
435                                                 'Mis-scan or non-cataloged item.  Checkout as a pre-cataloged item?',
436                                                 'Alert',
437                                                 'Cancel',
438                                                 'Pre-Cat',
439                                                 null,
440                                                 'Check here to confirm this action'
441                                         ) ) {
442
443                                                 obj.data.dummy_title = ''; obj.data.dummy_author = ''; obj.data.stash('dummy_title','dummy_author');
444                                                 JSAN.use('util.window'); var win = new util.window();
445                                                 win.open(urls.XUL_PRE_CAT, 'dummy_fields', 'chrome,resizable,modal');
446                                                 obj.data.stash_retrieve();
447
448                                                 params.permit_key = permit.payload;
449                                                 params.dummy_title = obj.data.dummy_title;
450                                                 params.dummy_author = obj.data.dummy_author;
451                                                 params.precat = 1;
452
453                                                 if (params.dummy_title != '') { check_out( params ); } else { throw('Checkout cancelled'); }
454                                         } 
455                                 };
456
457                                 var test_permit;
458                                 if (typeof permit.ilsevent != 'undefined') { test_permit = [ permit ]; } else { test_permit = permit; }
459
460                                 for (var i = 0; i < test_permit.length; i++) {
461                                         dump('found [' + test_permit[i].ilsevent + ']\n');
462                                         switch(test_permit[i].ilsevent) {
463                                                 case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ :
464                                                         found_handled = true;
465                                                 break;
466                                                 case 7013 /* PATRON_EXCEEDS_FINES */ :
467                                                         found_handled = true;
468                                                 break;
469                                                 case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ :
470                                                         found_handled = true;
471                                                 break;
472                                                 case 7003 /* COPY_CIRC_NOT_ALLOWED */ :
473                                                         found_handled = true;
474                                                 break;
475                                                 case 7004 /* COPY_NOT_AVAILABLE */ :
476                                                         msg += test_permit[i].desc + '\n' + 'Copy status = ' + ( test_permit[i].payload.status().name() ) + '\n';
477                                                         found_handled = true;
478                                                 break;
479                                                 case 7006 /* COPY_IS_REFERENCE */ :
480                                                         msg += test_permit[i].desc + '\n';
481                                                         found_handled = true;
482                                                 break;
483                                                 case 7010 /* COPY_ALERT_MESSAGE */ :
484                                                         msg += test_permit[i].desc + '\n' + 'Alert Message = ' + test_permit[i].payload + '\n';
485                                                         found_handled = true;
486                                                 break;
487                                                 case 1202 /* ITEM_NOT_CATALOGED */ :
488                                                         found_handled = true;
489                                                 break;
490                                                 case 5000 /* PERM_FAILURE */ :
491                                                         msg += test_permit[i].desc + '\n' + 'Permission Denied = ' + test_permit[i].ilsperm + '\n';
492                                                         found_handled = true;
493                                                 break;
494                                                 case 1702 /* OPEN_CIRCULATION_EXISTS */ :
495                                                         msg += test_permit[i].desc + '\n';
496                                                         found_handled = true;
497
498                                                         var my_copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[params.barcode]);
499                                                         if (typeof my_copy.ilsevent != 'undefined') throw(my_copy);
500                                                         var my_circ = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),my_copy.id(),1]);
501                                                         if (typeof my_circ.ilsevent != 'undefined') throw(my_copy);
502                                                         my_circ = my_circ[0];
503                                                         var due_date = my_circ.due_date().substr(0,10);
504                                                         JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
505                                                         if (today > due_date) msg += '\nThis item was due on ' + due_date + '.\n';
506                                                         var r = obj.error.yns_alert(msg,'Check Out Failed','Cancel','Checkin then Checkout', today > due_date ? 'Forgiving Checkin then Checkout' : null,'Check here to confirm this message');
507                                                         JSAN.use('circ.util');
508                                                         switch(r) {
509                                                                 case 1:
510                                                                         circ.util.checkin_via_barcode( ses(), params.barcode );
511                                                                         obj.checkout(params);
512                                                                 break;
513                                                                 case 2:
514                                                                         circ.util.checkin_via_barcode( ses(), params.barcode, due_date );
515                                                                         obj.checkout(params);
516                                                                 break;
517                                                         }
518                                                 break;
519                                                 case 7014 /* COPY_IN_TRANSIT */ :
520                                                         msg += test_permit[i].desc + '\n';
521                                                         found_handled = true;
522                                                         var r = obj.error.yns_alert(msg,'Check Out Failed','Cancel','Abort Transit then Checkout',null,'Check here to confirm this message');
523                                                         switch(r) {
524                                                                 case 1:
525                                                                         var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'barcode' : params.barcode } ]);
526                                                                         if (typeof robj.ilsevent == 'undefined') {
527                                                                                 obj.checkout(params);
528                                                                         } else {
529                                                                                 if (robj.ilsevent != 5000 /* PERM_FAILURE */) throw(robj);
530                                                                         }
531                                                                 break;
532                                                         }
533                                                 break;
534                                                 case -1 /* NETWORK_FAILURE */ :
535                                                         msg += 'There was a network failure.\n';
536                                                         found_handled = true;
537                                                         obj.error.yns_alert(msg,'Check Out Failed','OK',null,null,'Check here to confirm this message');
538                                                 break;
539                                                 default:
540                                                         msg += 'FIXME: ' + js2JSON(test_permit[i]) + '\n';
541                                                         found_not_handled = true;
542                                                 break;
543                                         }
544                                 }
545                                 
546                                 if (found_not_handled) {
547                                         obj.error.standard_unexpected_error_alert(msg,permit);
548                                 }
549
550                                 obj.controller.view.checkout_barcode_entry_textbox.select();
551                                 obj.controller.view.checkout_barcode_entry_textbox.focus();
552                         }
553
554                 } catch(E) {
555                         if (typeof E.ilsevent != 'undefined' && E.ilsevent == -1) {
556                                 obj.error.standard_network_error_alert('Check Out Failed.  If you wish to use the offline interface, in the top menubar select Circulation -> Offline Interface');
557                         } else {
558                                 obj.error.standard_unexpected_error_alert('Check Out Failed',E);
559                         }
560                         if (typeof obj.on_failure == 'function') {
561                                 obj.on_failure(E);
562                         }
563                         if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
564                                 obj.error.sdump('D_CIRC','circ.checkout: Calling external .on_failure()\n');
565                                 window.xulG.on_failure(E);
566                         } else {
567                                 obj.error.sdump('D_CIRC','circ.checkout: No external .on_failure()\n');
568                         }
569                 }
570
571         },
572
573         'on_checkout' : function() {
574                 this.controller.view.checkout_menu.selectedIndex = 0;
575                 this.controller.view.checkout_barcode_entry_textbox.disabled = false;
576                 this.controller.view.checkout_barcode_entry_textbox.value = '';
577                 this.controller.view.checkout_barcode_entry_textbox.focus();
578                 document.getElementById('duedate_hbox').hidden = false;
579         },
580
581         'on_failure' : function() {
582                 this.controller.view.checkout_barcode_entry_textbox.select();
583                 this.controller.view.checkout_barcode_entry_textbox.focus();
584         }
585 }
586
587 dump('exiting circ.checkout.js\n');