backport of r17007: retain the indicators on located uri 856 merge during asset merge
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 22 Jul 2010 01:06:59 +0000 (01:06 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 22 Jul 2010 01:06:59 +0000 (01:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_0@17011 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/999.functions.global.sql

index 1fe4bed..c6d8792 100644 (file)
@@ -242,7 +242,10 @@ BEGIN
                 ) as t(i int,c text);
     
         FOR i IN 1 .. counter LOOP
-            SELECT  '<datafield xmlns="http://www.loc.gov/MARC21/slim" tag="856">' ||
+            SELECT  '<datafield xmlns="http://www.loc.gov/MARC21/slim"' || 
+                       ' tag="856"' ||
+                       ' ind1="' || FIRST(ind1) || '"'  ||
+                       ' ind2="' || FIRST(ind2) || '">' ||
                         array_to_string(
                             array_accum(
                                 '<subfield code="' || subfield || '">' ||
@@ -259,10 +262,12 @@ BEGIN
                         'id',
                         'marc',
                         'biblio.record_entry',
+                        '//*[@tag="856"][position()=' || i || ']/@ind1|' ||
+                        '//*[@tag="856"][position()=' || i || ']/@ind2|' ||
                         '//*[@tag="856"][position()=' || i || ']/*/@code|' ||
                         '//*[@tag="856"][position()=' || i || ']/*[@code]',
                         'id=' || source_record
-                    ) as t(id int,subfield text,data text);
+                    ) as t(id int,ind1 text, ind2 text,subfield text,data text);
 
             uri_text := uri_text || uri_datafield;
         END LOOP;