[OPEN-ILS-DEV] Looking for thoughts on Launchpad bug 1482757
Mike Rylander
mrylander at gmail.com
Fri Jan 15 12:58:26 EST 2016
Michele,
I don't have time to put together a branch and tests, but here's a
patch that should does what you want. If I have time in the first
half of next week, I'll branch-ify it.
-------8<-----------
diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql
b/Open-ILS/src/sql/Pg/030.schema.metabib.sql
index 212a201..ab78c8f 100644
--- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql
+++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql
@@ -1126,16 +1126,9 @@ DECLARE
uri_id INT;
uri_cn_id INT;
uri_map_id INT;
+ current_map_owner_list INT[];
BEGIN
- -- Clear any URI mappings and call numbers for this bib.
- -- This leads to acn / auricnm inflation, but also enables
- -- old acn/auricnm's to go away and for bibs to be deleted.
- FOR uri_cn_id IN SELECT id FROM asset.call_number WHERE record =
bib_id AND label = '##URI##' AND NOT deleted LOOP
- DELETE FROM asset.uri_call_number_map WHERE call_number = uri_cn_id;
- DELETE FROM asset.call_number WHERE id = uri_cn_id;
- END LOOP;
-
uris := oils_xpath('//*[@tag="856" and (@ind1="4" or @ind1="1")
and (@ind2="0" or @ind2="1")]',marcxml);
IF ARRAY_UPPER(uris,1) > 0 THEN
FOR i IN 1 .. ARRAY_UPPER(uris, 1) LOOP
@@ -1213,6 +1206,8 @@ BEGIN
INSERT INTO asset.uri_call_number_map
(call_number, uri) VALUES (uri_cn_id, uri_id);
END IF;
+ current_map_owner_list := current_map_owner_list
|| uri_cn_id
+
END LOOP;
END IF;
@@ -1220,6 +1215,20 @@ BEGIN
END LOOP;
END IF;
+ -- Clear any URI mappings and call numbers for this bib
+ -- that weren't mapped above.
+ FOR uri_cn_id IN
+ SELECT id
+ FROM asset.call_number
+ WHERE record = bib_id
+ AND label = '##URI##'
+ AND NOT deleted
+ AND NOT (id = ANY (current_map_owner_list))
+ LOOP
+ DELETE FROM asset.uri_call_number_map WHERE call_number = uri_cn_id;
+ DELETE FROM asset.call_number WHERE id = uri_cn_id;
+ END LOOP;
+
RETURN;
END;
$func$ LANGUAGE PLPGSQL;
-------8<-----------
HTH,
--
Mike Rylander
| President
| Equinox Software, Inc. / The Open Source Experts
| phone: 1-877-OPEN-ILS (673-6457)
| email: miker at esilibrary.com
| web: http://www.esilibrary.com
On Fri, Jan 15, 2016 at 11:39 AM, Morgan, Michele <mmorgan at noblenet.org> wrote:
> Hi,
>
> We at NOBLE are wrestling with the issues described in this Launchpad bug:
>
> https://bugs.launchpad.net/evergreen/+bug/1482757
>
> As described in the bug, each time a record with 856 links is loaded,
> existing URI entries for the matching bib are deleted from the call number
> table, and a new set it is added. We're looking for thoughts on possible
> approaches to avoid this blanket deletion and addition to the call number
> table, or otherwise preserve the original create dates of the URIs.
>
> Electronic Resources are as much a part of our libraries' collections as
> print resources and we need to be able to provide the same type of holdings
> reports for these that we do for print items. Right now we are unable to
> provide monthly reports on numbers of electronic resources added or removed
> since we can't use the create dates from the call number table.
>
> We are happy with the way the electronic resources are represented in the
> catalog. But we are unable to find a way to provide reports our libraries
> need.
>
> Any thoughts on possible approachs to remedy this would be greatly
> appreciated.
>
> Thanks,
> Michele
>
> --
> Michele M. Morgan, Technical Assistant
> North of Boston Library Exchange, Danvers Massachusetts
> mmorgan at noblenet.org
>
More information about the Open-ils-dev
mailing list