we already have 0726
authorChris Sharp <csharp@georgialibraries.org>
Tue, 24 Jan 2017 01:14:11 +0000 (20:14 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 12 Mar 2018 17:58:02 +0000 (13:58 -0400)
Open-ILS/src/sql/Pg/version-upgrade/2.2.0-2.2.1-upgrade-db.sql

index c704433..53865a3 100644 (file)
@@ -264,104 +264,104 @@ $func$ LANGUAGE PLPERLU;
 -- $func$ LANGUAGE PLPERLU;
 
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0726', :eg_version); -- denials
-
-CREATE OR REPLACE FUNCTION evergreen.maintain_901 () RETURNS TRIGGER AS $func$
-use strict;
-use MARC::Record;
-use MARC::File::XML (BinaryEncoding => 'UTF-8');
-use MARC::Charset;
-use Encode;
-use Unicode::Normalize;
-
-MARC::Charset->assume_unicode(1);
-
-my $schema = $_TD->{table_schema};
-my $marc = MARC::Record->new_from_xml($_TD->{new}{marc});
-
-my @old901s = $marc->field('901');
-$marc->delete_fields(@old901s);
-
-if ($schema eq 'biblio') {
-    my $tcn_value = $_TD->{new}{tcn_value};
-
-    # Set TCN value to record ID?
-    my $id_as_tcn = spi_exec_query("
-        SELECT enabled
-        FROM config.global_flag
-        WHERE name = 'cat.bib.use_id_for_tcn'
-    ");
-    if (($id_as_tcn->{processed}) && $id_as_tcn->{rows}[0]->{enabled} eq 't') {
-        $tcn_value = $_TD->{new}{id}; 
-    }
-
-    my $new_901 = MARC::Field->new("901", " ", " ",
-        "a" => $tcn_value,
-        "b" => $_TD->{new}{tcn_source},
-        "c" => $_TD->{new}{id},
-        "t" => $schema
-    );
-
-    if ($_TD->{new}{owner}) {
-        $new_901->add_subfields("o" => $_TD->{new}{owner});
-    }
-
-    if ($_TD->{new}{share_depth}) {
-        $new_901->add_subfields("d" => $_TD->{new}{share_depth});
-    }
-
-    $marc->append_fields($new_901);
-} elsif ($schema eq 'authority') {
-    my $new_901 = MARC::Field->new("901", " ", " ",
-        "c" => $_TD->{new}{id},
-        "t" => $schema,
-    );
-    $marc->append_fields($new_901);
-} elsif ($schema eq 'serial') {
-    my $new_901 = MARC::Field->new("901", " ", " ",
-        "c" => $_TD->{new}{id},
-        "t" => $schema,
-        "o" => $_TD->{new}{owning_lib},
-    );
-
-    if ($_TD->{new}{record}) {
-        $new_901->add_subfields("r" => $_TD->{new}{record});
-    }
-
-    $marc->append_fields($new_901);
-} else {
-    my $new_901 = MARC::Field->new("901", " ", " ",
-        "c" => $_TD->{new}{id},
-        "t" => $schema,
-    );
-    $marc->append_fields($new_901);
-}
-
-my $xml = $marc->as_xml_record();
-$xml =~ s/\n//sgo;
-$xml =~ s/^<\?xml.+\?\s*>//go;
-$xml =~ s/>\s+</></go;
-$xml =~ s/\p{Cc}//go;
-
-# Embed a version of OpenILS::Application::AppUtils->entityize()
-# to avoid having to set PERL5LIB for PostgreSQL as well
-
-# If we are going to convert non-ASCII characters to XML entities,
-# we had better be dealing with a UTF8 string to begin with
-$xml = decode_utf8($xml);
-
-$xml = NFC($xml);
-
-# Convert raw ampersands to entities
-$xml =~ s/&(?!\S+;)/&amp;/gso;
-
-# Convert Unicode characters to entities
-$xml =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
-
-$xml =~ s/[\x00-\x1f]//go;
-$_TD->{new}{marc} = $xml;
-
-return "MODIFY";
-$func$ LANGUAGE PLPERLU;
+-- INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0726', :eg_version); -- denials
+-- 
+-- CREATE OR REPLACE FUNCTION evergreen.maintain_901 () RETURNS TRIGGER AS $func$
+-- use strict;
+-- use MARC::Record;
+-- use MARC::File::XML (BinaryEncoding => 'UTF-8');
+-- use MARC::Charset;
+-- use Encode;
+-- use Unicode::Normalize;
+-- 
+-- MARC::Charset->assume_unicode(1);
+-- 
+-- my $schema = $_TD->{table_schema};
+-- my $marc = MARC::Record->new_from_xml($_TD->{new}{marc});
+-- 
+-- my @old901s = $marc->field('901');
+-- $marc->delete_fields(@old901s);
+-- 
+-- if ($schema eq 'biblio') {
+--     my $tcn_value = $_TD->{new}{tcn_value};
+-- 
+--     # Set TCN value to record ID?
+--     my $id_as_tcn = spi_exec_query("
+--         SELECT enabled
+--         FROM config.global_flag
+--         WHERE name = 'cat.bib.use_id_for_tcn'
+--     ");
+--     if (($id_as_tcn->{processed}) && $id_as_tcn->{rows}[0]->{enabled} eq 't') {
+--         $tcn_value = $_TD->{new}{id}; 
+--     }
+-- 
+--     my $new_901 = MARC::Field->new("901", " ", " ",
+--         "a" => $tcn_value,
+--         "b" => $_TD->{new}{tcn_source},
+--         "c" => $_TD->{new}{id},
+--         "t" => $schema
+--     );
+-- 
+--     if ($_TD->{new}{owner}) {
+--         $new_901->add_subfields("o" => $_TD->{new}{owner});
+--     }
+-- 
+--     if ($_TD->{new}{share_depth}) {
+--         $new_901->add_subfields("d" => $_TD->{new}{share_depth});
+--     }
+-- 
+--     $marc->append_fields($new_901);
+-- } elsif ($schema eq 'authority') {
+--     my $new_901 = MARC::Field->new("901", " ", " ",
+--         "c" => $_TD->{new}{id},
+--         "t" => $schema,
+--     );
+--     $marc->append_fields($new_901);
+-- } elsif ($schema eq 'serial') {
+--     my $new_901 = MARC::Field->new("901", " ", " ",
+--         "c" => $_TD->{new}{id},
+--         "t" => $schema,
+--         "o" => $_TD->{new}{owning_lib},
+--     );
+-- 
+--     if ($_TD->{new}{record}) {
+--         $new_901->add_subfields("r" => $_TD->{new}{record});
+--     }
+-- 
+--     $marc->append_fields($new_901);
+-- } else {
+--     my $new_901 = MARC::Field->new("901", " ", " ",
+--         "c" => $_TD->{new}{id},
+--         "t" => $schema,
+--     );
+--     $marc->append_fields($new_901);
+-- }
+-- 
+-- my $xml = $marc->as_xml_record();
+-- $xml =~ s/\n//sgo;
+-- $xml =~ s/^<\?xml.+\?\s*>//go;
+-- $xml =~ s/>\s+</></go;
+-- $xml =~ s/\p{Cc}//go;
+-- 
+-- # Embed a version of OpenILS::Application::AppUtils->entityize()
+-- # to avoid having to set PERL5LIB for PostgreSQL as well
+-- 
+-- # If we are going to convert non-ASCII characters to XML entities,
+-- # we had better be dealing with a UTF8 string to begin with
+-- $xml = decode_utf8($xml);
+-- 
+-- $xml = NFC($xml);
+-- 
+-- # Convert raw ampersands to entities
+-- $xml =~ s/&(?!\S+;)/&amp;/gso;
+-- 
+-- # Convert Unicode characters to entities
+-- $xml =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
+-- 
+-- $xml =~ s/[\x00-\x1f]//go;
+-- $_TD->{new}{marc} = $xml;
+-- 
+-- return "MODIFY";
+-- $func$ LANGUAGE PLPERLU;
 
 COMMIT;