From: Jason Etheridge Date: Mon, 28 Feb 2011 17:27:38 +0000 (-0500) Subject: enable editing in item attribute editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c87e36b8f22834056d6fa35ebf9406e630832b3c;p=evergreen%2Fequinox.git enable editing in item attribute editor --- diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 02d9aafa12..26f87703ee 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -65,44 +65,50 @@ function my_init() { if (xul_param('edit',{'modal_xulG':true}) == '1') { - // Editor desired, but let's check permissions - g.edit = false; + g.edit = true; - try { - var check = g.network.simple_request( - 'PERM_MULTI_ORG_CHECK', - [ - ses(), - g.data.list.au[0].id(), - util.functional.map_list( - g.copies, - function (o) { - var lib; - var cn_id = o.call_number(); - if (cn_id == -1) { - lib = o.circ_lib(); // base perms on circ_lib instead of owning_lib if pre-cat - } else { - if (! g.map_acn[ cn_id ]) { - var req = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ cn_id ]); - if (typeof req.ilsevent == 'undefined') { - g.map_acn[ cn_id ] = req; - lib = g.map_acn[ cn_id ].owning_lib(); + if (g.copies.length > 0) { // When loaded in the unified interface, there may be no copies yet (from the volum/item creator) + + // Editor desired, but let's check permissions + g.edit = false; + + try { + var check = g.network.simple_request( + 'PERM_MULTI_ORG_CHECK', + [ + ses(), + g.data.list.au[0].id(), + util.functional.map_list( + g.copies, + function (o) { + var lib; + var cn_id = o.call_number(); + if (cn_id == -1) { + lib = o.circ_lib(); // base perms on circ_lib instead of owning_lib if pre-cat + } else { + if (! g.map_acn[ cn_id ]) { + var req = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ cn_id ]); + if (typeof req.ilsevent == 'undefined') { + g.map_acn[ cn_id ] = req; + lib = g.map_acn[ cn_id ].owning_lib(); + } else { + lib = o.circ_lib(); + } } else { - lib = o.circ_lib(); + lib = g.map_acn[ cn_id ].owning_lib(); } - } else { - lib = g.map_acn[ cn_id ].owning_lib(); } + return typeof lib == 'object' ? lib.id() : lib; } - return typeof lib == 'object' ? lib.id() : lib; - } - ), - g.copies.length == 1 ? [ 'UPDATE_COPY' ] : [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ] - ] - ); - g.edit = check.length == 0; - } catch(E) { - g.error.standard_unexpected_error_alert('batch permission check',E); + ), + g.copies.length == 1 ? [ 'UPDATE_COPY' ] : [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ] + ] + ); + g.edit = check.length == 0; + } catch(E) { + g.error.standard_unexpected_error_alert('batch permission check',E); + } + } if (g.edit) { @@ -112,6 +118,7 @@ function my_init() { } else { $('top_nav').setAttribute('hidden','true'); } + } else { $('top_nav').setAttribute('hidden','true'); } diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_editor.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_editor.js index 6b95f7c063..46db75f9c2 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_editor.js @@ -13,9 +13,14 @@ function my_init() { try { window.xulG.set_tab_name('Test'); } catch(E) { alert(E); } }*/ + // Both interfaces look for this xulG.unified_interface = true; + + // Item Attribute Editor looks for these xulG.not_modal = true; + xulG.edit = true; + // Spawn the two interfaces JSAN.use('util.browser'); var volume_pane = new util.browser(); volume_pane.init(