Teach Evergreen about Blu-Ray VR Format
authorThomas Berezansky <tsbere@mvlc.org>
Sun, 11 Mar 2012 22:00:03 +0000 (18:00 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 19 Mar 2012 15:53:44 +0000 (11:53 -0400)
Also, reingest blu-ray records in an update script to populate it.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql [new file with mode: 0644]

index bc737d7..cec8061 100644 (file)
@@ -5502,6 +5502,7 @@ INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfiel
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('o',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'D-2');
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('p',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'8 mm.');
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('q',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'Hi-8 mm.');
+INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('s',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'Blu-ray');
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('u',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'Unknown');
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('v',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'DVD');
 INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) VALUES ('z',CURRVAL('config.marc21_physical_characteristic_subfield_map_id_seq'),'Other');
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql
new file mode 100644 (file)
index 0000000..cfd8c97
--- /dev/null
@@ -0,0 +1,33 @@
+DO $FUNC$
+DECLARE
+    same_marc BOOL;
+BEGIN
+    -- Check if it is already there
+    PERFORM * FROM config.marc21_physical_characteristic_value_map v
+        JOIN config.marc21_physical_characteristic_subfield_map s ON v.ptype_subfield = s.id
+        WHERE s.ptype_key = 'v' AND s.subfield = 'e' AND s.start_pos = '4' AND s.length = '1'
+            AND v.value = 's';
+
+    -- If it is, bail.
+    IF FOUND THEN
+        RETURN;
+    END IF;
+
+    -- Otherwise, insert it
+    INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label)
+    SELECT 's',id,'Blu-ray'
+        FROM config.marc21_physical_characteristic_subfield_map
+        WHERE ptype_key = 'v' AND subfield = 'e' AND start_pos = '4' AND length = '1';
+
+    -- And reingest the blue-ray items so that things see the new value
+    SELECT INTO same_marc enabled FROM config.internal_flag WHERE name = 'ingest.reingest.force_on_same_marc';
+    UPDATE config.internal_flag SET enabled = true WHERE name = 'ingest.reingest.force_on_same_marc';
+    UPDATE biblio.record_entry SET marc=marc WHERE id IN (SELECT record
+        FROM
+            metabib.full_rec a JOIN metabib.full_rec b USING (record)
+        WHERE
+            a.tag = 'LDR' AND a.value LIKE '______g%'
+        AND b.tag = '007' AND b.value LIKE 'v___s%');
+    UPDATE config.internal_flag SET enabled = same_marc WHERE name = 'ingest.reingest.force_on_same_marc';
+END;
+$FUNC$;