From 5cafc94bed5f0e63165f937cdab936a98d028b73 Mon Sep 17 00:00:00 2001 From: phasefx Date: Sat, 20 Sep 2008 06:03:57 +0000 Subject: [PATCH] move these lingering methods from Cat.pm to Cat/BibCommon.pm and put a trailing 1; in BibCommon.pm git-svn-id: svn://svn.open-ils.org/ILS/trunk@10655 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Cat.pm | 18 +--------------- .../OpenILS/Application/Cat/BibCommon.pm | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm index 1bba432bfa..25f7507336 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm @@ -81,18 +81,6 @@ sub _load_marc_template { return XML::LibXML->new->parse_string($xml)->documentElement->toString; } -my $__bib_sources; -sub bib_source_from_name { - my $name = shift; - $logger->debug("searching for bib source: $name"); - - fetch_bib_sources(); - - my ($s) = grep { lc($_->source) eq lc($name) } @$__bib_sources; - - return $s->id if $s; - return undef; -} __PACKAGE__->register_method( @@ -100,13 +88,9 @@ __PACKAGE__->register_method( api_name => 'open-ils.cat.bib_sources.retrieve.all'); sub fetch_bib_sources { - $__bib_sources = new_editor()->retrieve_all_config_bib_source() - unless $__bib_sources; - return $__bib_sources; + return OpenILS::Application::Cat::BibCommon->fetch_bib_sources(); } - - __PACKAGE__->register_method( method => "create_record_xml", api_name => "open-ils.cat.biblio.record.xml.create.override", diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm index 492fb65a68..8f2b35d80b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm @@ -15,6 +15,25 @@ my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim'; # Shared bib mangling code. Do not publish methods from here. # --------------------------------------------------------------------------- +my $__bib_sources; +sub bib_source_from_name { + my $name = shift; + $logger->debug("searching for bib source: $name"); + + fetch_bib_sources(); + + my ($s) = grep { lc($_->source) eq lc($name) } @$__bib_sources; + + return $s->id if $s; + return undef; +} + +sub fetch_bib_sources { + $__bib_sources = new_editor()->retrieve_all_config_bib_source() + unless $__bib_sources; + return $__bib_sources; +} + sub biblio_record_replace_marc { my($class, $e, $recid, $newxml, $source, $fixtcn, $override) = @_; @@ -271,4 +290,4 @@ sub _tcn_exists { return 0; } - +1; -- 2.43.2