Bring in-db unAPI opac visibility info up to date with (and a little beyond) ea3b8857...
authorMike Rylander <mrylander@gmail.com>
Mon, 13 Jun 2011 14:38:29 +0000 (10:38 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 13 Jun 2011 14:38:29 +0000 (10:38 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0557.schema.in-db_unapi_copy_related_visibility-1.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/0558.schema.in-db_unapi_copy_related_visibility-2.sql [new file with mode: 0644]

index 0d07d5b..c76fcf1 100644 (file)
@@ -86,7 +86,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 ('0556', :eg_version); -- dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0558', :eg_version); -- miker
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0557.schema.in-db_unapi_copy_related_visibility-1.sql b/Open-ILS/src/sql/Pg/upgrade/0557.schema.in-db_unapi_copy_related_visibility-1.sql
new file mode 100644 (file)
index 0000000..9295d6e
--- /dev/null
@@ -0,0 +1,28 @@
+-- Evergreen DB patch 0557.schmea.in-db_unapi_copy_related_visibility-1.sql
+--
+-- Bring in-db unAPI opac visibility info up to date with (and a little beyond) ea3b8857d08b8a9050e763f8084c841e8df9a473
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0557', :eg_version);
+
+CREATE OR REPLACE FUNCTION unapi.acl ( obj_id BIGINT, format TEXT,  ename TEXT, includes TEXT[], org TEXT, depth INT DEFAULT NULL, slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE ) RETURNS XML AS $F$
+    SELECT  XMLELEMENT(
+                name location,
+                XMLATTRIBUTES(
+                    CASE WHEN $9 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+                    id AS ident
+                    holdable,
+                    opac_visible,
+                    label_prefix AS prefix,
+                    label_suffix AS suffix
+                ),
+                name
+            )
+      FROM  asset.copy_location
+      WHERE id = $1;
+$F$ LANGUAGE SQL;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/0558.schema.in-db_unapi_copy_related_visibility-2.sql b/Open-ILS/src/sql/Pg/upgrade/0558.schema.in-db_unapi_copy_related_visibility-2.sql
new file mode 100644 (file)
index 0000000..d7ddf91
--- /dev/null
@@ -0,0 +1,26 @@
+-- Evergreen DB patch 0558.schema.in-db_unapi_copy_related_visibility-2.sql
+--
+-- Bring in-db unAPI opac visibility info up to date with (and a little beyond) ea3b8857d08b8a9050e763f8084c841e8df9a473
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0557', :eg_version);
+
+CREATE OR REPLACE FUNCTION unapi.ccs ( obj_id BIGINT, format TEXT,  ename TEXT, includes TEXT[], org TEXT, depth INT DEFAULT NULL, slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE ) RETURNS XML AS $F$
+    SELECT  XMLELEMENT(
+                name status,
+                XMLATTRIBUTES(
+                    CASE WHEN $9 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+                    id AS ident
+                    holdable,
+                    opac_visible
+                ),
+                name
+            )
+      FROM  config.copy_status
+      WHERE id = $1;
+$F$ LANGUAGE SQL;
+
+COMMIT;