From 9b8597a1886e20b51ea9a7ec660e754b695c3b95 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Thu, 23 Sep 2021 15:49:16 -0400 Subject: [PATCH] LP1930747: Add MARC_NAMESPACE to Const.pm Now that we have 3 separate $MARC_NAMESPACE definitions it's time to just move it into Const.pm and call it done. Signed-off-by: Jason Boyer Signed-off-by: Jason Stephenson --- .../src/perlmods/lib/OpenILS/Application/AppUtils.pm | 5 ++--- .../lib/OpenILS/Application/Cat/AuthCommon.pm | 5 ++--- .../perlmods/lib/OpenILS/Application/Cat/BibCommon.pm | 11 +++++------ Open-ILS/src/perlmods/lib/OpenILS/Const.pm | 5 +++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index 44bb48db6e..120b568b9c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -25,7 +25,6 @@ use Digest::MD5 qw(md5_hex); # Pile of utilty methods used accross applications. # --------------------------------------------------------------------------- my $cache_client = "OpenSRF::Utils::Cache"; -my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim'; # --------------------------------------------------------------------------- # on sucess, returns the created session, on failure throws ERROR exception @@ -2443,8 +2442,8 @@ sub verify_migrated_user_password { sub marc_xml_to_doc { my ($class, $xml) = @_; my $marc_doc = XML::LibXML->new->parse_string($xml); - $marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1); - $marc_doc->documentElement->setNamespace($MARC_NAMESPACE); + $marc_doc->documentElement->setNamespace(MARC_NAMESPACE, 'marc', 1); + $marc_doc->documentElement->setNamespace(MARC_NAMESPACE); return $marc_doc; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm index f988146ab8..ce5df4e9a3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm @@ -8,7 +8,6 @@ use OpenILS::Const qw/:const/; use OpenSRF::AppSession; use OpenILS::Event; my $U = 'OpenILS::Application::AppUtils'; -my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim'; # --------------------------------------------------------------------------- @@ -19,8 +18,8 @@ my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim'; sub marc_xml_to_doc { my $xml = shift; my $marc_doc = XML::LibXML->new->parse_string($xml); - $marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1); - $marc_doc->documentElement->setNamespace($MARC_NAMESPACE); + $marc_doc->documentElement->setNamespace(MARC_NAMESPACE, 'marc', 1); + $marc_doc->documentElement->setNamespace(MARC_NAMESPACE); return $marc_doc; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm index ebbaed0043..5f48f7d97c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm @@ -8,7 +8,6 @@ use OpenILS::Const qw/:const/; use OpenSRF::AppSession; use OpenILS::Event; my $U = 'OpenILS::Application::AppUtils'; -my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim'; # --------------------------------------------------------------------------- @@ -143,8 +142,8 @@ sub biblio_record_xml_import { sub __make_marc_doc { my $xml = shift; my $marcxml = XML::LibXML->new->parse_string($xml); - $marcxml->documentElement->setNamespace($MARC_NAMESPACE, "marc", 1 ); - $marcxml->documentElement->setNamespace($MARC_NAMESPACE); + $marcxml->documentElement->setNamespace(MARC_NAMESPACE, "marc", 1 ); + $marcxml->documentElement->setNamespace(MARC_NAMESPACE); __remove_empty_marc_nodes($marcxml); return $marcxml; } @@ -155,9 +154,9 @@ sub __make_marc_doc { sub __remove_empty_marc_nodes { my $marcxml = shift; - __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'controlfield'); - __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'subfield'); - __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'datafield'); + __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS(MARC_NAMESPACE, 'controlfield'); + __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS(MARC_NAMESPACE, 'subfield'); + __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS(MARC_NAMESPACE, 'datafield'); } sub __remove_if_childless { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm index 85e8b71889..ee90aa22e2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm @@ -131,6 +131,11 @@ econst OILS_PENALTY_INVALID_PATRON_ADDRESS => 29; econst OILS_BILLING_TYPE_NOTIFICATION_FEE => 9; +# --------------------------------------------------------------------- +# Non Evergreen-specific constants +# --------------------------------------------------------------------- +econst MARC_NAMESPACE => 'http://www.loc.gov/MARC21/slim'; + # --------------------------------------------------------------------- # finally, export all the constants -- 2.43.2