[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. 4db14cb41f812ec729ca499530ab6ac013c234c7

Evergreen Git git at git.evergreen-ils.org
Wed Jan 17 13:20:47 EST 2018


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_3_0 has been updated
       via  4db14cb41f812ec729ca499530ab6ac013c234c7 (commit)
       via  262d34a60ccf292a0d76e24ffc03c0a9dd09b9cd (commit)
       via  caa77ec89e9006e98d9e61d4175bcef05f000012 (commit)
      from  59266376dd5fa9ac7a443559a60d5ec030f7a17a (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 4db14cb41f812ec729ca499530ab6ac013c234c7
Author: Kathy Lussier <klussier at masslnc.org>
Date:   Wed Jan 17 13:17:02 2018 -0500

    LP#1743639: Stamping upgrade script for copy location group visibility
    
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index d47b2b4..650c5ec 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,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 ('1085', :eg_version); -- miker/kmlussier
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1086', :eg_version); -- miker/kmlussier
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql b/Open-ILS/src/sql/Pg/upgrade/1086.function.copy_location_group_visible.sql
similarity index 86%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
rename to Open-ILS/src/sql/Pg/upgrade/1086.function.copy_location_group_visible.sql
index ca49b54..eac6591 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1086.function.copy_location_group_visible.sql
@@ -1,5 +1,7 @@
 BEGIN;
 
+SELECT evergreen.upgrade_deps_block_check('1086', :eg_version);
+
 CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$
     SELECT '!()'::TEXT; -- For now, as there's no way to cause a location group to hide all copies.
 /*

commit 262d34a60ccf292a0d76e24ffc03c0a9dd09b9cd
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Jan 16 16:26:31 2018 -0500

    LP#1743639: Test location as proxy for location group
    
    Location groups are a table remove from copies, and can cause very large
    updates to the copy vis cache.  So, we will expand location groups to
    locations, in situ, to avoid this problem and the need to supply a trigger
    to update th copy vis cache for groups.  This will allow us to reclaim
    the location group bit in the visibility cache namespace if necessary, at
    a later date.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index 9a02d33..1a3d40a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -1511,15 +1511,17 @@ sub flatten {
             } elsif ($filter->name eq 'locations') {
                 if (@{$filter->args} > 0) {
                     my $negate = $filter->negate ? 'TRUE' : 'FALSE';
+                    my $filter_args = join(",", map(int, @{$filter->args}));
                     push @{$vis_filter{'c_attr'}},
-                        "search.calculate_visibility_attribute_test('location','{".join(',', @{$filter->args})."}',$negate)";
+                        "search.calculate_visibility_attribute_test('location',$filter_args,$negate)";
                 }
 
             } elsif ($filter->name eq 'location_groups') {
                 if (@{$filter->args} > 0) {
                     my $negate = $filter->negate ? 'TRUE' : 'FALSE';
+                    my $filter_args = join(",", map(int, @{$filter->args}));
                     push @{$vis_filter{'c_attr'}},
-                        "search.calculate_visibility_attribute_test('location_group','{".join(',', @{$filter->args})."}',$negate)";
+                        "search.calculate_visibility_attribute_test('location',(SELECT ARRAY_AGG(location) FROM asset.copy_location_group_map WHERE lgroup IN ($filter_args)),$negate)";
                 }
 
             } elsif ($filter->name eq 'statuses') {
diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
index 5735263..5157aaf 100644
--- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
+++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
@@ -761,7 +761,7 @@ CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$
       FROM  asset.copy_location_group
       WHERE NOT opac_visible;
 */
-$f$ LANGUAGE SQL STABLE;
+$f$ LANGUAGE SQL IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION asset.location_default () RETURNS TEXT AS $f$
     SELECT  '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location')),'|') || ')'
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
index 7b457c6..ca49b54 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
@@ -7,7 +7,7 @@ CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$
       FROM  asset.copy_location_group
       WHERE NOT opac_visible;
 */
-$f$ LANGUAGE SQL STABLE;
+$f$ LANGUAGE SQL IMMUTABLE;
 
 COMMIT;
 

commit caa77ec89e9006e98d9e61d4175bcef05f000012
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Jan 16 14:39:08 2018 -0500

    LP#1743639: opac_visible on acplg is not what it seems
    
    The asset.copy_location_group table has a column called opac_visible.
    However, unlike other tables with a column of that name, it controls the
    visibility of the location group itself, not the visibility of the copies
    within the group.  This is regretable because the 3.0+ search code thinks
    that it should hide copies.
    
    This commit adjusts the default location group filter applied to patron
    searches so that they act as expected.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
index c6cfdf4..5735263 100644
--- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
+++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
@@ -755,9 +755,12 @@ $f$ LANGUAGE SQL STABLE;
 
 -- Copy-oriented defaults for search
 CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$
+    SELECT '!()'::TEXT; -- For now, as there's no way to cause a location group to hide all copies.
+/*
     SELECT  '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location_group')),'|') || ')'
       FROM  asset.copy_location_group
       WHERE NOT opac_visible;
+*/
 $f$ LANGUAGE SQL STABLE;
 
 CREATE OR REPLACE FUNCTION asset.location_default () RETURNS TEXT AS $f$
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
new file mode 100644
index 0000000..7b457c6
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql
@@ -0,0 +1,13 @@
+BEGIN;
+
+CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$
+    SELECT '!()'::TEXT; -- For now, as there's no way to cause a location group to hide all copies.
+/*
+    SELECT  '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location_group')),'|') || ')'
+      FROM  asset.copy_location_group
+      WHERE NOT opac_visible;
+*/
+$f$ LANGUAGE SQL STABLE;
+
+COMMIT;
+

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Driver/Pg/QueryParser.pm   |    6 ++++--
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/300.schema.staged_search.sql   |    5 ++++-
 .../1086.function.copy_location_group_visible.sql  |   15 +++++++++++++++
 4 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/1086.function.copy_location_group_visible.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list