[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 12ff8a789128e165c11151a1ceee96a68bb63b40
Evergreen Git
git at git.evergreen-ils.org
Tue May 24 23:06:46 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_1 has been updated
via 12ff8a789128e165c11151a1ceee96a68bb63b40 (commit)
via 65522373771faa49554342c12348940153e18a93 (commit)
from 20f0cc8ef1a2f4d567f85abf83b5d3c8c68a8e35 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 12ff8a789128e165c11151a1ceee96a68bb63b40
Author: Dan Scott <dan at coffeecode.net>
Date: Tue May 24 21:56:13 2011 -0400
Trivial line-wrapping patch for call number class defaults
Signed-off-by: Dan Scott <dan at coffeecode.net>
diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index f335713..735cc64 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -201,7 +201,14 @@ BEGIN
sortkey := NEW.label_sortkey;
IF NEW.label_class IS NULL THEN
- NEW.label_class := COALESCE( (SELECT substring(value from E'\\d+')::integer from actor.org_unit_setting WHERE name = 'cat.default_classification_scheme' AND org_unit = NEW.owning_lib), 1 );
+ NEW.label_class := COALESCE(
+ (
+ SELECT substring(value from E'\\d+')::integer
+ FROM actor.org_unit_setting
+ WHERE name = 'cat.default_classification_scheme'
+ AND org_unit = NEW.owning_lib
+ ), 1
+ );
END IF;
EXECUTE 'SELECT ' || acnc.normalizer || '(' ||
diff --git a/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql b/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
index 32be6a3..9b6f5c9 100644
--- a/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
@@ -11,7 +11,14 @@ BEGIN
sortkey := NEW.label_sortkey;
IF NEW.label_class IS NULL THEN
- NEW.label_class := COALESCE( (SELECT substring(value from E'\\d+')::integer from actor.org_unit_setting WHERE name = 'cat.default_classification_scheme' AND org_unit = NEW.owning_lib), 1);
+ NEW.label_class := COALESCE(
+ (
+ SELECT substring(value from E'\\d+')::integer
+ FROM actor.org_unit_setting
+ WHERE name = 'cat.default_classification_scheme'
+ AND org_unit = NEW.owning_lib
+ ), 1
+ );
END IF;
EXECUTE 'SELECT ' || acnc.normalizer || '(' ||
commit 65522373771faa49554342c12348940153e18a93
Author: Dan Wells <dbw2 at calvin.edu>
Date: Tue May 24 10:53:09 2011 -0400
Make label_class on any new call numbers default to org_unit setting
Evergreen 2.0 added a label_class column to the call number table with
one major purpose being the generation of correct sort keys. You can
also specify a default label class as an org unit setting. However:
1) There are no interface elements for setting the label class of an
individual call number.
2) The default setting from the actor.org_unit_setting
'cat.default_classification_scheme' value, if set, is not consulted
(that is, not set in the call number table) when new call numbers are
created.
These two facts together greatly reduce the utility of this very
valuable feature, as all new call numbers end up in the 'Generic' class.
While #1 has been addressed in 2.1+, there is still work to be done in
setting this class on import. Also, which interface parts (if any) make
it back to 2.0 is subject to debate.
This commit addresses #2.
See lp #787150.
Signed-off-by: Dan Wells <dbw2 at calvin.edu>
Signed-off-by: Dan Scott <dan at coffeecode.net>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 02db03c..2ade165 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 ('0540'); -- dbwells
+INSERT INTO config.upgrade_log (version) VALUES ('0541'); -- dbwells
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index 3e46a19..f335713 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -200,14 +200,16 @@ DECLARE
BEGIN
sortkey := NEW.label_sortkey;
+ IF NEW.label_class IS NULL THEN
+ NEW.label_class := COALESCE( (SELECT substring(value from E'\\d+')::integer from actor.org_unit_setting WHERE name = 'cat.default_classification_scheme' AND org_unit = NEW.owning_lib), 1 );
+ END IF;
+
EXECUTE 'SELECT ' || acnc.normalizer || '(' ||
quote_literal( NEW.label ) || ')'
FROM asset.call_number_class acnc
WHERE acnc.id = NEW.label_class
INTO sortkey;
-
NEW.label_sortkey = sortkey;
-
RETURN NEW;
END;
$func$ LANGUAGE PLPGSQL;
@@ -337,7 +339,7 @@ CREATE TABLE asset.call_number (
deleted BOOL NOT NULL DEFAULT FALSE,
prefix INT NOT NULL DEFAULT -1 REFERENCES asset.call_number_prefix(id) DEFERRABLE INITIALLY DEFERRED,
suffix INT NOT NULL DEFAULT -1 REFERENCES asset.call_number_suffix(id) DEFERRABLE INITIALLY DEFERRED,
- label_class BIGINT DEFAULT 1 NOT NULL
+ label_class BIGINT NOT NULL
REFERENCES asset.call_number_class(id)
DEFERRABLE INITIALLY DEFERRED,
label_sortkey TEXT
diff --git a/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql b/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
new file mode 100644
index 0000000..32be6a3
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
@@ -0,0 +1,27 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0541', :eg_version); -- dbwells
+
+ALTER TABLE asset.call_number ALTER COLUMN label_class DROP DEFAULT;
+
+CREATE OR REPLACE FUNCTION asset.label_normalizer() RETURNS TRIGGER AS $func$
+DECLARE
+ sortkey TEXT := '';
+BEGIN
+ sortkey := NEW.label_sortkey;
+
+ IF NEW.label_class IS NULL THEN
+ NEW.label_class := COALESCE( (SELECT substring(value from E'\\d+')::integer from actor.org_unit_setting WHERE name = 'cat.default_classification_scheme' AND org_unit = NEW.owning_lib), 1);
+ END IF;
+
+ EXECUTE 'SELECT ' || acnc.normalizer || '(' ||
+ quote_literal( NEW.label ) || ')'
+ FROM asset.call_number_class acnc
+ WHERE acnc.id = NEW.label_class
+ INTO sortkey;
+ NEW.label_sortkey = sortkey;
+ RETURN NEW;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/040.schema.asset.sql | 15 +++++++--
...0541.schema.call_number_honor_default_class.sql | 34 ++++++++++++++++++++
3 files changed, 47 insertions(+), 4 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0541.schema.call_number_honor_default_class.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list