]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/checkin.js
More CSS configurability for Checkin/Hold Capture interfaces, mostly so we can style...
[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                                                         for (var i = 0; i < obj.selection_list.length; i++) {
173                                 var circ_id = obj.selection_list[i].circ_id; 
174                                 var copy_id = obj.selection_list[i].copy_id; 
175                                 if (!circ_id) {
176                                     var blob = obj.network.simple_request('FM_ACP_DETAILS',[ses(),copy_id]);
177                                     if (blob.circ) circ_id = blob.circ.id();
178                                 }
179                                 if (!circ_id) continue;
180                                                                 circ.util.backdate_post_checkin( circ_id );
181                                                         }
182                                                 }
183                                         ],
184                                         'sel_mark_items_damaged' : [
185                                                 ['command'],
186                                                 function() {
187                                                         var funcs = [];
188                                                         JSAN.use('cat.util'); JSAN.use('util.functional');
189                                                         cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
190                                                 }
191                                         ],
192                                         'sel_bucket' : [
193                                                 ['command'],
194                                                 function() {
195                                                         JSAN.use('cat.util');
196                                                         cat.util.add_copies_to_bucket(obj.selection_list);
197                                                 }
198                                         ],
199                                         'checkin_barcode_entry_textbox' : [
200                                                 ['keypress'],
201                                                 function(ev) {
202                                                         if (ev.keyCode && ev.keyCode == 13) {
203                                                                 obj.checkin();
204                                                         }
205                                                 }
206                                         ],
207                                         'checkin_effective_date_label' : [
208                                                 ['render'],
209                                                 function(e) {
210                                                         return function() {
211                                                                 obj.controller.view.checkin_effective_datepicker.value =
212                                                                         util.date.formatted_date(new Date(),'%F');
213                                                         };
214                                                 }
215                                         ],
216                                         'checkin_effective_datepicker' : [
217                                                 ['change'],
218                                                 function(ev) {
219                                                         if (ev.target.nodeName == 'datepicker') {
220                                                                 try {
221                                                                         if ( ev.target.dateValue > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
222                                                                         var x = document.getElementById('background');
223                                                                         if (x) {
224                                                                                 if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) {
225                                             //addCSSClass(x,'checkin_screen_normal');
226                                             removeCSSClass(x,'checkin_screen_backdating');
227                                             removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
228                                             removeCSSClass(document.getElementById('background'),'checkin_screen_suppress_holds_and_transits');
229                                             removeCSSClass(document.getElementById('background'),'checkin_screen_amnesty_mode');
230                                             removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
231                                                                                         document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
232                                                                                 } else {
233                                             addCSSClass(x,'checkin_screen_backdating');
234                                             //removeCSSClass(x,'checkin_screen_normal');
235                                                                                         document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.backdated_checkin', [ev.target.value]));
236                                                                                 }
237                                                                         }
238                                                                 } catch(E) {
239                                                                         var x = document.getElementById('background');
240                                                                         if (x) {
241                                         //addCSSClass(x,'checkin_screen_normal');
242                                         removeCSSClass(x,'checkin_screen_backdating');
243                                         removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
244                                         removeCSSClass(document.getElementById('background'),'checkin_screen_suppress_holds_and_transits');
245                                         removeCSSClass(document.getElementById('background'),'checkin_screen_amnesty_mode');
246                                         removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
247                                         document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
248                                     }
249                                                                         dump('checkin:effective_date: ' + E + '\n');
250                                     ev.target.disabled = true;
251                                                                         //alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
252                                     ev.target.value = util.date.formatted_date(new Date(),'%F');
253                                     ev.target.disabled = false;
254                                                 JSAN.use('util.sound'); var sound = new util.sound(); sound.bad();
255                                     
256                                                                 }
257                                                         }
258                                                 }
259                                         ],
260                                         'cmd_broken' : [
261                                                 ['command'],
262                                                 function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
263                                         ],
264                                         'cmd_checkin_submit_barcode' : [
265                                                 ['command'],
266                                                 function() {
267                                                         obj.checkin();
268                                                 }
269                                         ],
270                                         'cmd_checkin_print' : [
271                                                 ['command'],
272                                                 function() {
273                                                         var p = { 
274                                                                 'template' : 'checkin'
275                                                         };
276                                                         obj.list.print(p);
277                                                 }
278                                         ],
279                                         'cmd_csv_to_clipboard' : [ ['command'], function() { 
280                         obj.list.dump_csv_to_clipboard(); 
281                         obj.controller.view.checkin_barcode_entry_textbox.focus();
282                     } ],
283                                         'cmd_csv_to_printer' : [ ['command'], function() { 
284                         obj.list.dump_csv_to_printer(); 
285                         obj.controller.view.checkin_barcode_entry_textbox.focus();
286                     } ],
287                                         'cmd_csv_to_file' : [ ['command'], function() { 
288                         obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } ); 
289                         obj.controller.view.checkin_barcode_entry_textbox.focus();
290                     } ],
291                     'cmd_do_not_alert_on_precat' : [ ['command'], function(ev) {
292                         dump('in cmd_do_not_alert_on_precat\n');
293                         var bg = document.getElementById('background');
294                         var cb = document.getElementById('do_not_alert_on_precat');
295                         var ind = document.getElementById('do_not_alert_on_precat_indicator');
296                         var cn = 'checkin_screen_do_not_alert_on_precat';
297                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
298                         ind.hidden = cb.getAttribute('checked') != 'true'; 
299                         document.getElementById('checkin_barcode_entry_textbox').focus();
300                         return true;
301                     } ],
302                     'cmd_suppress_holds_and_transits' : [ ['command'], function(ev) {
303                         dump('in cmd_suppress_holds_and_transits\n');
304                         var bg = document.getElementById('background');
305                         var cb = document.getElementById('suppress_holds_and_transits');
306                         var ind = document.getElementById('suppress_holds_and_transits_indicator');
307                         var cn = 'checkin_screen_suppress_holds_and_transits';
308                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
309                         ind.hidden = cb.getAttribute('checked') != 'true'; 
310                         document.getElementById('checkin_barcode_entry_textbox').focus();
311                         return true;
312                     } ],
313                     'cmd_amnesty_mode' : [ ['command'], function(ev) {
314                         dump('in cmd_amnesty_mode\n');
315                         var bg = document.getElementById('background');
316                         var cb = document.getElementById('amnesty_mode');
317                         var ind = document.getElementById('amnesty_mode_indicator');
318                         var cn = 'checkin_screen_amnesty_mode';
319                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
320                         ind.hidden = cb.getAttribute('checked') != 'true'; 
321                         document.getElementById('checkin_barcode_entry_textbox').focus();
322                         return true;
323                     } ],
324                     'cmd_checkin_auto_print_slips' : [ ['command'], function(ev) {
325                         dump('in cmd_checkin_auto_print_slips\n');
326                         var bg = document.getElementById('background');
327                         var cb = document.getElementById('checkin_auto_print_slips');
328                         var ind = document.getElementById('checkin_auto_print_slips_indicator');
329                         var cn = 'checkin_screen_checkin_auto_print_slips';
330                         if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); }
331                         ind.hidden = cb.getAttribute('checked') != 'true'; 
332                         document.getElementById('checkin_barcode_entry_textbox').focus();
333                         return true;
334                     } ]
335                                 }
336                         }
337                 );
338                 this.controller.render();
339                 this.controller.view.checkin_barcode_entry_textbox.focus();
340
341         },
342
343     'gen_list_retrieve_row_func' : function() {
344         var obj = this;
345         return function(params) {
346             try {
347                 var row = params.row;
348                 if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
349
350                 if (row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
351                     var bill = row.my.mbts;
352                     if (Number(bill.balance_owed()) == 0) { return; }
353                     if (document.getElementById('no_change_label')) {
354                         var m = document.getElementById('no_change_label').getAttribute('value');
355                         document.getElementById('no_change_label').setAttribute(
356                             'value', 
357                             m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + '  '
358                         );
359                         document.getElementById('no_change_label').setAttribute('hidden','false');
360                     }
361                     if (document.getElementById('fine_tally')) {
362                         var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() );
363                         document.getElementById('fine_tally').setAttribute('amount',amount);
364                         document.getElementById('fine_tally').setAttribute(
365                             'value',
366                             document.getElementById('circStrings').getFormattedString('staff.circ.utils.fine_tally_text', [ util.money.sanitize( amount ) ])
367                         );
368                         document.getElementById('fine_tally').setAttribute('hidden','false');
369                     }
370                 }
371
372             } catch(E) {
373                 alert('Error in checkin.js, list_retrieve_row(): ' + E);
374             }
375             return row;
376         };
377     },
378
379         'test_barcode' : function(bc) {
380                 var obj = this;
381                 var x = document.getElementById('strict_barcode');
382                 if (x && x.checked != true) return true;
383                 var good = util.barcode.check(bc);
384                 if (good) {
385                         return true;
386                 } else {
387                         if ( 1 == obj.error.yns_alert(
388                                                 document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
389                                                 document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
390                                                 document.getElementById('circStrings').getString('staff.circ.cancel'),
391                                                 document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
392                                                 null,
393                                                 document.getElementById('circStrings').getString('staff.circ.confirm'),
394                                                 '/xul/server/skin/media/images/bad_barcode.png'
395                         ) ) {
396                                 return true;
397                         } else {
398                                 return false;
399                         }
400                 }
401         },
402
403         'checkin' : function() {
404                 var obj = this;
405                 try {
406                         var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
407                         if (!barcode) return;
408                         if (barcode) {
409                                 if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
410                         }
411                         var backdate = obj.controller.view.checkin_effective_datepicker.value;
412                         var auto_print = document.getElementById('checkin_auto_print_slips');
413                         if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
414                         JSAN.use('circ.util');
415             var params = { 
416                 'barcode' : barcode,
417                 'disable_textbox' : function() { 
418                     obj.controller.view.checkin_barcode_entry_textbox.disabled = true; 
419                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'true'); 
420                 },
421                 'enable_textbox' : function() { 
422                     obj.controller.view.checkin_barcode_entry_textbox.disabled = false; 
423                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false'); 
424                 },
425                 'checkin_result' : function(checkin) {
426                     obj.controller.view.checkin_barcode_entry_textbox.disabled = false;
427                     obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false'); 
428                     obj.checkin2(checkin,backdate);
429                 }
430             }; 
431                         var suppress_holds_and_transits = document.getElementById('suppress_holds_and_transits');
432                         if (suppress_holds_and_transits) suppress_holds_and_transits = suppress_holds_and_transits.getAttribute('checked') == 'true';
433             if (suppress_holds_and_transits) params.noop = 1;
434                         var amnesty_mode = document.getElementById('amnesty_mode');
435                         if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true';
436             if (amnesty_mode) params.void_overdues = 1;
437                         circ.util.checkin_via_barcode(
438                                 ses(), 
439                 params,
440                 backdate, 
441                 auto_print
442                         );
443                 } catch(E) {
444                         obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.exception', [E]), E);
445                         if (typeof obj.on_failure == 'function') {
446                                 obj.on_failure(E);
447                         }
448                         if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
449                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.external') + '\n');
450                                 window.xulG.on_failure(E);
451                         } else {
452                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.no_external') + '\n');
453                         }
454                 }
455
456         },
457
458         'checkin2' : function(checkin,backdate) {
459                 var obj = this;
460                 try {
461                         if (!checkin) return obj.on_failure(); /* circ.util.checkin handles errors and returns null currently */
462                         if (checkin.ilsevent == 7010 /* COPY_ALERT_MESSAGE */
463                                 || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
464                                 || checkin.ilsevent == -1 /* offline */
465                                 || checkin.ilsevent == 1502 /* ASSET_COPY_NOT_FOUND */
466                                 || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
467                                 || checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */ 
468                                 || checkin.ilsevent == 7011 /* COPY_STATUS_LOST */ 
469                                 || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
470                         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 ) } );
471                         if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
472                         if (document.getElementById('trim_list')) {
473                                 var x = document.getElementById('trim_list');
474                                 if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
475                         }
476                         obj.list.append(
477                                 {
478                                         'retrieve_id' : retrieve_id,
479                                         'row' : {
480                                                 'my' : {
481                                                         'circ' : checkin.circ,
482                                                         'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
483                                                         'mvr' : checkin.record,
484                                                         'acp' : checkin.copy,
485                                                         'au' : checkin.patron,
486                                                         'status' : checkin.status,
487                                                         'route_to' : checkin.route_to,
488                                                         'message' : checkin.message
489                                                 }
490                                         },
491                                         'to_top' : true
492                                 }
493                         );
494                         obj.list.node.view.selection.select(0);
495
496                         JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
497
498                         if (typeof obj.on_checkin == 'function') {
499                                 obj.on_checkin(checkin);
500                         }
501                         if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
502                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.external') + '\n');
503                                 window.xulG.on_checkin(checkin);
504                         } else {
505                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.no_external') + '\n');
506                         }
507
508                         return true;
509
510                 } catch(E) {
511                         obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin2.exception', [E]));
512                         if (typeof obj.on_failure == 'function') {
513                                 obj.on_failure(E);
514                         }
515                         if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
516                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.external') + '\n');
517                                 window.xulG.on_failure(E);
518                         } else {
519                                 obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.no_external') + '\n');
520                         }
521                 }
522
523         },
524
525         'on_checkin' : function() {
526                 this.controller.view.checkin_barcode_entry_textbox.disabled = false;
527                 this.controller.view.checkin_barcode_entry_textbox.select();
528                 this.controller.view.checkin_barcode_entry_textbox.value = '';
529                 this.controller.view.checkin_barcode_entry_textbox.focus();
530         },
531
532         'on_failure' : function() {
533                 this.controller.view.checkin_barcode_entry_textbox.disabled = false;
534                 this.controller.view.checkin_barcode_entry_textbox.select();
535                 this.controller.view.checkin_barcode_entry_textbox.focus();
536         },
537         
538         'spawn_copy_editor' : function() {
539
540                 var obj = this;
541
542                 JSAN.use('util.functional');
543
544                 var list = obj.selection_list;
545
546                 list = util.functional.map_list(
547                         list,
548                         function (o) {
549                                 return o.copy_id;
550                         }
551                 );
552
553                 JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
554
555         }
556
557 }
558
559 dump('exiting circ.checkin.js\n');