Per Dan Wells' suggestions.
1) One possible "crack" I see for data to fall through is the dead map
selector. The "AND cn.label = '##URI##' AND NOT cn.deleted" seems overly
restrictive. Now, I realize we *shouldn't* have mappings to deleted or
non-##URI## call numbers, but it isn't impossible, and I don't think we'd
have harm in leaving those restrictions out. If a map isn't used, let's
get rid of it regardless, I think.
2) (side note) orphaned_uri_list doesn't seems to be used any more, so
should be removed.
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
uri_map_count INT;
current_uri_map_list INT[];
current_map_owner_list INT[];
- orphaned_uri_list INT[];
+
BEGIN
uris := oils_xpath('//*[@tag="856" and (@ind1="4" or @ind1="1") and (@ind2="0" or @ind2="1")]',marcxml);
JOIN asset.call_number cn ON (cn.id = m.call_number)
WHERE cn.record = bib_id
AND cn.label = '##URI##'
- AND NOT cn.deleted
AND NOT (m.id = ANY (current_uri_map_list))
LOOP
SELECT uri INTO current_uri FROM asset.uri_call_number_map WHERE id = current_map;
uri_map_count INT;
current_uri_map_list INT[];
current_map_owner_list INT[];
- orphaned_uri_list INT[];
+
BEGIN
uris := oils_xpath('//*[@tag="856" and (@ind1="4" or @ind1="1") and (@ind2="0" or @ind2="1")]',marcxml);
JOIN asset.call_number cn ON (cn.id = m.call_number)
WHERE cn.record = bib_id
AND cn.label = '##URI##'
- AND NOT cn.deleted
AND NOT (m.id = ANY (current_uri_map_list))
LOOP
SELECT uri INTO current_uri FROM asset.uri_call_number_map WHERE id = current_map;