[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0842413f0ed21ec741a0f16b5cbb27f2018357fc
Evergreen Git
git at git.evergreen-ils.org
Thu Apr 9 21:59:03 EDT 2015
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, master has been updated
via 0842413f0ed21ec741a0f16b5cbb27f2018357fc (commit)
via 7971f16f026c69f40d9aafc515bf1ccf2d58ed3f (commit)
from 6f658be6afc894f40d096f191374ad81f909a05d (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 0842413f0ed21ec741a0f16b5cbb27f2018357fc
Author: Ben Shum <bshum at biblio.org>
Date: Thu Apr 9 21:58:07 2015 -0400
LP#1442254: Stamping upgrade script for use-ws-lib-for-messages
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 2d5f0f5..751ad16 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0915', :eg_version); -- berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0916', :eg_version); -- gmcharlt/kmlussier/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql b/Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql
similarity index 91%
rename from Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql
rename to Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql
index 0163d0b..3cccc34 100644
--- a/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql
@@ -1,5 +1,7 @@
BEGIN;
+SELECT evergreen.upgrade_deps_block_check('0916', :eg_version);
+
CREATE OR REPLACE FUNCTION actor.convert_usr_note_to_message () RETURNS TRIGGER AS $$
DECLARE
sending_ou INTEGER;
commit 7971f16f026c69f40d9aafc515bf1ccf2d58ed3f
Author: Galen Charlton <gmc at esilibrary.com>
Date: Tue Mar 31 21:23:22 2015 +0000
LP#1442254: adjust how sending library set for messages created from notes
When creating a new user message from a public note, the library
of the workstation of the staff member who created the original
note is used if available from get_audit_info(). If it's not
available (e.g., if notes are added using direct SQL, the
home library of the note creator is used instead).
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/005.schema.actors.sql b/Open-ILS/src/sql/Pg/005.schema.actors.sql
index af27c3a..447d595 100644
--- a/Open-ILS/src/sql/Pg/005.schema.actors.sql
+++ b/Open-ILS/src/sql/Pg/005.schema.actors.sql
@@ -759,6 +759,8 @@ CREATE RULE protect_usr_message_delete AS
);
CREATE FUNCTION actor.convert_usr_note_to_message () RETURNS TRIGGER AS $$
+DECLARE
+ sending_ou INTEGER;
BEGIN
IF NEW.pub THEN
IF TG_OP = 'UPDATE' THEN
@@ -767,8 +769,16 @@ BEGIN
END IF;
END IF;
+ SELECT INTO sending_ou aw.owning_lib
+ FROM auditor.get_audit_info() agai
+ JOIN actor.workstation aw ON (aw.id = agai.eg_ws);
+ IF sending_ou IS NULL THEN
+ SELECT INTO sending_ou home_ou
+ FROM actor.usr
+ WHERE id = NEW.creator;
+ END IF;
INSERT INTO actor.usr_message (usr, title, message, sending_lib)
- VALUES (NEW.usr, NEW.title, NEW.value, (SELECT home_ou FROM actor.usr WHERE id = NEW.creator));
+ VALUES (NEW.usr, NEW.title, NEW.value, sending_ou);
END IF;
RETURN NEW;
diff --git a/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql b/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql
new file mode 100644
index 0000000..0163d0b
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql
@@ -0,0 +1,30 @@
+BEGIN;
+
+CREATE OR REPLACE FUNCTION actor.convert_usr_note_to_message () RETURNS TRIGGER AS $$
+DECLARE
+ sending_ou INTEGER;
+BEGIN
+ IF NEW.pub THEN
+ IF TG_OP = 'UPDATE' THEN
+ IF OLD.pub = TRUE THEN
+ RETURN NEW;
+ END IF;
+ END IF;
+
+ SELECT INTO sending_ou aw.owning_lib
+ FROM auditor.get_audit_info() agai
+ JOIN actor.workstation aw ON (aw.id = agai.eg_ws);
+ IF sending_ou IS NULL THEN
+ SELECT INTO sending_ou home_ou
+ FROM actor.usr
+ WHERE id = NEW.creator;
+ END IF;
+ INSERT INTO actor.usr_message (usr, title, message, sending_lib)
+ VALUES (NEW.usr, NEW.title, NEW.value, sending_ou);
+ END IF;
+
+ RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/005.schema.actors.sql | 12 +++++++-
.../0916.schema.use-ws-lib-for-messages.sql | 32 ++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list