[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0b0c9a8e0fef7dbac99fe460cfe004d0d47caf03

Evergreen Git git at git.evergreen-ils.org
Tue Dec 6 09:57:15 EST 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, master has been updated
       via  0b0c9a8e0fef7dbac99fe460cfe004d0d47caf03 (commit)
       via  47a16f516d5bf3cdd3d22b14821b7500e092465a (commit)
      from  27e32d09248a684e6291dd0aca5af4408271a352 (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 0b0c9a8e0fef7dbac99fe460cfe004d0d47caf03
Author: Bill Erickson <berick at esilibrary.com>
Date:   Tue Dec 6 09:56:55 2011 -0500

    Stamping upgrade for LP893315: filter_deleted_acns_from_unapi
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 8852183..ac1f113 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -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 ('0655', :eg_version); -- dyrcona/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0656', :eg_version); -- dbs/berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql b/Open-ILS/src/sql/Pg/upgrade/0656.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
similarity index 98%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
rename to Open-ILS/src/sql/Pg/upgrade/0656.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
index b65ad3d..9b8b4b3 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0656.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
@@ -5,7 +5,7 @@
 BEGIN;
 
 -- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0656', :eg_version);
 
 CREATE OR REPLACE FUNCTION unapi.holdings_xml (bid BIGINT, ouid INT, org TEXT, depth INT DEFAULT NULL, includes TEXT[] DEFAULT NULL::TEXT[], slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE) RETURNS XML AS $F$
      SELECT  XMLELEMENT(

commit 47a16f516d5bf3cdd3d22b14821b7500e092465a
Author: Dan Scott <dscott at laurentian.ca>
Date:   Fri Nov 25 13:20:32 2011 -0500

    LP893315: Do not return delected call numbers in holdings_xml
    
    Per LP893315, deleted call numbers were obscuring the actual active URIs
    associated with a given bib record in a given scope at the default limit
    of 5 results per record in unapi.holdings_xml.
    
    Filtering out the deleted call numbers from the results seems like a
    good idea, as we're generally interested in only showing the active
    results (at least as in-db unapi is currently used). This also addresses
    the problem of not showing active URIs when there are active URIs to
    display.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
index 70996fc..5b3e093 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -278,6 +278,7 @@ CREATE OR REPLACE FUNCTION unapi.holdings_xml (bid BIGINT, ouid INT, org TEXT, d
                         SELECT  unapi.acn(acn.id,'xml','volume',array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE)
                           FROM  asset.call_number acn
                           WHERE acn.record = $1
+                                AND acn.deleted IS FALSE
                                 AND EXISTS (
                                     SELECT  1
                                       FROM  asset.copy acp
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
new file mode 100644
index 0000000..b65ad3d
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
@@ -0,0 +1,97 @@
+-- Evergreen DB patch XXXX.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql
+--
+-- Prevent deleted call numbers from hiding active call numbers / copies / URIs
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION unapi.holdings_xml (bid BIGINT, ouid INT, org TEXT, depth INT DEFAULT NULL, includes TEXT[] DEFAULT NULL::TEXT[], slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE) RETURNS XML AS $F$
+     SELECT  XMLELEMENT(
+                 name holdings,
+                 XMLATTRIBUTES(
+                    CASE WHEN $8 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+                    CASE WHEN ('bre' = ANY ($5)) THEN 'tag:open-ils.org:U2 at bre/' || $1 || '/' || $3 ELSE NULL END AS id
+                 ),
+                 XMLELEMENT(
+                     name counts,
+                     (SELECT  XMLAGG(XMLELEMENT::XML) FROM (
+                         SELECT  XMLELEMENT(
+                                     name count,
+                                     XMLATTRIBUTES('public' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+                                 )::text
+                           FROM  asset.opac_ou_record_copy_count($2,  $1)
+                                     UNION
+                         SELECT  XMLELEMENT(
+                                     name count,
+                                     XMLATTRIBUTES('staff' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+                                 )::text
+                           FROM  asset.staff_ou_record_copy_count($2, $1)
+                                     ORDER BY 1
+                     )x)
+                 ),
+                 CASE 
+                     WHEN ('bmp' = ANY ($5)) THEN
+                        XMLELEMENT(
+                            name monograph_parts,
+                            (SELECT XMLAGG(bmp) FROM (
+                                SELECT  unapi.bmp( id, 'xml', 'monograph_part', evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'bre'), 'holdings_xml'), $3, $4, $6, $7, FALSE)
+                                  FROM  biblio.monograph_part
+                                  WHERE record = $1
+                            )x)
+                        )
+                     ELSE NULL
+                 END,
+                 XMLELEMENT(
+                     name volumes,
+                     (SELECT XMLAGG(acn) FROM (
+                        SELECT  unapi.acn(acn.id,'xml','volume',array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE)
+                          FROM  asset.call_number acn
+                          WHERE acn.record = $1
+                                AND acn.deleted IS FALSE
+                                AND EXISTS (
+                                    SELECT  1
+                                      FROM  asset.copy acp
+                                            JOIN actor.org_unit_descendants(
+                                                $2,
+                                                (COALESCE(
+                                                    $4,
+                                                    (SELECT aout.depth
+                                                      FROM  actor.org_unit_type aout
+                                                            JOIN actor.org_unit aou ON (aou.ou_type = aout.id AND aou.id = $2)
+                                                    )
+                                                ))
+                                            ) aoud ON (acp.circ_lib = aoud.id)
+                                      LIMIT 1
+                               )
+                          ORDER BY label_sortkey
+                          LIMIT $6
+                          OFFSET $7
+                     )x)
+                 ),
+                 CASE WHEN ('ssub' = ANY ($5)) THEN 
+                     XMLELEMENT(
+                         name subscriptions,
+                         (SELECT XMLAGG(ssub) FROM (
+                            SELECT  unapi.ssub(id,'xml','subscription','{}'::TEXT[], $3, $4, $6, $7, FALSE)
+                              FROM  serial.subscription
+                              WHERE record_entry = $1
+                        )x)
+                     )
+                 ELSE NULL END,
+                 CASE WHEN ('acp' = ANY ($5)) THEN 
+                     XMLELEMENT(
+                         name foreign_copies,
+                         (SELECT XMLAGG(acp) FROM (
+                            SELECT  unapi.acp(p.target_copy,'xml','copy','{}'::TEXT[], $3, $4, $6, $7, FALSE)
+                              FROM  biblio.peer_bib_copy_map p
+                                    JOIN asset.copy c ON (p.target_copy = c.id)
+                              WHERE NOT c.deleted AND peer_record = $1
+                        )x)
+                     )
+                 ELSE NULL END
+             );
+$F$ LANGUAGE SQL;
+
+COMMIT;

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/990.schema.unapi.sql           |    1 +
 ...filter_deleted_acns_from_unapi.holdings_xml.sql |   97 ++++++++++++++++++++
 3 files changed, 99 insertions(+), 1 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0656.LP893315_schema.function.filter_deleted_acns_from_unapi.holdings_xml.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list