@@ -, +, @@ --- Koha/Holding.pm | 20 ++++++++++++++-- Koha/Holdings.pm | 2 +- cataloguing/addholding.pl | 23 +++++++------------ .../marc21_field_008_holdings.pl | 5 ++-- .../value_builder/marc21_leader_holdings.pl | 4 ++-- 5 files changed, 32 insertions(+), 22 deletions(-) --- a/Koha/Holding.pm +++ a/Koha/Holding.pm @@ -22,8 +22,8 @@ use Modern::Perl; use Carp; -use C4::Charset; # SetUTF8Flag -use C4::Log; # logaction +use C4::Charset qw( SetUTF8Flag ); +use C4::Log qw( logaction ); use Koha::Database; use Koha::DateUtils qw(dt_from_string); @@ -42,6 +42,22 @@ Koha::Holding - Koha Holding Object class =cut +=head3 biblio + + my $biblio = $holding->biblio(); + +Returns the holding biblio for this record. + +=cut + +sub biblio { + my ($self) = @_; + + my $biblio = $self->_result->biblionumber(); + return unless $biblio; + return Koha::Library->_new_from_dbic($biblio); +} + =head3 holding_branch my $branch = $hold->holding_branch(); --- a/Koha/Holdings.pm +++ a/Koha/Holdings.pm @@ -23,7 +23,7 @@ use Modern::Perl; use Carp; use C4::Biblio; -use C4::Charset; # For SetMarcUnicodeFlag +use C4::Charset qw( SetMarcUnicodeFlag ); use C4::Context; use Koha::Holding; --- a/cataloguing/addholding.pl +++ a/cataloguing/addholding.pl @@ -20,26 +20,19 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -# TODO: refactor to avoid duplication from addbiblio +use Modern::Perl; -use strict; -#use warnings; FIXME - Bug 2505 use CGI q(-utf8); -use C4::Output; -use C4::Auth; -use C4::Search; -use C4::Biblio; +use C4::Output qw( output_html_with_http_headers ); +use C4::Auth qw( get_template_and_user haspermission ); +use C4::Biblio + qw( GetMarcFromKohaField GetMarcStructure GetUsedMarcStructure TransformHtmlToMarc ); use C4::Context; use MARC::Record; -use C4::Log; -use C4::Koha; -use C4::ClassSource; -use C4::ImportBatch; -use C4::Charset; +use C4::ClassSource qw( GetClassSources ); use Koha::Biblios; use Koha::BiblioFrameworks; -use Koha::DateUtils; -use C4::Matcher; +use Koha::DateUtils qw( dt_from_string ); use Koha::ItemTypes; use Koha::Libraries; @@ -47,7 +40,7 @@ use Koha::Libraries; use Date::Calc qw(Today); use MARC::File::USMARC; use MARC::File::XML; -use URI::Escape; +use URI::Escape qw( uri_escape_utf8 ); if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { MARC::File::XML->default_record_format('UNIMARC'); --- a/cataloguing/value_builder/marc21_field_008_holdings.pl +++ a/cataloguing/value_builder/marc21_field_008_holdings.pl @@ -19,10 +19,11 @@ # along with Koha; if not, see . use Modern::Perl; -use C4::Auth; +use C4::Auth qw( get_template_and_user ); use CGI qw ( -utf8 ); use C4::Context; -use C4::Output; + +use C4::Output qw( output_html_with_http_headers ); use XML::LibXML; use Koha::Util::FrameworkPlugin qw|date_entered|; --- a/cataloguing/value_builder/marc21_leader_holdings.pl +++ a/cataloguing/value_builder/marc21_leader_holdings.pl @@ -21,9 +21,9 @@ use Modern::Perl; use CGI qw ( -utf8 ); -use C4::Auth; +use C4::Auth qw( get_template_and_user ); use C4::Context; -use C4::Output; +use C4::Output qw( output_html_with_http_headers ); my $builder = sub { my ( $params ) = @_; --