1 dump('entering patron.holds.js\n');
3 if (typeof patron == 'undefined') patron = {};
4 patron.holds = function (params) {
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'});
11 patron.holds.prototype = {
17 'init' : function( params ) {
21 obj.patron_id = params['patron_id'];
22 obj.docid = params['docid'];
23 obj.shelf = params['shelf'];
25 JSAN.use('circ.util');
26 var columns = circ.util.hold_columns(
28 'title' : { 'hidden' : false, 'flex' : '3' },
29 'request_time' : { 'hidden' : false },
30 'pickup_lib_shortname' : { 'hidden' : false },
31 'hold_type' : { 'hidden' : false },
32 'current_copy' : { 'hidden' : false },
33 'capture_time' : { 'hidden' : false },
34 'notify_time' : { 'hidden' : false },
35 'notify_count' : { 'hidden' : false },
39 JSAN.use('util.list'); obj.list = new util.list('holds_list');
43 'map_row_to_column' : circ.util.std_map_row_to_column(),
44 'retrieve_row' : function(params) {
47 var status_robj = obj.network.simple_request('FM_AHR_STATUS',[ ses(), row.my.ahr.id() ]);
48 row.my.status = status_robj;
49 if (row.my.ahr.current_copy()) {
50 row.my.acp = obj.network.simple_request( 'FM_ACP_RETRIEVE', [ row.my.ahr.current_copy() ]);
52 switch(row.my.ahr.hold_type()) {
54 row.my.mvr = obj.network.request(
55 api.MODS_SLIM_METARECORD_RETRIEVE.app,
56 api.MODS_SLIM_METARECORD_RETRIEVE.method,
57 [ row.my.ahr.target() ]
61 row.my.mvr = obj.network.request(
62 api.MODS_SLIM_RECORD_RETRIEVE.app,
63 api.MODS_SLIM_RECORD_RETRIEVE.method,
64 [ row.my.ahr.target() ]
68 row.my.acn = obj.network.simple_request( 'FM_ACN_RETRIEVE', [ row.my.ahr.target() ]);
69 row.my.mvr = obj.network.request(
70 api.MODS_SLIM_RECORD_RETRIEVE.app,
71 api.MODS_SLIM_RECORD_RETRIEVE.method,
72 [ row.my.acn.record() ]
76 if (typeof row.my.acp == 'undefined') {
77 row.my.acp = obj.network.simple_request( 'FM_ACP_RETRIEVE', [ row.my.ahr.target() ]);
79 if (typeof row.my.acp.call_number() == 'object') {
80 row.my.acn = my.acp.call_number();
82 row.my.acn = obj.network.simple_request( 'FM_ACN_RETRIEVE', [ row.my.acp.call_number() ]);
84 row.my.mvr = obj.network.request(
85 api.MODS_SLIM_RECORD_RETRIEVE.app,
86 api.MODS_SLIM_RECORD_RETRIEVE.method,
87 [ row.my.acn.record() ]
92 obj.error.sdump('D_ERROR','retrieve_row: ' + E );
94 if (typeof params.on_retrieve == 'function') {
95 params.on_retrieve(row);
99 'on_select' : function(ev) {
100 JSAN.use('util.functional');
101 var sel = obj.list.retrieve_selection();
102 obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
103 obj.retrieve_ids = util.functional.map_list(
105 function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
107 if (obj.retrieve_ids.length > 0) {
108 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
109 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
110 obj.controller.view.sel_copy_details.setAttribute('disabled','false');
111 obj.controller.view.sel_patron.setAttribute('disabled','false');
112 obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','false');
113 obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','false');
114 obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','false');
115 obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','false');
116 obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','false');
117 obj.controller.view.cmd_show_notifications.setAttribute('disabled','false');
118 obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false');
119 obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false');
120 obj.controller.view.cmd_show_catalog.setAttribute('disabled','false');
122 obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
123 obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
124 obj.controller.view.sel_copy_details.setAttribute('disabled','true');
125 obj.controller.view.sel_patron.setAttribute('disabled','true');
126 obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','true');
127 obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','true');
128 obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
129 obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
130 obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
131 obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
132 obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
133 obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
134 obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
141 JSAN.use('util.controller'); obj.controller = new util.controller();
145 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
148 function() { obj.list.clipboard(); }
152 function() { alert('Not Yet Implemented'); }
157 JSAN.use('circ.util');
158 circ.util.show_last_few_circs(obj.retrieve_ids);
161 'sel_mark_items_damaged' : [
164 JSAN.use('cat.util'); JSAN.use('util.functional');
165 cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
168 'sel_mark_items_missing' : [
171 JSAN.use('cat.util'); JSAN.use('util.functional');
172 cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
175 'sel_copy_details' : [
178 JSAN.use('circ.util');
179 for (var i = 0; i < obj.retrieve_ids.length; i++) {
180 if (obj.retrieve_ids[i].copy_id) circ.util.show_copy_details( obj.retrieve_ids[i].copy_id );
184 'cmd_holds_print' : [
188 dump(js2JSON(obj.list.dump_with_keys()) + '\n');
189 function flesh_callback() {
191 JSAN.use('patron.util');
193 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id),
194 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
195 'staff' : obj.data.list.au[0],
196 'header' : obj.data.print_list_templates.holds.header,
197 'line_item' : obj.data.print_list_templates.holds.line_item,
198 'footer' : obj.data.print_list_templates.holds.footer,
199 'type' : obj.data.print_list_templates.holds.type,
200 'list' : obj.list.dump_with_keys(),
202 JSAN.use('util.print'); var print = new util.print();
203 print.tree_list( params );
204 setTimeout(function(){obj.list.on_all_fleshed = null;},0);
206 obj.error.standard_unexpected_error_alert('print 2',E);
209 obj.list.on_all_fleshed = flesh_callback;
210 obj.list.full_retrieve();
212 obj.error.standard_unexpected_error_alert('print 1',E);
216 'cmd_show_notifications' : [
220 JSAN.use('util.window'); var win = new util.window();
221 for (var i = 0; i < obj.retrieve_ids.length; i++) {
222 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
224 xulG.url_prefix(urls.XUL_HOLD_NOTICES)
225 + '?ahr_id=' + obj.retrieve_ids[i].id,
226 'hold_notices_' + obj.retrieve_ids[i].id,
231 obj.error.standard_unexpected_error_alert('Error rendering/retrieving hold notifications.',E);
235 'cmd_holds_edit_selection_depth' : [
239 JSAN.use('util.widgets'); JSAN.use('util.functional');
240 var ws_type = obj.data.hash.aout[ obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].ou_type() ];
241 var list = util.functional.map_list(
242 util.functional.filter_list(
245 if (o.depth() > ws_type.depth()) return false;
246 if (o.depth() < ws_type.depth()) return true;
247 return (o.id() == ws_type.id());
259 ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
260 ml.setAttribute('id','selection');
261 ml.setAttribute('name','fancy_data');
262 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
263 xml += '<description>Please choose a Hold Range:</description>';
264 xml += util.widgets.serialize_node(ml);
266 var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
267 bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
268 bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
269 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
270 obj.data.temp_mid = xml; obj.data.stash('temp_mid');
271 obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
273 urls.XUL_FANCY_PROMPT
274 + '?xml_in_stash=temp_mid'
275 + '&bottom_xml_in_stash=temp_bot'
276 + '&title=' + window.escape('Choose a Pick Up Library'),
277 'fancy_prompt', 'chrome,resizable,modal'
279 obj.data.init({'via':'stash'});
280 if (obj.data.fancy_prompt_data == '') { return; }
281 var selection = obj.data.fancy_prompt_data.selection;
282 var msg = 'Are you sure you would like to change the Hold Range for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + obj.data.hash.aout[selection].opac_label() + '"?';
283 var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
285 for (var i = 0; i < obj.retrieve_ids.length; i++) {
286 var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
287 hold.selection_depth( obj.data.hash.aout[selection].depth() ); hold.ischanged('1');
288 var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
289 if (typeof robj.ilsevent != 'undefined') throw(robj);
294 obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
299 'cmd_holds_edit_pickup_lib' : [
303 JSAN.use('util.widgets'); JSAN.use('util.functional');
304 var list = util.functional.map_list(
307 var sname = o.shortname(); for (i = sname.length; i < 20; i++) sname += ' ';
309 o.name() ? sname + ' ' + o.name() : o.shortname(),
311 ( obj.data.hash.aout[ o.ou_type() ].can_have_users() == 0),
312 ( obj.data.hash.aout[ o.ou_type() ].depth() * 2),
316 ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
317 ml.setAttribute('id','lib');
318 ml.setAttribute('name','fancy_data');
319 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
320 xml += '<description>Please choose a new Pickup Library:</description>';
321 xml += util.widgets.serialize_node(ml);
323 var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
324 bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
325 bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
326 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
327 obj.data.temp_mid = xml; obj.data.stash('temp_mid');
328 obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
330 urls.XUL_FANCY_PROMPT
331 + '?xml_in_stash=temp_mid'
332 + '&bottom_xml_in_stash=temp_bot'
333 + '&title=' + window.escape('Choose a Pick Up Library'),
334 'fancy_prompt', 'chrome,resizable,modal'
336 obj.data.init({'via':'stash'});
337 if (obj.data.fancy_prompt_data == '') { return; }
338 var pickup_lib = obj.data.fancy_prompt_data.lib;
339 var msg = 'Are you sure you would like to change the Pick Up Lib for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to ' + obj.data.hash.aou[pickup_lib].shortname() + '?';
340 var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
342 for (var i = 0; i < obj.retrieve_ids.length; i++) {
343 var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
344 hold.pickup_lib( pickup_lib ); hold.ischanged('1');
345 var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
346 if (typeof robj.ilsevent != 'undefined') throw(robj);
351 obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
355 'cmd_holds_edit_phone_notify' : [
359 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
360 xml += '<description>Please enter a new phone number for hold notification (leave the field empty to disable phone notification):</description>';
361 xml += '<textbox id="phone" name="fancy_data"/>';
363 var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
364 bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
365 bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
366 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
367 obj.data.temp_mid = xml; obj.data.stash('temp_mid');
368 obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
370 urls.XUL_FANCY_PROMPT
371 + '?xml_in_stash=temp_mid'
372 + '&bottom_xml_in_stash=temp_bot'
373 + '&title=' + window.escape('Choose a Hold Notification Phone Number')
375 'fancy_prompt', 'chrome,resizable,modal'
377 obj.data.init({'via':'stash'});
378 if (obj.data.fancy_prompt_data == '') { return; }
379 var phone = obj.data.fancy_prompt_data.phone;
380 var msg = 'Are you sure you would like to change the Notification Phone Number for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + phone + '"?';
381 var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
383 for (var i = 0; i < obj.retrieve_ids.length; i++) {
384 var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
385 hold.phone_notify( phone ); hold.ischanged('1');
386 var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
387 if (typeof robj.ilsevent != 'undefined') throw(robj);
392 obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
396 'cmd_holds_edit_email_notify' : [
400 var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
401 xml += '<description>Send email notifications (when appropriate)? The email address used is found in the hold recepient account.</description>';
402 xml += '<hbox><button value="email" label="Email" accesskey="E" name="fancy_submit"/>';
403 xml += '<button value="noemail" label="No Email" accesskey="N" name="fancy_submit"/></hbox>';
405 var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
406 bot_xml += '<spacer flex="1"/><button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
407 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
408 obj.data.temp_mid = xml; obj.data.stash('temp_mid');
409 obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
411 urls.XUL_FANCY_PROMPT
412 + '?xml_in_stash=temp_mid'
413 + '&bottom_xml_in_stash=temp_bot'
414 + '&title=' + window.escape('Set Email Notification for Holds'),
415 'fancy_prompt', 'chrome,resizable,modal'
417 obj.data.init({'via':'stash'});
418 if (obj.data.fancy_prompt_data == '') { return; }
419 var email = obj.data.fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
420 var msg = 'Are you sure you would like ' + ( get_bool( email ) ? 'enable' : 'disable' ) + ' email notification for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
421 var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
423 for (var i = 0; i < obj.retrieve_ids.length; i++) {
424 var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
425 hold.email_notify( email ); hold.ischanged('1');
426 var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
427 if (typeof robj.ilsevent != 'undefined') throw(robj);
432 obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
438 'cmd_holds_retarget' : [
442 JSAN.use('util.functional');
443 var msg = 'Are you sure you would like to reset hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
444 var r = obj.error.yns_alert(msg,'Resetting Holds','Yes','No',null,'Check here to confirm this message');
446 for (var i = 0; i < obj.retrieve_ids.length; i++) {
447 var robj = obj.network.simple_request('FM_AHR_RESET',[ ses(), obj.retrieve_ids[i].id]);
448 if (typeof robj.ilsevent != 'undefined') throw(robj);
453 obj.error.standard_unexpected_error_alert('Holds not likely reset.',E);
459 'cmd_holds_cancel' : [
463 JSAN.use('util.functional');
464 var msg = 'Are you sure you would like to cancel hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
465 var r = obj.error.yns_alert(msg,'Cancelling Holds','Yes','No',null,'Check here to confirm this message');
467 for (var i = 0; i < obj.retrieve_ids.length; i++) {
468 var robj = obj.network.simple_request('FM_AHR_CANCEL',[ ses(), obj.retrieve_ids[i].id]);
469 if (typeof robj.ilsevent != 'undefined') throw(robj);
474 obj.error.standard_unexpected_error_alert('Holds not likely cancelled.',E);
478 'cmd_retrieve_patron' : [
483 for (var i = 0; i < obj.retrieve_ids.length; i++) {
484 var patron_id = obj.retrieve_ids[i].usr;
485 if (seen[patron_id]) continue; seen[patron_id] = true;
487 xulG.url_prefix(urls.XUL_PATRON_DISPLAY) + '?id=' + patron_id,
493 obj.error.standard_unexpected_error_alert('',E);
497 'cmd_show_catalog' : [
501 for (var i = 0; i < obj.retrieve_ids.length; i++) {
502 var htarget = obj.retrieve_ids[i].target;
503 var htype = obj.retrieve_ids[i].type;
507 opac_url = xulG.url_prefix( urls.opac_rresult ) + '?m=' + htarget;
510 opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + htarget;
513 var my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE', [ htarget ]);
514 opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
517 var my_acp = obj.network.simple_request( 'FM_ACP_RETRIEVE', [ htarget ]);
519 if (typeof my_acp.call_number() == 'object') {
520 my_acn = my.acp.call_number();
522 my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE',
523 [ my_acp.call_number() ]);
525 opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
528 obj.error.standard_unexpected_error_alert("I don't understand the hold type of " + htype + ", so I can't jump to the appropriate record in the catalog.", obj.retrieve_ids[i]);
532 var content_params = {
534 'authtime' : ses('authtime'),
535 'opac_url' : opac_url,
538 xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
539 {'tab_name': htype == 'M' ? 'Catalog' : 'Retrieving title...'},
544 obj.error.standard_unexpected_error_alert('',E);
551 obj.controller.render();
555 obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','true');
556 obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','true');
557 obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
558 obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
559 obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
560 obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
561 obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
562 obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
563 obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
566 'retrieve' : function(dont_show_me_the_list_change) {
568 if (window.xulG && window.xulG.holds) {
569 obj.holds = window.xulG.holds;
571 var method; var params = [ ses() ];
573 method = 'FM_AHR_RETRIEVE_VIA_AU';
574 params.push( obj.patron_id );
575 obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','true');
576 } else if (obj.docid) {
577 method = 'FM_AHR_RETRIEVE_ALL_VIA_BRE';
578 params.push( obj.docid );
579 obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
580 } else if (obj.pull) {
581 method = 'FM_AHR_PULL_LIST';
582 params.push( 50 ); params.push( 0 );
583 } else if (obj.shelf) {
584 method = 'FM_AHR_ONSHELF_RETRIEVE';
585 params.push( obj.data.list.au[0].ws_ou() );
586 obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
588 //method = 'FM_AHR_RETRIEVE_VIA_PICKUP_AOU';
589 method = 'FM_AHR_PULL_LIST';
590 params.push( 50 ); params.push( 0 );
591 obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
593 var robj = obj.network.simple_request( method, params );
594 if (typeof robj.ilsevent != 'undefined') throw(robj);
595 if (method == 'FM_AHR_RETRIEVE_ALL_VIA_BRE') {
597 obj.holds = obj.holds.concat( robj.copy_holds );
598 obj.holds = obj.holds.concat( robj.volume_holds );
599 obj.holds = obj.holds.concat( robj.title_holds );
600 obj.holds = obj.holds.sort();
606 function list_append(hold) {
607 obj.holds_map[ hold.id() ] = hold;
610 'retrieve_id' : js2JSON({
611 'copy_id':hold.current_copy(),
613 'type':hold.hold_type(),
614 'target':hold.target(),
626 function gen_list_append(hold) {
628 if (typeof hold == 'object') {
631 obj.network.simple_request('FM_AHR_RETRIEVE', [ ses(), hold ],
634 var robj = req.getResultObject();
635 if (typeof robj.ilsevent != 'undefined') throw(robj);
636 list_append(robj[0]);
638 obj.error.standard_unexpected_error_alert('Error retrieving hold #' + hold, E);
648 JSAN.use('util.exec'); var exec = new util.exec(2);
650 for (var i in obj.holds) {
651 rows.push( gen_list_append(obj.holds[i]) );
655 if (!dont_show_me_the_list_change) {
656 if (window.xulG && typeof window.xulG.on_list_change == 'function') {
657 try { window.xulG.on_list_change(obj.holds); } catch(E) { this.error.sdump('D_ERROR',E); }
663 dump('exiting patron.holds.js\n');