From 5444b625ece967e379d045ffa789b74c98c92389 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 20 May 2011 16:42:11 -0400 Subject: [PATCH] Attempt at providing a per bib invocation of the unified vol/copy editor from Item Status, but it's very capable of exercising the bugs referenced below: https://bugs.launchpad.net/evergreen/+bug/787561 https://bugs.launchpad.net/evergreen/+bug/787563 Signed-off-by: Jason Etheridge --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../xul/staff_client/server/circ/copy_status.js | 56 ++++++++++++++++++++++ .../xul/staff_client/server/circ/copy_status.xul | 1 + .../server/circ/copy_status_overlay.xul | 4 ++ 4 files changed, 63 insertions(+) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 404302432f..8fecd6657a 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2293,6 +2293,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js index bfd7b79326..f7ac6ddf51 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.js +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js @@ -10,6 +10,8 @@ circ.copy_status = function (params) { JSAN.use('util.date'); JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'}); JSAN.use('util.sound'); this.sound = new util.sound(); + JSAN.use('cat.util'); + }; circ.copy_status.prototype = { @@ -57,6 +59,7 @@ circ.copy_status.prototype = { obj.controller.view.sel_checkin.setAttribute('disabled','true'); obj.controller.view.cmd_replace_barcode.setAttribute('disabled','true'); obj.controller.view.sel_edit.setAttribute('disabled','true'); + obj.controller.view.sel_vol_copy_edit.setAttribute('disabled','true'); obj.controller.view.sel_opac.setAttribute('disabled','true'); obj.controller.view.sel_bucket.setAttribute('disabled','true'); obj.controller.view.sel_record_bucket.setAttribute('disabled','true'); @@ -86,6 +89,7 @@ circ.copy_status.prototype = { obj.controller.view.sel_checkin.setAttribute('disabled','false'); obj.controller.view.cmd_replace_barcode.setAttribute('disabled','false'); obj.controller.view.sel_edit.setAttribute('disabled','false'); + obj.controller.view.sel_vol_copy_edit.setAttribute('disabled','false'); obj.controller.view.sel_opac.setAttribute('disabled','false'); obj.controller.view.sel_patron.setAttribute('disabled','false'); obj.controller.view.cmd_triggered_events.setAttribute('disabled','false'); @@ -741,6 +745,58 @@ circ.copy_status.prototype = { } ], + + 'sel_vol_copy_edit' : [ + ['command'], + function() { + try { + JSAN.use('util.functional'); + + var list = util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ); + + var copies = obj.network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE',[list]); + + if (list.length == 0) { return; } + + var map_acn = {}; + var rec_copy_map = {}; + + for (var i = 0; i < copies.length; i++) { + var volume_id = copies[i].call_number(); + if (! map_acn[volume_id]) { + map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]); + } + copies[i].call_number( map_acn[ volume_id ] ); + var record_id = map_acn[ volume_id ].record(); + if (!rec_copy_map[record_id]) { + rec_copy_map[record_id] = []; + } + rec_copy_map[record_id].push( copies[i] ); + } + + var timeout = 0; // FIXME: stagger invocation of each tab or they'll break for someone unknown reason + var vol_item_creator = function(items) { + setTimeout( + function() { + xulG.volume_item_creator({ 'existing_copies' : items }); + }, timeout + ); + timeout += 1000; + } + for (var r in rec_copy_map) { + if (r == -1) { /* no unified interface for pre-cats */ + cat.util.spawn_copy_editor( { 'copy_ids' : rec_copy_map[r], 'edit' : 1 } ); + } else { + vol_item_creator( rec_copy_map[r] ); + } + } + + } catch(E) { + obj.error.standard_unexpected_error_alert('copy status -> edit items/volumes per bib',E); + } + } + ], + 'cmd_edit_volumes' : [ ['command'], function() { diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.xul b/Open-ILS/xul/staff_client/server/circ/copy_status.xul index 6a1411a966..351b01b8b9 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.xul +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.xul @@ -139,6 +139,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul index d8ffd777a0..909b54765e 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul +++ b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul @@ -25,6 +25,7 @@ + @@ -52,6 +53,7 @@ + @@ -129,6 +131,7 @@ + @@ -167,6 +170,7 @@ + -- 2.11.0