From: phasefx Date: Wed, 5 Sep 2007 14:18:41 +0000 (+0000) Subject: Disable the Owning Lib field in the item attribute editor if a pre-cataloged item... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3453b6e1dee4bfb6a4819f0cb2721db71f67f1ac;p=Evergreen.git Disable the Owning Lib field in the item attribute editor if a pre-cataloged item is in the mix. Owning Lib isn't really a field on items, but on volumes, and is in the interface for convenience. The volume and record for a pre-cat is special, and we don't want to clone it by accident with this interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@7756 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 8963d04e4f..9541f2d206 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -507,6 +507,23 @@ g.apply_owning_lib = function(ou_id) { } } +/******************************************************************************************************/ +/* This returns true if none of the copies being edited are pre-cats */ + +g.safe_to_change_owning_lib = function() { + try { + var safe = true; + for (var i = 0; i < g.copies.length; i++) { + var cn = g.copies[i].call_number(); + if (typeof cn == 'object') { cn = cn.id(); } + if (cn == -1) { safe = false; } + } + return safe; + } catch(E) { + g.error.standard_unexpected_error_alert('safe_to_change_owning_lib?',E); + return false; + } +} /******************************************************************************************************/ /* This returns true if none of the copies being edited have a magical status found in my_constants.magical_statuses */ @@ -748,7 +765,7 @@ g.panes_and_field_names = { "Owning Lib : Call Number", { render: 'fm.call_number();', - input: 'c = function(v){ g.apply_owning_lib(v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.data.list.aou, function(obj) { var sname = obj.shortname(); for (i = sname.length; i < 20; i++) sname += " "; return [ obj.name() ? sname + " " + obj.name() : obj.shortname(), obj.id(), ( ! get_bool( g.data.hash.aout[ obj.ou_type() ].can_have_vols() ) ), ( g.data.hash.aout[ obj.ou_type() ].depth() * 2), ]; }), g.data.list.au[0].ws_ou()); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', + input: g.safe_to_change_owning_lib() ? 'c = function(v){ g.apply_owning_lib(v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.data.list.aou, function(obj) { var sname = obj.shortname(); for (i = sname.length; i < 20; i++) sname += " "; return [ obj.name() ? sname + " " + obj.name() : obj.shortname(), obj.id(), ( ! get_bool( g.data.hash.aout[ obj.ou_type() ].can_have_vols() ) ), ( g.data.hash.aout[ obj.ou_type() ].depth() * 2), ]; }), g.data.list.au[0].ws_ou()); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);' : undefined, } ], [