From 25cd82aed0601aa8c7001eb8f3e15302e7dea11f Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 20 Apr 2011 20:14:31 +0000 Subject: [PATCH] Add org unit settings for default status of newly added copies These two new org unit settings enable sites to control the default status of newly added copies. The defaults match the behaviour of the "Add Volumes" ("In Process") and "Fast Add" ("Available") interfaces as of Evergreen 1.6.1, but sites can choose to have the copies go directly to "Reshelving", "Available", or any other status defined in config.copy_status. The org unit settings are: * cat.default_copy_status_fast (for "Fast Add") * cat.default_copy_status_normal (for "Add Volumes") Signed-off-by: Dan Scott git-svn-id: svn://svn.open-ils.org/ILS/trunk@20263 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 16 ++++++++++++++ .../upgrade/0523.data.default-copy-status.sql | 21 +++++++++++++++++++ .../staff_client/chrome/content/cat/opac.js | 5 ++++- Open-ILS/xul/staff_client/server/cat/util.js | 6 +++++- .../server/cat/volume_copy_creator.js | 5 ++++- 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0523.data.default-copy-status.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index e2a36bb0f5..5bbb33d31d 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0522'); -- tsbere/phasefx +INSERT INTO config.upgrade_log (version) VALUES ('0523'); -- dbs CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 31da63442a..011178ad90 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -7968,3 +7968,19 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) 'coust', 'description'), 'bool' ); + +INSERT into config.org_unit_setting_type +( name, label, description, datatype, fm_class ) VALUES +( 'cat.default_copy_status_fast', + oils_i18n_gettext( 'cat.default_copy_status_fast', 'Cataloging: Default copy status (fast add)', 'coust', 'label'), + oils_i18n_gettext( 'cat.default_copy_status_fast', 'Default status when a copy is created using the "Fast Add" interface.', 'coust', 'description'), + 'link', 'ccs' +); + +INSERT into config.org_unit_setting_type +( name, label, description, datatype, fm_class ) VALUES +( 'cat.default_copy_status_normal', + oils_i18n_gettext( 'cat.default_copy_status_normal', 'Cataloging: Default copy status (normal)', 'coust', 'label'), + oils_i18n_gettext( 'cat.default_copy_status_normal', 'Default status when a copy is created using the normal volume/copy creator interface.', 'coust', 'description'), + 'link', 'ccs' +); diff --git a/Open-ILS/src/sql/Pg/upgrade/0523.data.default-copy-status.sql b/Open-ILS/src/sql/Pg/upgrade/0523.data.default-copy-status.sql new file mode 100644 index 0000000000..e3072f8769 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0523.data.default-copy-status.sql @@ -0,0 +1,21 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0523'); -- dbs + +INSERT into config.org_unit_setting_type +( name, label, description, datatype, fm_class ) VALUES +( 'cat.default_copy_status_fast', + oils_i18n_gettext( 'cat.default_copy_status_fast', 'Cataloging: Default copy status (fast add)', 'coust', 'label'), + oils_i18n_gettext( 'cat.default_copy_status_fast', 'Default status when a copy is created using the "Fast Add" interface.', 'coust', 'description'), + 'link', 'ccs' +); + +INSERT into config.org_unit_setting_type +( name, label, description, datatype, fm_class ) VALUES +( 'cat.default_copy_status_normal', + oils_i18n_gettext( 'cat.default_copy_status_normal', 'Cataloging: Default copy status (normal)', 'coust', 'label'), + oils_i18n_gettext( 'cat.default_copy_status_normal', 'Default status when a copy is created using the normal volume/copy creator interface.', 'coust', 'description'), + 'link', 'ccs' +); + +COMMIT; diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index 47b45ea6b2..2cce6c21c6 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -193,6 +193,9 @@ function set_marc_edit() { return; } + // Get the default copy status; default to available if unset, per 1.6 + var fast_ccs = g.data.hash.aous['cat.default_copy_status_fast'] || 0; + var copy_obj = new acp(); copy_obj.id( -1 ); copy_obj.isnew('1'); @@ -206,7 +209,7 @@ function set_marc_edit() { copy_obj.fine_level(2); // Normal copy_obj.loan_duration(2); // Normal copy_obj.location(1); // Stacks - copy_obj.status(5); // In Process + copy_obj.status(fast_ccs); copy_obj.circulate(get_db_true()); copy_obj.holdable(get_db_true()); copy_obj.opac_visible(get_db_true()); diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js index fe87355d56..750de178cd 100644 --- a/Open-ILS/xul/staff_client/server/cat/util.js +++ b/Open-ILS/xul/staff_client/server/cat/util.js @@ -517,6 +517,7 @@ cat.util.mark_item_missing = function(copy_ids) { cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) { var error; + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); try { JSAN.use('util.error'); error = new util.error(); @@ -532,6 +533,9 @@ cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) { return; } + // Get the default copy status; default to available if unset, per 1.6 + var fast_ccs = data.hash.aous['cat.default_copy_status_fast'] || 0; + var copy_obj = new acp(); copy_obj.id( -1 ); copy_obj.isnew('1'); @@ -545,7 +549,7 @@ cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) { copy_obj.fine_level(2); // Normal copy_obj.loan_duration(2); // Normal copy_obj.location(1); // Stacks - copy_obj.status(5); // In Process + copy_obj.status(fast_ccs); copy_obj.circulate(get_db_true()); copy_obj.holdable(get_db_true()); copy_obj.opac_visible(get_db_true()); diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index f7a68477c2..e394dfbb49 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -917,6 +917,9 @@ g.gather_copies = function() { var copies = []; var volume_data = {}; + // Get the default copy status; default to "In Process" if unset, per 1.6 + var normal_ccs = g.data.hash.aous['cat.default_copy_status_normal'] || 5; + function new_copy(acp_id,ou_id,acn_id,barcode) { var copy = new acp(); copy.id( acp_id ); @@ -931,7 +934,7 @@ g.gather_copies = function() { copy.fine_level(2); // Normal copy.loan_duration(2); // Normal copy.location(1); // Stacks - copy.status(5); // In Process + copy.status(normal_ccs); copy.circulate(get_db_true()); copy.holdable(get_db_true()); copy.opac_visible(get_db_true()); -- 2.43.2