From: Thomas Berezansky Date: Thu, 19 Apr 2012 02:03:16 +0000 (-0400) Subject: Floating Groups X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=57dc684360119f598919401b85e60b8a9770c79c;p=working%2FEvergreen.git Floating Groups Convert the floating bool to a link to floating groups. Each group contains zero or more members that define how copies can float. See the included documentation file for an overview. Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 602ee6b874..d007e80edc 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3807,7 +3807,7 @@ SELECT usr, - + @@ -3834,6 +3834,7 @@ SELECT usr, + @@ -4812,7 +4813,7 @@ SELECT usr, - + @@ -4842,6 +4843,7 @@ SELECT usr, + @@ -4884,7 +4886,7 @@ SELECT usr, - + @@ -4895,6 +4897,7 @@ SELECT usr, + @@ -8811,6 +8814,47 @@ SELECT usr, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index fba805a0a0..a0b4a74e33 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -973,7 +973,7 @@ sub copy_details { { flesh => 2, flesh_fields => { - acp => ['call_number','parts','peer_record_maps'], + acp => ['call_number','parts','peer_record_maps','floating'], acn => ['record','prefix','suffix','label_class'] } } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 405583cd1e..f80a09a8cd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -32,7 +32,7 @@ sub determine_booking_status { my $MK_ENV_FLESH = { flesh => 2, - flesh_fields => {acp => ['call_number','parts'], acn => ['record']} + flesh_fields => {acp => ['call_number','parts','floating'], acn => ['record']} }; sub initialize { @@ -523,6 +523,7 @@ my @AUTOLOAD_FIELDS = qw/ skip_deposit_fee skip_rental_fee use_booking + manual_float /; @@ -2394,8 +2395,20 @@ sub do_checkin { } else { # copy needs to transit "home", or stick here if it's a floating copy - - if ($U->is_true( $self->copy->floating ) && !$self->remote_hold) { # copy is floating, stick here + my $can_float = 0; + if ($self->copy->floating && ($self->manual_float || !$U->is_true($self->copy->floating->manual)) && !$self->remote_hold) { # copy is potentially floating? + my $res = $self->editor->json_query( + { from => [ + 'evergreen.can_float', + $self->copy->floating->id, + $self->copy->circ_lib, + $self->circ_lib + ] + } + ); + $can_float = $U->is_true($res->[0]->{'evergreen.can_float'}) if $res; + } + if ($can_float) { # Yep, floating, stick here $self->checkin_changed(1); $self->copy->circ_lib( $self->circ_lib ); $self->update_copy; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 097aadcd34..6fbc88a7cd 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -77,7 +77,7 @@ CREATE TABLE asset.copy ( alert_message TEXT, opac_visible BOOL NOT NULL DEFAULT TRUE, deleted BOOL NOT NULL DEFAULT FALSE, - floating BOOL NOT NULL DEFAULT FALSE, + floating INT, dummy_isbn TEXT, status_changed_time TIMESTAMP WITH TIME ZONE, mint_condition BOOL NOT NULL DEFAULT TRUE, @@ -422,7 +422,7 @@ CREATE TABLE asset.copy_template ( circ_as_type TEXT, alert_message TEXT, opac_visible BOOL, - floating BOOL, + floating INT, mint_condition BOOL ); diff --git a/Open-ILS/src/sql/Pg/120.floating_groups.sql b/Open-ILS/src/sql/Pg/120.floating_groups.sql new file mode 100644 index 0000000000..cd04d91740 --- /dev/null +++ b/Open-ILS/src/sql/Pg/120.floating_groups.sql @@ -0,0 +1,51 @@ +-- Floating Groups +BEGIN; + +CREATE TABLE config.floating_group ( + id SERIAL PRIMARY KEY, + name TEXT UNIQUE NOT NULL, + manual BOOL NOT NULL DEFAULT FALSE + ); + +CREATE TABLE config.floating_group_member ( + id SERIAL PRIMARY KEY, + floating_group INT NOT NULL REFERENCES config.floating_group (id), + org_unit INT NOT NULL REFERENCES actor.org_unit (id), + stop_depth INT NOT NULL DEFAULT 0, + max_depth INT, + exclude BOOL NOT NULL DEFAULT FALSE + ); + +CREATE OR REPLACE FUNCTION evergreen.can_float( copy_floating_group integer, from_ou integer, to_ou integer ) RETURNS BOOL AS $f$ +DECLARE + float_member config.floating_group_member%ROWTYPE; + shared_ou_depth INT; + to_ou_depth INT; +BEGIN + -- Grab the shared OU depth. If this is less than the stop depth later we ignore the entry. + SELECT INTO shared_ou_depth max(depth) FROM actor.org_unit_common_ancestors( from_ou, to_ou ) aou JOIN actor.org_unit_type aout ON aou.ou_type = aout.id; + -- Grab the to ou depth. If this is greater than max depth we ignore the entry. + SELECT INTO to_ou_depth depth FROM actor.org_unit aou JOIN actor.org_unit_type aout ON aou.ou_type = aout.id WHERE aou.id = to_ou; + -- Grab float members that apply. We don't care what we get beyond wanting excluded ones first. + SELECT INTO float_member * + FROM + config.floating_group_member cfgm + JOIN actor.org_unit aou ON cfgm.org_unit = aou.id + JOIN actor.org_unit_type aout ON aou.ou_type = aout.id + WHERE + cfgm.floating_group = copy_floating_group + AND to_ou IN (SELECT id FROM actor.org_unit_descendants(aou.id)) + AND cfgm.stop_depth <= shared_ou_depth + AND (cfgm.max_depth IS NULL OR to_ou_depth <= max_depth) + ORDER BY + exclude DESC; + -- If we found something then we want to return the opposite of the exclude flag + IF FOUND THEN + RETURN NOT float_member.exclude; + END IF; + -- Otherwise no floating. + RETURN false; +END; +$f$ LANGUAGE PLPGSQL; + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 619441d356..5d6ab6fd46 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -117,4 +117,7 @@ ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT update_perm_fkey FOREIGN CREATE INDEX by_heading_and_thesaurus ON authority.record_entry (authority.normalize_heading(marc)) WHERE deleted IS FALSE or deleted = FALSE; +ALTER TABLE asset.copy ADD CONSTRAINT asset_copy_floating_fkey FOREIGN KEY (floating) REFERENCES config.floating_group (id) DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE asset.copy_template ADD CONSTRAINT asset_copy_template_floating_fkey FOREIGN KEY (floating) REFERENCES config.floating_group (id) DEFERRABLE INITIALLY DEFERRED; + COMMIT; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 67cd3f61f6..abb711a965 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1433,7 +1433,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 512, 'ACQ_INVOICE_REOPEN', oils_i18n_gettext( 512, 'Allows a user to reopen an Acquisitions invoice', 'ppl', 'description' )), ( 513, 'DEBUG_CLIENT', oils_i18n_gettext( 513, - 'Allows a user to use debug functions in the staff client', 'ppl', 'description' )); + 'Allows a user to use debug functions in the staff client', 'ppl', 'description' )), + ( 528, 'ADMIN_FLOAT_GROUPS', oils_i18n_gettext( 528, + 'Allows administration of floating groups', 'ppl', 'description' )); SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); @@ -8726,4 +8728,5 @@ INSERT INTO config.org_unit_setting_type 'bool' ); - +INSERT INTO config.floating_group(name) VALUES ('Everywhere'); +INSERT INTO config.floating_group_member(floating_group, org_unit) VALUES (1, 1); diff --git a/Open-ILS/src/sql/Pg/sql_file_manifest b/Open-ILS/src/sql/Pg/sql_file_manifest index 70d7dcda96..c3d6abc1b4 100644 --- a/Open-ILS/src/sql/Pg/sql_file_manifest +++ b/Open-ILS/src/sql/Pg/sql_file_manifest @@ -31,6 +31,7 @@ FTS_CONFIG_FILE 099.matrix_weights.sql 100.circ_matrix.sql 110.hold_matrix.sql +120.floating_groups.sql 210.schema.serials.sql 200.schema.acq.sql diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.floating_groups.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.floating_groups.sql new file mode 100644 index 0000000000..d454ec4c12 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.floating_groups.sql @@ -0,0 +1,87 @@ +BEGIN; + +CREATE TABLE config.floating_group ( + id SERIAL PRIMARY KEY, + name TEXT UNIQUE NOT NULL, + manual BOOL NOT NULL DEFAULT FALSE + ); + +CREATE TABLE config.floating_group_member ( + id SERIAL PRIMARY KEY, + floating_group INT NOT NULL REFERENCES config.floating_group (id), + org_unit INT NOT NULL REFERENCES actor.org_unit (id), + stop_depth INT NOT NULL DEFAULT 0, + max_depth INT, + exclude BOOL NOT NULL DEFAULT FALSE + ); + +CREATE OR REPLACE FUNCTION evergreen.can_float( copy_floating_group integer, from_ou integer, to_ou integer ) RETURNS BOOL AS $f$ +DECLARE + float_member config.floating_group_member%ROWTYPE; + shared_ou_depth INT; + to_ou_depth INT; +BEGIN + -- Grab the shared OU depth. If this is less than the stop depth later we ignore the entry. + SELECT INTO shared_ou_depth max(depth) FROM actor.org_unit_common_ancestors( from_ou, to_ou ) aou JOIN actor.org_unit_type aout ON aou.ou_type = aout.id; + -- Grab the to ou depth. If this is greater than max depth we ignore the entry. + SELECT INTO to_ou_depth depth FROM actor.org_unit aou JOIN actor.org_unit_type aout ON aou.ou_type = aout.id WHERE aou.id = to_ou; + -- Grab float members that apply. We don't care what we get beyond wanting excluded ones first. + SELECT INTO float_member * + FROM + config.floating_group_member cfgm + JOIN actor.org_unit aou ON cfgm.org_unit = aou.id + JOIN actor.org_unit_type aout ON aou.ou_type = aout.id + WHERE + cfgm.floating_group = copy_floating_group + AND to_ou IN (SELECT id FROM actor.org_unit_descendants(aou.id)) + AND cfgm.stop_depth <= shared_ou_depth + AND (cfgm.max_depth IS NULL OR to_ou_depth <= max_depth) + ORDER BY + exclude DESC; + -- If we found something then we want to return the opposite of the exclude flag + IF FOUND THEN + RETURN NOT float_member.exclude; + END IF; + -- Otherwise no floating. + RETURN false; +END; +$f$ LANGUAGE PLPGSQL; + +INSERT INTO config.floating_group(name) VALUES ('Everywhere'); +INSERT INTO config.floating_group_member(floating_group, org_unit) VALUES (1, 1); + +-- We need to drop these before we can update asset.copy +DROP VIEW auditor.asset_copy_lifecycle; +DROP VIEW auditor.serial_unit_lifecycle; + +-- Update the appropriate auditor tables +ALTER TABLE auditor.asset_copy_history + ALTER COLUMN floating DROP DEFAULT, + ALTER COLUMN floating DROP NOT NULL, + ALTER COLUMN floating TYPE int USING CASE WHEN floating THEN 1 ELSE NULL END; +ALTER TABLE auditor.serial_unit_history + ALTER COLUMN floating DROP DEFAULT, + ALTER COLUMN floating DROP NOT NULL, + ALTER COLUMN floating TYPE int USING CASE WHEN floating THEN 1 ELSE NULL END; + +-- Update asset.copy itself (does not appear to trigger update triggers!) +ALTER TABLE asset.copy + ALTER COLUMN floating DROP DEFAULT, + ALTER COLUMN floating DROP NOT NULL, + ALTER COLUMN floating TYPE int USING CASE WHEN floating THEN 1 ELSE NULL END; + +ALTER TABLE asset.copy ADD CONSTRAINT asset_copy_floating_fkey FOREIGN KEY (floating) REFERENCES config.floating_group (id) DEFERRABLE INITIALLY DEFERRED; + +-- Update asset.copy_template too +ALTER TABLE asset.copy_template + ALTER COLUMN floating TYPE int USING CASE WHEN floating THEN 1 ELSE NULL END; +ALTER TABLE asset.copy_template ADD CONSTRAINT asset_copy_template_floating_fkey FOREIGN KEY (floating) REFERENCES config.floating_group (id) DEFERRABLE INITIALLY DEFERRED; + +INSERT INTO permission.perm_list( code, description) VALUES +('ADMIN_FLOAT_GROUPS', 'Allows administration of floating groups'); + +-- And now we need to re-create those lifecycle views +SELECT auditor.create_auditor_lifecycle('asset','copy'); +SELECT auditor.create_auditor_lifecycle('serial','unit'); + +COMMIT; diff --git a/Open-ILS/web/js/ui/default/conify/global/config/floating_groups.js b/Open-ILS/web/js/ui/default/conify/global/config/floating_groups.js new file mode 100644 index 0000000000..666670ea91 --- /dev/null +++ b/Open-ILS/web/js/ui/default/conify/global/config/floating_groups.js @@ -0,0 +1,197 @@ +dojo.require('dijit.layout.ContentPane'); +dojo.require('dijit.form.Button'); +dojo.require('openils.widget.AutoGrid'); +dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('openils.PermaCrud'); +dojo.require('openils.widget.ProgressDialog'); + +var groupMemberEditor = null; +var groupMemberEntryCache = []; +var orgUnitCache = {}; + +function load(){ + cfgGrid.loadAll({order_by:{cfg:'name'}}); + cfgGrid.onEditPane = buildEditPaneAdditions; + cfgGrid.onPostUpdate = updateLinked; + cfgGrid.onPostCreate = updateLinked; + groupMemberEditor = dojo.byId('group-member-editor').parentNode.removeChild(dojo.byId('group-member-editor')); + + // Cache org unit info for later display + var pcrud = new openils.PermaCrud(); + var temp = pcrud.retrieveAll('aou'); + dojo.forEach(temp, function(g) { orgUnitCache[g.id()] = g; } ); +} + +function byName(name, ctxt) { + return dojo.query('[name=' + name + ']', ctxt)[0]; +} + +function buildEditPaneAdditions(editPane) { + groupMemberEntryCache = []; + var tr = document.createElement('tr'); + var td = document.createElement('td'); + td.setAttribute('colspan','2'); + // Explanation.... + // editPane.domNode.lastChild = Table + // .lastChild = Table Body + // .lastChild = Table Row containing Action Buttons + editPane.domNode.lastChild.lastChild.insertBefore(tr, editPane.domNode.lastChild.lastChild.lastChild); + tr.appendChild(td); + curGroupMemberEditor = groupMemberEditor.cloneNode(true); + td.appendChild(curGroupMemberEditor); + var groupMemberTmpl = byName('group-member-entry-tbody', curGroupMemberEditor).removeChild(byName('group-member-entry-row', curGroupMemberEditor)); + + var selector = new openils.widget.AutoFieldWidget({ + fmClass : 'cfgm', + fmField : 'org_unit', + parentNode : byName('org-unit-selector', curGroupMemberEditor) + }); + selector.build(); + + function addMember(ounit) { + var row = groupMemberTmpl.cloneNode(true); + row.setAttribute('org_unit', ounit); + byName('org-unit', row).innerHTML = orgUnitCache[ounit].shortname(); + byName('remove-group-member', row).onclick = function() { + byName('group-member-entry-tbody', cfgGrid.editPane.domNode).removeChild(row); + } + byName('group-member-entry-tbody', editPane.domNode).appendChild(row); + } + + byName('add-group-member', editPane.domNode).onclick = function() { + addMember(selector.widget.attr('value')); + } + + // On edit we need to load existing entries. + // On create, not so much. + if(!editPane.fmObject) return; + + if(editPane.mode == 'update') { + var pcrud = new openils.PermaCrud(); + groupMemberEntryCache = pcrud.search('cfgm', {floating_group: editPane.fmObject.id()}); + dojo.forEach(groupMemberEntryCache, function(g) { addGroupMember(groupMemberTmpl, g); } ); + } +} + +function addGroupMember(tmpl, group_member_entry) { + var row = tmpl.cloneNode(true); + row.setAttribute('group_member', group_member_entry.id()); + byName('org-unit', row).innerHTML = orgUnitCache[group_member_entry.org_unit()].shortname(); + byName('group-member-stop-depth', row).value = group_member_entry.stop_depth(); + if(group_member_entry.max_depth() != null) { + byName('group-member-max-depth', row).value = group_member_entry.max_depth(); + } + if(group_member_entry.exclude() == 't') { + byName('group-member-exclude', row).setAttribute('checked', 'true'); + } + byName('remove-group-member', row).onclick = function() { + byName('group-member-entry-tbody', cfgGrid.editPane.domNode).removeChild(row); + } + byName('group-member-entry-tbody', cfgGrid.editPane.domNode).appendChild(row); +} + +function updateLinked(fmObject, rowindex) { + var id = null; + if(rowindex != undefined && this.editPane && this.editPane.fmObject) { + // Edit, grab existing ID + id = this.editPane.fmObject.id(); + } else if(fmObject.id) { + // Create, grab new ID + id = fmObject.id(); + } + // If we don't have an ID, drop out. + if(id == null) return; + var pcrud = new openils.PermaCrud(); + progressDialog.show(true); + + var add = []; + var remove = []; + var update = []; + + var group_members = []; + dojo.query('[name=group-member-entry-row]', this.editPane.domNode).forEach( + function(row) { + var member_id = row.getAttribute('group_member'); + var cached; + if (member_id) + cached = groupMemberEntryCache.filter(function(i) { return (i.id() == member_id); })[0]; + var stop_depth = byName('group-member-stop-depth', row).value; + var max_depth = byName('group-member-max-depth', row).value; + if (max_depth === '') max_depth = null; + var exclude = byName('group-member-exclude', row).checked; + if (cached) { + group_members.push(member_id); + if((stop_depth != cached.stop_depth()) || (max_depth !== cached.max_depth()) || (exclude != (cached.exclude() == 't'))) { + cached.stop_depth(stop_depth); + cached.max_depth(max_depth); + cached.exclude(exclude ? 't' : 'f'); + cached.ischanged(true); + update.push(cached); + } + } else { + var entry = new fieldmapper.cfgm(); + var org_unit = row.getAttribute('org_unit'); + entry.isnew(true); + entry.floating_group(id); + entry.org_unit(org_unit); + entry.stop_depth(stop_depth); + entry.max_depth(max_depth); + entry.exclude(exclude ? 't' : 'f'); + add.push(entry); + } + } + ); + dojo.forEach(groupMemberEntryCache, function(eMember) { + if(!group_members.filter(function(i) { return (i == eMember.id()); })[0]) { + eMember.isdeleted(true); + remove.push(eMember); + } + } + ); + + function updateEntries() { + pcrud.update(update, { + oncomplete : function () { + progressDialog.hide(); + } + }); + } + + function removeEntries() { + pcrud.eliminate(remove, { + oncomplete : function () { + if(update.length) { + updateEntries(); + } else { + progressDialog.hide(); + } + } + }); + } + + function addEntries() { + pcrud.create(add, { + oncomplete : function () { + if(remove.length) { + removeEntries(); + } else if (update.length) { + updateEntries(); + } else { + progressDialog.hide(); + } + } + }); + } + + if(add.length) + addEntries(); + else if (remove.length) + removeEntries(); + else if (update.length) + updateEntries(); + else + progressDialog.hide(); +} + +openils.Util.addOnLoad(load); + diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index d08acf1016..ff03b1e939 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -737,6 +737,7 @@ + @@ -2193,6 +2194,8 @@ + + diff --git a/Open-ILS/web/templates/default/conify/global/config/floating_groups.tt2 b/Open-ILS/web/templates/default/conify/global/config/floating_groups.tt2 new file mode 100644 index 0000000000..035f647cc6 --- /dev/null +++ b/Open-ILS/web/templates/default/conify/global/config/floating_groups.tt2 @@ -0,0 +1,59 @@ +[% ctx.page_title = 'Floating Groups Configuration' %] +[% WRAPPER base.tt2 %] + +
+
Floating Groups Configuration
+
+
+
+ +
+
+ + + + + + +[% END %] + diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index 162964fc9d..e457850956 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -606,6 +606,27 @@ OpenILS.data.prototype = { this.chain.push( function() { var f = gen_fm_retrieval_func( + 'cfg', + [ + api.FM_CFG_RETRIEVE_VIA_PCRUD.app, + api.FM_CFG_RETRIEVE_VIA_PCRUD.method, + [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"cfg":"id"}} ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( 'csp', [ api.FM_CSP_PCRUD_SEARCH.app, diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index a134bdd810..7bad6ba84c 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -246,6 +246,7 @@ var api = { 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, 'FM_CNCT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_types.retrieve.all', 'secure' : false }, 'FM_CRAHP_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.config.rules.age_hold_protect.retrieve.all', 'secure' : false }, + 'FM_CFG_RETRIEVE_VIA_PCRUD' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.cfg.atomic', 'secure' : false }, 'FM_CSP_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.csp.atomic', 'secure' : false }, 'FM_CST_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.standings.retrieve', 'secure' : false }, 'FM_MB_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.create' }, 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 38bf9f7c63..8802c779a6 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -735,6 +735,10 @@ main.menu.prototype = { ['oncommand'], function(event) { open_eg_web_page('conify/global/config/weight_assoc', null, event); } ], + 'cmd_server_admin_floating_groups' : [ + ['oncommand'], + function(event) { open_eg_web_page('conify/global/config/floating_groups', 'menu.cmd_server_admin_floating_groups.tab', event); } + ], 'cmd_local_admin_external_text_editor' : [ ['oncommand'], function() { 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 e1d254c23d..395a01e52b 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 @@ -220,6 +220,9 @@ + @@ -490,6 +493,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 7dd52fcd3b..919086efda 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 @@ -298,3 +298,4 @@ menu.logoff.unsaved_data_warning=This session may have unsaved data. Logoff anyw menu.shutdown.unsaved_data_warning=This application may have unsaved data. Exit it anyway? hotkeys.Default=Default hotkeys.None=No Hotkeys +menu.cmd_server_admin_floating_groups.tab=Floating Groups 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 8f7f35d2d1..a7a16e25f3 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -981,8 +981,8 @@ g.panes_and_field_names = { [ $('catStrings').getString('staff.cat.copy_editor.field.floating.label'), { - render: 'fm.floating() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.floating() ) ? $("catStrings").getString("staff.cat.copy_editor.field.floating.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.floating.no_or_false") )', - input: 'c = function(v){ g.apply("floating",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.floating.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.floating.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', + render: 'fm.floating() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( typeof fm.floating() == "object" ? fm.floating().name() : g.data.hash.cfg[ fm.floating() ].name() )', + input: 'c = function(v){ g.apply("floating",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.remove_floating"), "" ] ].concat( util.functional.map_list( g.data.list.cfg, function(obj) { return [ obj.name(), obj.id() ]; }).sort() ) ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', } ], [ diff --git a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js index eb2b28eafa..4a419c253a 100644 --- a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js +++ b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js @@ -194,7 +194,7 @@ function load_item() { set("circ_modifier",""); } set("circulate", get_localized_bool( details.copy.circulate() )); - set("floating", get_localized_bool( details.copy.floating() )); + set("floating", (details.copy.floating() && typeof details.copy.floating() == 'object' ? details.copy.floating().name() : get_localized_bool( details.copy.floating() ))); set("copy_number", details.copy.copy_number()); set("copy_create_date", util.date.formatted_date( details.copy.create_date(), '%{localized}' )); set("status_changed_time", util.date.formatted_date( details.copy.status_changed_time(), '%{localized}' )); diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index dd7bc67c38..f19c0d07cc 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -407,6 +407,18 @@ circ.checkin.prototype = { ind.hidden = cb.getAttribute('checked') != 'true'; document.getElementById('checkin_barcode_entry_textbox').focus(); return true; + } ], + 'cmd_checkin_manual_float' : [ ['command'], function(ev) { + dump('in cmd_checkin_manual_float\n'); + var bg = document.getElementById('background'); + var cb = document.getElementById('checkin_manual_float'); + var ind = document.getElementById('checkin_manual_float_indicator'); + var cn = 'checkin_screen_checkin_manual_float'; + if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); } + ind.hidden = cb.getAttribute('checked') != 'true'; + document.getElementById('checkin_barcode_entry_textbox').focus(); + return true; + } ] } } @@ -564,6 +576,9 @@ circ.checkin.prototype = { var amnesty_mode = document.getElementById('amnesty_mode'); if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true'; if (amnesty_mode) params.void_overdues = 1; + var manual_float = document.getElementById('checkin_manual_float'); + if (manual_float) manual_float = manual_float.getAttribute('checked') == 'true'; + if (manual_float) params.manual_float = 1; circ.util.checkin_via_barcode( ses(), params, diff --git a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul index 522a740a1d..5cc09f00d7 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul +++ b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul @@ -35,6 +35,7 @@ + @@ -74,6 +75,7 @@ + @@ -173,6 +175,8 @@ label="&staff.circ.checkin_overlay.amnesty_mode.label;" accesskey="&staff.circ.checkin_overlay.amnesty_mode.accesskey;"/> + diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index d44cf225ad..b09d47400d 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -971,10 +971,14 @@ circ.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { - if (get_bool( my.acp.floating() )) { - return document.getElementById('circStrings').getString('staff.circ.utils.yes'); + if (my.acp.floating() && typeof my.acp.floating() == 'object') { + return my.acp.floating().name(); } else { - return document.getElementById('circStrings').getString('staff.circ.utils.no'); + if (get_bool( my.acp.floating() )) { + return document.getElementById('circStrings').getString('staff.circ.utils.yes'); + } else { + return document.getElementById('circStrings').getString('staff.circ.utils.no'); + } } }, 'persist' : 'hidden width ordinal' diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties index 3be182d019..a2d7c8789c 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -160,6 +160,7 @@ staff.cat.copy_editor.populate_stat_cat.error=Error populating statistical categ staff.cat.copy_editor.remove_stat_cat_entry= staff.cat.copy_editor.remove_age_based_hold_protection= staff.cat.copy_editor.remove_circulate_as_type= +staff.cat.copy_editor.remove_floating= staff.cat.copy_editor.field.unset_or_null= staff.cat.copy_editor.field.owning_library.label=Owning Lib : Call Number staff.cat.copy_editor.field.creator.label=Creator @@ -177,8 +178,6 @@ staff.cat.copy_editor.field.holdable.label=Holdable? staff.cat.copy_editor.field.holdable.yes_or_true=Yes staff.cat.copy_editor.field.holdable.no_or_false=No staff.cat.copy_editor.field.floating.label=Floating? -staff.cat.copy_editor.field.floating.yes_or_true=Yes -staff.cat.copy_editor.field.floating.no_or_false=No staff.cat.copy_editor.field.age_based_hold_protection.label=Age-based Hold Protection staff.cat.copy_editor.field.loan_duration.label=Loan Duration staff.cat.copy_editor.field.loan_duration.short=Short diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css index 7369275e50..ce0bb1e1da 100644 --- a/Open-ILS/xul/staff_client/server/skin/circ.css +++ b/Open-ILS/xul/staff_client/server/skin/circ.css @@ -51,6 +51,7 @@ treechildren::-moz-tree-row(backdate_failed,selected) { #suppress_holds_and_transits_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } #amnesty_mode_indicator { border: thick solid white; background-color: red; color: white; font-size: large; font-weight: bold; padding: 10px; padding-bottom: 25px; margin: 10px; } #checkin_auto_print_slips_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } +#checkin_manual_float_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } .big_emphasis1 { font-weight: bold; font-size: x-large; } .big_emphasis2 { font-weight: bold; font-size: large; } diff --git a/docs/floating_groups.txt b/docs/floating_groups.txt new file mode 100644 index 0000000000..a484c5e6fd --- /dev/null +++ b/docs/floating_groups.txt @@ -0,0 +1,122 @@ +Floating Groups +=============== +Thomas Berezansky +:Date: 2012-04-22 + +Before floating groups copies could float or not. If they floated then they floated everywhere, with no restrictions. + +After floating groups where a copy will float is defined by what group it has been assigned to. + +== Floating Groups + +Each floating group comes with a name and a manual flag, plus zero or more group members. The name is used solely for selection and display purposes. + +The manual flag dictates whether or not the "Manual Floating Active" checkin modifier needs to be active for a copy to float. This allows for greater control over when items float. It also prevents automated checkins via SIP2 from triggering floats. + +== Floating Group Members + +Each member of a floating group references an org unit and has a stop depth, an optional max depth, and an exclude flag. + +=== Org Unit + +The org unit and all descendants are included, unless max depth is set, in which case the tree is cut off at the max depth. + +=== Stop Depth + +The stop depth is the highest point from the current copy circ library to the checkin library for the item that will be traversed. If the item has to go higher than the stop depth on the tree the member rule in question is ignored. + +=== Max Depth + +As mentioned with the org unit, the max depth is the furthest down on the tree from the org unit that gets included. This is based on the entire tree, not just off of the org unit. So in the default tree a max depth of 1 will stop at the system level no matter if org unit is set to CONS or SYS1. + +=== Exclude + +Exclude, if set, causes floating to not happen for the member. Excludes always take priority, so you can remove an org unit from floating without having to worry about other rules overriding it. + +== Examples + +=== Float Everywhere + +This is a default floating rule to emulate the previous floating behavior for new installs and upgrades. + +One member: + +* Org Unit: CONS +* Stop Depth: 0 +* Max Depth: Unset +* Exclude: Off + +=== Float Within System + +This would permit a copy to float anywhere within a system, but would return to the system if it was returned elsewhere. + +One member: + +* Org Unit: CONS +* Stop Depth: 1 +* Max Depth: Unset +* Exclude: Off + +=== Float To All Branches + +This would permit a copy to float to any branch, but not to sublibraries or bookmobiles. + +One member: + +* Org Unit: CONS +* Stop Depth: 0 +* Max Depth: 2 +* Exclude: Off + +=== Float To All Branches Within System + +This would permit a copy to float to any branch in a system, but not to sublibraries or bookmobiles, and returning to the system if returned elsewhere. + +One member: + +* Org Unit: CONS +* Stop Depth: 1 +* Max Depth: 2 +* Exclude: Off + +=== Float Between BR1 and BR3 + +This would permit a copy to float between BR1 and BR3 specifically, excluding sublibraries and bookmobiles. + +It would consist of two members, identical other than the org unit: + +* Org Unit: BR1 / BR3 +* Stop Depth: 0 +* Max Depth: 2 +* Exclude: Off + +=== Float Everywhere Except BM1 + +This would allow an item to float anywhere except for BM1. It accomplishes this with two members. + +The first includes all org units, just like Float Everywhere: + +* Org Unit: CONS +* Stop Depth: 0 +* Max Depth: Unset +* Exclude: Off + +The second excludes BM1: + +* Org Unit: BM1 +* Stop Depth: 0 +* Max Depth: Unset +* Exclude: On + +That works because excludes are applied first. + +=== Float into, but not out of, BR2 + +This would allow an item to float into BR2, but once there it would never leave. Why you would want to allow items to float to but not from a single library I dunno, but here it is. This takes advantage of the fact that the rules say where we can float *to*, but outside of stop depth don't care where we are floating *from*. + +One member: + +* Org Unit: BR2 +* Stop Depth: 0 +* Max Depth: Unset +* Exclude: Off