]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/checkin.js
Change each tab to 4 spaces in the staff client javascript files.
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / circ / checkin.js
1 dump('entering circ.checkin.js\n');
2
3 if (typeof circ == 'undefined') circ = {};
4 circ.checkin = 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('util.barcode');
9     JSAN.use('util.date');
10     this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
11     this.data = this.OpenILS.data;
12 }
13
14 circ.checkin.prototype = {
15
16     'selection_list' : [],
17
18     'init' : function( params ) {
19
20         var obj = this;
21
22         JSAN.use('circ.util'); JSAN.use('patron.util');
23         var columns = circ.util.columns( 
24             { 
25                 'barcode' : { 'hidden' : false },
26                 'title' : { 'hidden' : false },
27                 'location' : { 'hidden' : false },
28                 'call_number' : { 'hidden' : false },
29                 'status' : { 'hidden' : false },
30                 'route_to' : { 'hidden' : false },
31                 'alert_message' : { 'hidden' : false },
32                 'checkin_time' : { 'hidden' : false }
33             },
34             {
35                 'except_these' : [ 'uses', 'checkin_time_full' ]
36             }
37         ).concat(
38             patron.util.columns( { 'family_name' : { 'hidden' : 'false' } } )
39
40         ).concat(
41             patron.util.mbts_columns( {}, { 'except_these' : [ 'total_paid', 'total_owed', 'xact_start', 'xact_finish', 'xact_type' ] } )
42
43         ).sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
44
45         JSAN.use('util.list'); obj.list = new util.list('checkin_list');
46         obj.list.init(
47             {
48                 'columns' : columns,
49                 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
50                 'retrieve_row' : obj.gen_list_retrieve_row_func(),
51                 'on_select' : function(ev) {
52                     try {
53                         JSAN.use('util.functional');
54                         var sel = obj.list.retrieve_selection();
55                         obj.selection_list = util.functional.map_list(
56                             sel,
57                             function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
58                         );
59                         obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
60                         if (obj.selection_list.length == 0) {
61                             obj.controller.view.sel_edit.setAttribute('disabled','true');
62                             obj.controller.view.sel_backdate.setAttribute('disabled','true');
63                             obj.controller.view.sel_opac.setAttribute('disabled','true');
64                             obj.controller.view.sel_patron.setAttribute('disabled','true');
65                             obj.controller.view.sel_last_patron.setAttribute('disabled','true');
66                             obj.controller.view.sel_copy_details.setAttribute('disabled','true');
67                             obj.controller.view.sel_bucket.setAttribute('disabled','true');
68                             obj.controller.view.sel_spine.setAttribute('disabled','true');
69                             obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
70                             obj.controller.view.sel_clip.setAttribute('disabled','true');
71                             obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
72                         } else {
73                             obj.controller.view.sel_edit.setAttribute('disabled','false');
74                             obj.controller.view.sel_backdate.setAttribute('disabled','false');
75                             obj.controller.view.sel_opac.setAttribute('disabled','false');
76                             obj.controller.view.sel_patron.setAttribute('disabled','false');
77                             obj.controller.view.sel_last_patron.setAttribute('disabled','false');
78                             obj.controller.view.sel_copy_details.setAttribute('disabled','false');
79                             obj.controller.view.sel_bucket.setAttribute('disabled','false');
80                             obj.controller.view.sel_spine.setAttribute('disabled','false');
81                             obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
82                             obj.controller.view.sel_clip.setAttribute('disabled','false');
83                             obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
84                         }
85                     } catch(E) {
86                         alert('FIXME: ' + E);
87                     }
88                 }
89             }
90         );
91         
92         JSAN.use('util.controller'); obj.controller = new util.controller();
93         obj.controller.init(
94             {
95                 'control_map' : {
96                     'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
97                     'sel_clip' : [
98                         ['command'],
99                         function() { 
100                             obj.list.clipboard(); 
101                             obj.controller.view.checkin_barcode_entry_textbox.focus();
102                         }
103                     ],
104                     'sel_edit' : [
105                         ['command'],
106                         function() {
107                             try {
108                                 obj.spawn_copy_editor();
109                             } catch(E) {
110                                 alert(E);
111                             }
112                         }
113                     ],
114                     'sel_spine' : [
115                         ['command'],
116                         function() {
117                             JSAN.use('cat.util');
118                             cat.util.spawn_spine_editor(obj.selection_list);
119                         }
120                     ],
121                     'sel_opac' : [
122                         ['command'],
123                         function() {
124                             JSAN.use('cat.util');
125                             cat.util.show_in_opac(obj.selection_list);
126                         }
127                     ],
128                     'sel_transit_abort' : [
129                         ['command'],
130                         function() {
131                             JSAN.use('circ.util');
132                             circ.util.abort_transits(obj.selection_list);
133                         }
134                     ],
135                     'sel_patron' : [
136                         ['command'],
137                         function() {
138                             JSAN.use('circ.util');
139                             circ.util.show_last_few_circs(obj.selection_list);
140                         }
141                     ],
142                     'sel_last_patron' : [
143                         ['command'],
144                         function() {
145                             var patrons = {};
146                             for (var i = 0; i < obj.selection_list.length; i++) {
147                                 var circs = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),obj.selection_list[i].copy_id,1]);
148                                 if (circs.length > 0) {
149                                     patrons[circs[0].usr()] = 1;
150                                 } else {
151                                     alert(document.getElementById('circStrings').getFormattedString('staff.circ.item_no_circs', [obj.selection_list[i].barcode]));
152                                 }
153                             }
154                             for (var i in patrons) {
155                                 xulG.new_patron_tab({},{'id' : i});
156                             }
157                         }
158                     ],
159                     'sel_copy_details' : [
160                         ['command'],
161                         function() {
162                             JSAN.use('circ.util');
163                             for (var i = 0; i < obj.selection_list.length; i++) {
164                                 circ.util.show_copy_details( obj.selection_list[i].copy_id );
165                             }
166                         }
167                     ],
168                     'sel_backdate' : [
169                         ['command'],
170                         function() {
171                             JSAN.use('circ.util');
172                             var circ_ids = [];
173                             for (var i = 0; i < obj.selection_list.length; i++) {
174                                 var circ_id = obj.selection_list[i].circ_id; 
175                                 var copy_id = obj.selection_list[i].copy_id; 
176                                 if (!circ_id) {
177                                     var blob = obj.network.simple_request('FM_ACP_DETAILS',[ses(),copy_id]);
178                                     if (blob.circ) circ_id = blob.circ.id();
179                                 }
180                                 if (!circ_id) continue;
181                                 circ_ids.push( circ_id );
182                             }
183                             circ.util.backdate_post_checkin( circ_ids );
184                         }
185                     ],
186                     'sel_mark_items_damaged' : [
187                         ['command'],
188                         function() {
189                             var funcs = [];
190                             JSAN.use('cat.util'); JSAN.use('util.functional');
191                             cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
192                         }
193                     ],
194                     'sel_bucket' : [
195                         ['command'],
196                         function() {
197                             JSAN.use('cat.util');
198                             cat.util.add_copies_to_bucket(obj.selection_list);
199                         }
200                     ],
201                     'checkin_barcode_entry_textbox' : [
202                         ['keypress'],
203                         function(ev) {
204                             if (ev.keyCode && ev.keyCode == 13) {
205                                 obj.checkin();
206                             }
207                         }
208                     ],
209                     'checkin_effective_date_label' : [
210                         ['render'],
211                         function(e) {
212                             return function() {
213                                 obj.controller.view.checkin_effective_datepicker.value =
214                                     util.date.formatted_date(new Date(),'%F');
215                             };
216                         }
217                     ],
218                     'checkin_effective_datepicker' : [
219                         ['change'],
220                         function(ev) {
221                             if (ev.target.nodeName == 'datepicker') {
222                                 try {
223                                     if ( ev.target.dateValue > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
224                                     var x = document.getElementById('background');
225                                     if (x) {
226                                         if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) {
227                                             //addCSSClass(x,'checkin_screen_normal');
228                                             removeCSSClass(x,'checkin_screen_backdating');
229                                             removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
230                                             removeCSSClass(document.getElementById('background'),'checkin_screen_suppress_holds_and_transits');
231                                             removeCSSClass(document.getElementById('background'),'checkin_screen_amnesty_mode');
232                                             removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
233                                             document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
234                                         } else {
235                                             addCSSClass(x,'checkin_screen_backdating');
236                                             //removeCSSClass(x,'checkin_screen_normal');
237                                             document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.backdated_checkin', [ev.target.value]));
238                                         }
239                                     }
240                                 } catch(E) {
241                                     var x = document.getElementById('background');
242                                     if (x) {
243                                         //addCSSClass(x,'checkin_screen_normal');
244                                         removeCSSClass(x,'checkin_screen_backdating');
245                                         removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
246                                         removeCSSClass(document.getElementById('background'),'checkin_screen_suppress_holds_and_transits');
247                                         removeCSSClass(document.getElementById('background'),'checkin_screen_amnesty_mode');
248                                         removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
249                                         document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
250                                     }
251                                     dump('checkin:effective_date: ' + E + '\n');
252                                     ev.target.disabled = true;
253                                     //alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
254                                     ev.target.value = util.date.formatted_date(new Date(),'%F');
255                                     ev.target.disabled = false;
256                                     JSAN.use('util.sound'); var sound = new util.sound(); sound.bad();
257                                     
258                                 }
259                             }
260                         }
261                     ],
262                     'cmd_broken' : [
263                         ['command'],
264                         function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
265                     ],
266                     'cmd_checkin_submit_barcode' : [
267                         ['command'],
268                         function() {
269                             obj.checkin();
270                         }
271                     ],
272                     'cmd_checkin_print' : [
273                         ['command'],
274                         function() {
275                             var p = { 
276                                 'template' : 'checkin'
277                             };
278                             obj.list.print(p);
279                         }
280                     ],
281                     'cmd_csv_to_clipboard' : [ ['command'], function() { 
282                         obj.list.dump_csv_to_clipboard(); 
283                         obj.controller.view.checkin_barcode_entry_textbox.focus();
284                     } ],
285                     'cmd_csv_to_printer' : [ ['command'], function() { 
286                         obj.list.dump_csv_to_printer(); 
287                         obj.controller.view.checkin_barcode_entry_textbox.focus();
288                     } ],
289                     'cmd_csv_to_file' : [ ['command'], function() { 
290                         obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } ); 
291                         obj.controller.view.checkin_barcode_entry_textbox.focus();
292                     } ],
293                     'cmd_do_not_alert_on_precat' : [ ['command'], function(ev) {
294                         dump('in cmd_do_not_alert_on_precat\n');
295                         var bg = document.getElementById('background');
296                         var cb = document.getElementById('do_not_alert_on_precat');
297                         var ind = document.getElementById('do_not_alert_on_precat_indicator');
298                         var cn = 'checkin_screen_do_not_alert_on_precat';
299                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
300                         ind.hidden = cb.getAttribute('checked') != 'true'; 
301                         document.getElementById('checkin_barcode_entry_textbox').focus();
302                         return true;
303                     } ],
304                     'cmd_suppress_holds_and_transits' : [ ['command'], function(ev) {
305                         dump('in cmd_suppress_holds_and_transits\n');
306                         var bg = document.getElementById('background');
307                         var cb = document.getElementById('suppress_holds_and_transits');
308                         var ind = document.getElementById('suppress_holds_and_transits_indicator');
309                         var cn = 'checkin_screen_suppress_holds_and_transits';
310                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
311                         ind.hidden = cb.getAttribute('checked') != 'true'; 
312                         document.getElementById('checkin_barcode_entry_textbox').focus();
313                         return true;
314                     } ],
315                     'cmd_amnesty_mode' : [ ['command'], function(ev) {
316                         dump('in cmd_amnesty_mode\n');
317                         var bg = document.getElementById('background');
318                         var cb = document.getElementById('amnesty_mode');
319                         var ind = document.getElementById('amnesty_mode_indicator');
320                         var cn = 'checkin_screen_amnesty_mode';
321                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
322                         ind.hidden = cb.getAttribute('checked') != 'true'; 
323                         document.getElementById('checkin_barcode_entry_textbox').focus();
324                         return true;
325                     } ],
326                     'cmd_checkin_auto_print_slips' : [ ['command'], function(ev) {
327                         dump('in cmd_checkin_auto_print_slips\n');
328                         var bg = document.getElementById('background');
329                         var cb = document.getElementById('checkin_auto_print_slips');
330                         var ind = document.getElementById('checkin_auto_print_slips_indicator');
331                         var cn = 'checkin_screen_checkin_auto_print_slips';
332                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
333                         ind.hidden = cb.getAttribute('checked') != 'true'; 
334                         document.getElementById('checkin_barcode_entry_textbox').focus();
335                         return true;
336                     } ]
337                 }
338             }
339         );
340         this.controller.render();
341         this.controller.view.checkin_barcode_entry_textbox.focus();
342
343     },
344
345     'gen_list_retrieve_row_func' : function() {
346         var obj = this;
347         return function(params) {
348             try {
349                 var row = params.row;
350                 if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
351
352                 if (row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
353                     var bill = row.my.mbts;
354                     if (Number(bill.balance_owed()) == 0) { return; }
355                     if (document.getElementById('no_change_label')) {
356                         var m = document.getElementById('no_change_label').getAttribute('value');
357                         document.getElementById('no_change_label').setAttribute(
358                             'value', 
359                             m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + '  '
360                         );
361                         document.getElementById('no_change_label').setAttribute('hidden','false');
362                     }
363                     if (document.getElementById('fine_tally')) {
364                         var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() );
365                         document.getElementById('fine_tally').setAttribute('amount',amount);
366                         document.getElementById('fine_tally').setAttribute(
367                             'value',
368                             document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ])
369                         );
370                         document.getElementById('fine_tally').setAttribute('hidden','false');
371                     }
372                 }
373
374             } catch(E) {
375                 alert('Error in checkin.js, list_retrieve_row(): ' + E);
376             }
377             return row;
378         };
379     },
380
381     'test_barcode' : function(bc) {
382         var obj = this;
383         var x = document.getElementById('strict_barcode');
384         if (x && x.checked != true) return true;
385         var good = util.barcode.check(bc);
386         if (good) {
387             return true;
388         } else {
389             if ( 1 == obj.error.yns_alert(
390                         document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
391                         document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
392                         document.getElementById('circStrings').getString('staff.circ.cancel'),
393                         document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
394                         null,
395                         document.getElementById('circStrings').getString('staff.circ.confirm'),
396                         '/xul/server/skin/media/images/bad_barcode.png'
397             ) ) {
398                 return true;
399             } else {
400                 return false;
401             }
402         }
403     },
404
405     'checkin' : function() {
406         var obj = this;
407         try {
408             var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
409             if (!barcode) return;
410             if (barcode) {
411                 if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
412             }
413             var backdate = obj.controller.view.checkin_effective_datepicker.value;
414             var auto_print = document.getElementById('checkin_auto_print_slips');
415             if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
416             JSAN.use('circ.util');
417             var params = { 
418                 'barcode' : barcode,
419                 'disable_textbox' : function() { 
420                     obj.controller.view.checkin_barcode_entry_textbox.disabled = true; 
421                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'true'); 
422                 },
423                 'enable_textbox' : function() { 
424                     obj.controller.view.checkin_barcode_entry_textbox.disabled = false; 
425                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false'); 
426                 },
427                 'checkin_result' : function(checkin) {
428                     obj.controller.view.checkin_barcode_entry_textbox.disabled = false;
429                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false'); 
430                     obj.checkin2(checkin,backdate);
431                 }
432             }; 
433             var suppress_holds_and_transits = document.getElementById('suppress_holds_and_transits');
434             if (suppress_holds_and_transits) suppress_holds_and_transits = suppress_holds_and_transits.getAttribute('checked') == 'true';
435             if (suppress_holds_and_transits) params.noop = 1;
436             var amnesty_mode = document.getElementById('amnesty_mode');
437             if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true';
438             if (amnesty_mode) params.void_overdues = 1;
439             circ.util.checkin_via_barcode(
440                 ses(), 
441                 params,
442                 backdate, 
443                 auto_print
444             );
445         } catch(E) {
446             obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.exception', [E]), E);
447             if (typeof obj.on_failure == 'function') {
448                 obj.on_failure(E);
449             }
450             if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
451                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.external') + '\n');
452                 window.xulG.on_failure(E);
453             } else {
454                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.no_external') + '\n');
455             }
456         }
457
458     },
459
460     'checkin2' : function(checkin,backdate) {
461         var obj = this;
462         try {
463             if (!checkin) return obj.on_failure(); /* circ.util.checkin handles errors and returns null currently */
464             if (checkin.ilsevent == 7010 /* COPY_ALERT_MESSAGE */
465                 || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
466                 || checkin.ilsevent == -1 /* offline */
467                 || checkin.ilsevent == 1502 /* ASSET_COPY_NOT_FOUND */
468                 || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
469                 || checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */ 
470                 || checkin.ilsevent == 7011 /* COPY_STATUS_LOST */ 
471                 || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
472             var retrieve_id = js2JSON( { 'circ_id' : checkin.circ ? checkin.circ.id() : null , 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
473             if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
474             if (document.getElementById('trim_list')) {
475                 var x = document.getElementById('trim_list');
476                 if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
477             }
478             obj.list.append(
479                 {
480                     'retrieve_id' : retrieve_id,
481                     'row' : {
482                         'my' : {
483                             'circ' : checkin.circ,
484                             'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
485                             'mvr' : checkin.record,
486                             'acp' : checkin.copy,
487                             'au' : checkin.patron,
488                             'status' : checkin.status,
489                             'route_to' : checkin.route_to,
490                             'message' : checkin.message
491                         }
492                     },
493                     'to_top' : true
494                 }
495             );
496             obj.list.node.view.selection.select(0);
497
498             JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
499
500             if (typeof obj.on_checkin == 'function') {
501                 obj.on_checkin(checkin);
502             }
503             if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
504                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.external') + '\n');
505                 window.xulG.on_checkin(checkin);
506             } else {
507                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.no_external') + '\n');
508             }
509
510             return true;
511
512         } catch(E) {
513             obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin2.exception', [E]));
514             if (typeof obj.on_failure == 'function') {
515                 obj.on_failure(E);
516             }
517             if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
518                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.external') + '\n');
519                 window.xulG.on_failure(E);
520             } else {
521                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.no_external') + '\n');
522             }
523         }
524
525     },
526
527     'on_checkin' : function() {
528         this.controller.view.checkin_barcode_entry_textbox.disabled = false;
529         this.controller.view.checkin_barcode_entry_textbox.select();
530         this.controller.view.checkin_barcode_entry_textbox.value = '';
531         this.controller.view.checkin_barcode_entry_textbox.focus();
532     },
533
534     'on_failure' : function() {
535         this.controller.view.checkin_barcode_entry_textbox.disabled = false;
536         this.controller.view.checkin_barcode_entry_textbox.select();
537         this.controller.view.checkin_barcode_entry_textbox.focus();
538     },
539     
540     'spawn_copy_editor' : function() {
541
542         var obj = this;
543
544         JSAN.use('util.functional');
545
546         var list = obj.selection_list;
547
548         list = util.functional.map_list(
549             list,
550             function (o) {
551                 return o.copy_id;
552             }
553         );
554
555         JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
556
557     }
558
559 }
560
561 dump('exiting circ.checkin.js\n');