From 1d7bb92106ed42ee326d80663db67cc1a3512907 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 24 Apr 2012 16:54:20 -0400 Subject: [PATCH] Admin -> Local Admin -> Item Attribute Editor Main purpose is to allow you to spawn the Item Attribute Editor for the purpose of configuring templates and using the Hide Fields feature without actually finding an item to work and putting it at risk of accidental modification. Signed-off-by: Jason Etheridge Signed-off-by: Jason Stephenson Signed-off-by: Ben Shum --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../xul/staff_client/chrome/content/main/menu.js | 11 ++++++ .../chrome/content/main/menu_frame_menus.xul | 2 + .../chrome/locale/en-US/offline.properties | 1 + .../xul/staff_client/server/cat/copy_editor.js | 44 ++++++++++++++++++++-- 5 files changed, 56 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 055f2e3028..182fb404dd 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -741,6 +741,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 55a36826ce..fc82016419 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -860,6 +860,17 @@ main.menu.prototype = { open_eg_web_page("conify/global/asset/copy_template"); } ], + "cmd_local_admin_item_attribute_editor": [ + ["oncommand"], + function(event) { + obj.command_tab( + event, + urls.XUL_COPY_EDITOR, + { 'tab_name' : offlineStrings.getString('menu.local_admin.item_attribute_editor.tab') }, + { 'admin' : true, 'not_modal' : true } + ); + } + ], 'cmd_local_admin_patrons_due_refunds' : [ ['oncommand'], function(event) { diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index 70128a9e7d..df90397312 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -149,6 +149,7 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 5a5b0c474b..68faca44f5 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -260,6 +260,7 @@ menu.cmd_authority_manage.tab=Manage Authorities menu.local_admin.barcode_completion.tab=Barcode Completion menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies +menu.local_admin.item_attribute_editor.tab=Admin Item Attribute Editor menu.local_admin.work_log.tab=Work Log menu.local_admin.patrons_due_refunds.tab=Patrons With Negative Balances menu.circulation.staged_patrons.tab=Pending Patrons 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 e430b8e73f..3e701ec6b0 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -53,6 +53,36 @@ function my_init() { g.callnumbers = xul_param('callnumbers',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_callnumbers','clear_xpcom':true}); /******************************************************************************************************/ + /* If invoked from the Local Admin menu, rig up a fake item and disable save/create functionality */ + + if (xulG.admin) { + xulG.edit = 1; + var fake_item = new acp(); + fake_item.id( -1 ); + fake_item.barcode( 'fake_item' ); + fake_item.call_number( -1 ); + fake_item.circ_lib(ses('ws_ou')); + /* FIXME -- use constants; really, refactor this into a library somewhere that can be used by chrome and + remote xul for new copies */ + fake_item.deposit(0); + fake_item.price(0); + fake_item.deposit_amount(0); + fake_item.fine_level(2); // Normal + fake_item.loan_duration(2); // Normal + fake_item.location(1); // Stacks + fake_item.status(0); + fake_item.circulate(get_db_true()); + fake_item.holdable(get_db_true()); + fake_item.opac_visible(get_db_true()); + fake_item.ref(get_db_false()); + fake_item.mint_condition(get_db_true()); + g.copies = [ fake_item ]; + $('save').hidden = true; + $('save').disabled = true; + $('non_unified_buttons').hidden = true; + } + + /******************************************************************************************************/ /* Get preference (if it exists) for copy location label order */ g.cl_first = false; // Default to legacy OU first mode @@ -609,10 +639,15 @@ g.apply_owning_lib = function(ou_id) { g.map_acn[copy.call_number()] = volume; } var old_volume = g.map_acn[copy.call_number()]; - var acn_blob = g.network.simple_request( - 'FM_ACN_FIND_OR_CREATE', - [ses(),old_volume.label(),old_volume.record(),ou_id,old_volume.prefix().id(),old_volume.suffix().id(),old_volume.label_class().id()] - ); + var acn_blob; + if (! xulG.admin) { + acn_blob = g.network.simple_request( + 'FM_ACN_FIND_OR_CREATE', + [ses(),old_volume.label(),old_volume.record(),ou_id,old_volume.prefix().id(),old_volume.suffix().id(),old_volume.label_class().id()] + ); + } else { + acn_blob = { 'acn_id' : -1 }; // spawned from Local Admin menu, so fake item and call number + } if (typeof acn_blob.ilsevent != 'undefined') { g.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_editor.apply_owning_lib.call_number.error', [copy.barcode()]), acn_blob); continue; @@ -633,6 +668,7 @@ g.apply_owning_lib = function(ou_id) { g.safe_to_change_owning_lib = function() { try { if (xulG.unified_interface) { return false; } + if (xulG.admin) { return false; } var safe = true; for (var i = 0; i < g.copies.length; i++) { var cn = g.copies[i].call_number(); -- 2.11.0