[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. d1b2c6ab95aaba16712ef10a563895862f23c36c
Evergreen Git
git at git.evergreen-ils.org
Tue Mar 12 17:25:33 EDT 2013
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_3 has been updated
via d1b2c6ab95aaba16712ef10a563895862f23c36c (commit)
via 238f54e2c99cd0216dc14f17d7a1894fc9c31307 (commit)
from f74a13ac587cd4e6fdf9ca321882e448dfa765cc (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 d1b2c6ab95aaba16712ef10a563895862f23c36c
Author: Ben Shum <bshum at biblio.org>
Date: Tue Mar 12 17:22:36 2013 -0400
Stamping upgrade for inactive barcode retrieval
Signed-off-by: Ben Shum <bshum at biblio.org>
Conflicts:
Open-ILS/src/sql/Pg/002.schema.config.sql
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 8bbae74..5fa28df 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,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 ('0767', :eg_version); -- senator/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0770', :eg_version); -- mrpeters/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql b/Open-ILS/src/sql/Pg/upgrade/0770.function.allow_inactive_barcode_retrieve.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql
rename to Open-ILS/src/sql/Pg/upgrade/0770.function.allow_inactive_barcode_retrieve.sql
index 522f4a3..6be1463 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0770.function.allow_inactive_barcode_retrieve.sql
@@ -1,3 +1,7 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0770', :eg_version);
+
CREATE OR REPLACE FUNCTION evergreen.get_barcodes(select_ou INT, type TEXT, in_barcode TEXT) RETURNS SETOF evergreen.barcode_set AS $$
DECLARE
cur_barcode TEXT;
@@ -81,3 +85,5 @@ BEGIN
RETURN;
END;
$$ LANGUAGE plpgsql;
+
+COMMIT;
commit 238f54e2c99cd0216dc14f17d7a1894fc9c31307
Author: Michael Peters <mpeters at emeralddata.net>
Date: Tue Mar 12 16:14:23 2013 -0400
LP#1154235 Allow inactive patron barcode to be loaded
This addresses LP#1154235 by modifying the evergreen.get_barcodes
function to allow users to retrieve patrons in barcode retrieve
who have inactive barcodes.
This returns to functionality in versions prior to around 2.2.x
series.
End result is staff receiving an alert that the patron was
accessed with an invalid barcode.
Signed-off-by: Michael Peters <mpeters at emeralddata.net>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql
index f69bfa4..5ac7eee 100644
--- a/Open-ILS/src/sql/Pg/020.schema.functions.sql
+++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql
@@ -359,7 +359,8 @@ BEGIN
RETURN QUERY SELECT 'booking'::TEXT, id::BIGINT, barcode FROM booking.resource WHERE barcode = ANY(asset_barcodes);
END IF;
IF do_actor THEN
- RETURN QUERY SELECT 'actor'::TEXT, c.usr::BIGINT, c.barcode FROM actor.card c JOIN actor.usr u ON c.usr = u.id WHERE c.barcode = ANY(actor_barcodes) AND c.active AND NOT u.deleted ORDER BY usr;
+ RETURN QUERY SELECT 'actor'::TEXT, c.usr::BIGINT, c.barcode FROM actor.card c JOIN actor.usr u ON c.usr = u.id WHERE
+ ((c.barcode = ANY(actor_barcodes) AND c.active) OR c.barcode = in_barcode) AND NOT u.deleted ORDER BY usr;
END IF;
RETURN;
END;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql
new file mode 100644
index 0000000..522f4a3
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.allow_inactive_barcode_retrieve.sql
@@ -0,0 +1,83 @@
+CREATE OR REPLACE FUNCTION evergreen.get_barcodes(select_ou INT, type TEXT, in_barcode TEXT) RETURNS SETOF evergreen.barcode_set AS $$
+DECLARE
+ cur_barcode TEXT;
+ barcode_len INT;
+ completion_len INT;
+ asset_barcodes TEXT[];
+ actor_barcodes TEXT[];
+ do_asset BOOL = false;
+ do_serial BOOL = false;
+ do_booking BOOL = false;
+ do_actor BOOL = false;
+ completion_set config.barcode_completion%ROWTYPE;
+BEGIN
+
+ IF position('asset' in type) > 0 THEN
+ do_asset = true;
+ END IF;
+ IF position('serial' in type) > 0 THEN
+ do_serial = true;
+ END IF;
+ IF position('booking' in type) > 0 THEN
+ do_booking = true;
+ END IF;
+ IF do_asset OR do_serial OR do_booking THEN
+ asset_barcodes = asset_barcodes || in_barcode;
+ END IF;
+ IF position('actor' in type) > 0 THEN
+ do_actor = true;
+ actor_barcodes = actor_barcodes || in_barcode;
+ END IF;
+
+ barcode_len := length(in_barcode);
+
+ FOR completion_set IN
+ SELECT * FROM config.barcode_completion
+ WHERE active
+ AND org_unit IN (SELECT aou.id FROM actor.org_unit_ancestors(select_ou) aou)
+ LOOP
+ IF completion_set.prefix IS NULL THEN
+ completion_set.prefix := '';
+ END IF;
+ IF completion_set.suffix IS NULL THEN
+ completion_set.suffix := '';
+ END IF;
+ IF completion_set.length = 0 OR completion_set.padding IS NULL OR length(completion_set.padding) = 0 THEN
+ cur_barcode = completion_set.prefix || in_barcode || completion_set.suffix;
+ ELSE
+ completion_len = completion_set.length - length(completion_set.prefix) - length(completion_set.suffix);
+ IF completion_len >= barcode_len THEN
+ IF completion_set.padding_end THEN
+ cur_barcode = rpad(in_barcode, completion_len, completion_set.padding);
+ ELSE
+ cur_barcode = lpad(in_barcode, completion_len, completion_set.padding);
+ END IF;
+ cur_barcode = completion_set.prefix || cur_barcode || completion_set.suffix;
+ END IF;
+ END IF;
+ IF completion_set.actor THEN
+ actor_barcodes = actor_barcodes || cur_barcode;
+ END IF;
+ IF completion_set.asset THEN
+ asset_barcodes = asset_barcodes || cur_barcode;
+ END IF;
+ END LOOP;
+
+ IF do_asset AND do_serial THEN
+ RETURN QUERY SELECT 'asset'::TEXT, id, barcode FROM ONLY asset.copy WHERE barcode = ANY(asset_barcodes) AND deleted = false;
+ RETURN QUERY SELECT 'serial'::TEXT, id, barcode FROM serial.unit WHERE barcode = ANY(asset_barcodes) AND deleted = false;
+ ELSIF do_asset THEN
+ RETURN QUERY SELECT 'asset'::TEXT, id, barcode FROM asset.copy WHERE barcode = ANY(asset_barcodes) AND deleted = false;
+ ELSIF do_serial THEN
+ RETURN QUERY SELECT 'serial'::TEXT, id, barcode FROM serial.unit WHERE barcode = ANY(asset_barcodes) AND deleted = false;
+ END IF;
+ IF do_booking THEN
+ RETURN QUERY SELECT 'booking'::TEXT, id::BIGINT, barcode FROM booking.resource WHERE barcode = ANY(asset_barcodes);
+ END IF;
+ IF do_actor THEN
+ RETURN QUERY SELECT 'actor'::TEXT, c.usr::BIGINT, c.barcode FROM actor.card c JOIN actor.usr u ON c.usr = u.id WHERE
+ ((c.barcode = ANY(actor_barcodes) AND c.active) OR c.barcode = in_barcode) AND NOT u.deleted ORDER BY usr;
+ END IF;
+ RETURN;
+END;
+$$ LANGUAGE plpgsql;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/020.schema.functions.sql | 3 +-
...0.function.allow_inactive_barcode_retrieve.sql} | 34 ++------------------
3 files changed, 6 insertions(+), 33 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0536.schema.lazy_circ-barcode_lookup.sql => 0770.function.allow_inactive_barcode_retrieve.sql} (70%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list