[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. f68328d52fb62c3d401186f2d6da08c24d9ae914
Evergreen Git
git at git.evergreen-ils.org
Tue Nov 26 12:47:22 EST 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 f68328d52fb62c3d401186f2d6da08c24d9ae914 (commit)
from 5064c87948a710e635894982b09bb9a44f89713b (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 f68328d52fb62c3d401186f2d6da08c24d9ae914
Author: Mike Rylander <mrylander at gmail.com>
Date: Tue Nov 26 12:44:41 2013 -0500
Push 0848 into the baseline schema
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index 4ac6b2c..071e7c3 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -152,12 +152,14 @@ DECLARE
tag_used TEXT;
nfi_used TEXT;
sf TEXT;
+ sf_node TEXT;
+ tag_node TEXT;
thes_code TEXT;
cset INT;
heading_text TEXT;
tmp_text TEXT;
first_sf BOOL;
- auth_id INT DEFAULT COALESCE(NULLIF(oils_xpath_string('//*[@tag="901"]/*[local-name()="subfield" and @code="c"]', marcxml), ''), '0')::INT;
+ auth_id INT DEFAULT COALESCE(NULLIF(oils_xpath_string('//*[@tag="901"]/*[local-name()="subfield" and @code="c"]', marcxml), ''), '0')::INT;
BEGIN
SELECT control_set INTO cset FROM authority.record_entry WHERE id = auth_id;
@@ -180,35 +182,43 @@ BEGIN
tag_used := acsaf.tag;
nfi_used := acsaf.nfi;
first_sf := TRUE;
- FOR sf IN SELECT * FROM regexp_split_to_table(acsaf.sf_list,'') LOOP
- tmp_text := oils_xpath_string('//*[@tag="'||tag_used||'"]/*[@code="'||sf||'"]', marcxml);
- IF first_sf AND tmp_text IS NOT NULL AND nfi_used IS NOT NULL THEN
-
- tmp_text := SUBSTRING(
- tmp_text FROM
- COALESCE(
- NULLIF(
- REGEXP_REPLACE(
- oils_xpath_string('//*[@tag="'||tag_used||'"]/@ind'||nfi_used, marcxml),
- $$\D+$$,
- '',
- 'g'
- ),
- ''
- )::INT,
- 0
- ) + 1
- );
-
- END IF;
-
- first_sf := FALSE;
+ FOR tag_node IN SELECT unnest(oils_xpath('//*[@tag="'||tag_used||'"]',marcxml)) LOOP
+ FOR sf_node IN SELECT unnest(oils_xpath('//*[contains("'||acsaf.sf_list||'", at code)]',tag_node)) LOOP
+
+ tmp_text := oils_xpath_string('.', sf_node);
+ sf := oils_xpath_string('./@code', sf_node);
+
+ IF first_sf AND tmp_text IS NOT NULL AND nfi_used IS NOT NULL THEN
+
+ tmp_text := SUBSTRING(
+ tmp_text FROM
+ COALESCE(
+ NULLIF(
+ REGEXP_REPLACE(
+ oils_xpath_string('./@ind'||nfi_used, tag_node),
+ $$\D+$$,
+ '',
+ 'g'
+ ),
+ ''
+ )::INT,
+ 0
+ ) + 1
+ );
+
+ END IF;
+
+ first_sf := FALSE;
+
+ IF tmp_text IS NOT NULL AND tmp_text <> '' THEN
+ heading_text := heading_text || E'\u2021' || sf || ' ' || tmp_text;
+ END IF;
+ END LOOP;
- IF tmp_text IS NOT NULL AND tmp_text <> '' THEN
- heading_text := heading_text || E'\u2021' || sf || ' ' || tmp_text;
- END IF;
+ EXIT WHEN heading_text <> '';
END LOOP;
+
EXIT WHEN heading_text <> '';
END LOOP;
@@ -272,14 +282,14 @@ BEGIN
nfi_used := acsaf.nfi;
FOR tmp_xml IN SELECT UNNEST(XPATH('//*[@tag="'||tag_used||'"]', marcxml::XML)) LOOP
- heading_text := '';
- FOR sf IN SELECT * FROM regexp_split_to_table(acsaf.sf_list,'') LOOP
- heading_text := heading_text || COALESCE( ' ' || oils_xpath_string('//*[@code="'||sf||'"]',tmp_xml::TEXT), '');
- END LOOP;
+ heading_text := public.naco_normalize(
+ COALESCE(
+ oils_xpath_string('//*[contains("'||acsaf.sf_list||'", at code)]',tmp_xml::TEXT, ' '),
+ ''
+ )
+ );
- heading_text := public.naco_normalize(heading_text);
-
IF nfi_used IS NOT NULL THEN
sort_text := SUBSTRING(
@@ -287,7 +297,7 @@ BEGIN
COALESCE(
NULLIF(
REGEXP_REPLACE(
- oils_xpath_string('//*[@tag="'||tag_used||'"]/@ind'||nfi_used, marcxml),
+ oils_xpath_string('./@ind'||nfi_used, tmp_xml::TEXT),
$$\D+$$,
'',
'g'
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/011.schema.authority.sql | 78 ++++++++++++++-----------
1 files changed, 44 insertions(+), 34 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list