From e9e165453468131bd84067ce479d8b4414646ab2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 16 Jul 2021 13:49:32 +0100 Subject: [PATCH] Bug 20447: Fixes for bug 17600 --- 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(-) diff --git a/Koha/Holding.pm b/Koha/Holding.pm index a37012954e..f109f2ec26 100644 --- a/Koha/Holding.pm +++ b/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(); diff --git a/Koha/Holdings.pm b/Koha/Holdings.pm index 5025b624a2..0c6eed8907 100644 --- a/Koha/Holdings.pm +++ b/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; diff --git a/cataloguing/addholding.pl b/cataloguing/addholding.pl index c2a0cff6a7..bd1f3114fd 100755 --- a/cataloguing/addholding.pl +++ b/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'); diff --git a/cataloguing/value_builder/marc21_field_008_holdings.pl b/cataloguing/value_builder/marc21_field_008_holdings.pl index 601f7ae076..8e28dd9d6e 100755 --- a/cataloguing/value_builder/marc21_field_008_holdings.pl +++ b/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|; diff --git a/cataloguing/value_builder/marc21_leader_holdings.pl b/cataloguing/value_builder/marc21_leader_holdings.pl index f8e5c69a76..959a163c72 100755 --- a/cataloguing/value_builder/marc21_leader_holdings.pl +++ b/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 ) = @_; -- 2.25.1