From 505f4ec887a09d485c3fd2c6b09e9a118414e249 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Jan 2018 13:58:53 -0300 Subject: [PATCH] Bug 19940: Koha::Biblio - Remove GetBiblioItemInfosOf This subroutine is only used once and can be replaced easily with a Koha::Biblioitems->search call Test plan: Test this on top of bug 19941 and confirm that the correct item types are displayed Signed-off-by: Tomas Cohen Arazi --- C4/Biblio.pm | 23 ----------------------- reserve/request.pl | 12 ++++++++++-- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index dac065608c..800a48c1c4 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -68,7 +68,6 @@ BEGIN { GetBiblioData GetMarcBiblio GetBiblioItemData - GetBiblioItemInfosOf GetBiblioItemByBiblioNumber &GetRecordValue @@ -909,28 +908,6 @@ sub GetISBDView { return $res; } -=head2 GetBiblioItemInfosOf - - GetBiblioItemInfosOf(@biblioitemnumbers); - -=cut - -sub GetBiblioItemInfosOf { - my @biblioitemnumbers = @_; - - my $biblioitemnumber_values = @biblioitemnumbers ? join( ',', @biblioitemnumbers ) : "''"; - - my $dbh = C4::Context->dbh; - my $query = " - SELECT biblioitemnumber, - publicationyear, - itemtype - FROM biblioitems - WHERE biblioitemnumber IN ($biblioitemnumber_values) - "; - return $dbh->selectall_hashref($query, 'biblioitemnumber'); -} - =head1 FUNCTIONS FOR HANDLING MARC MANAGEMENT =head2 IsMarcStructureInternal diff --git a/reserve/request.pl b/reserve/request.pl index d94a8ab6af..f92b2ab86d 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -316,8 +316,16 @@ foreach my $biblionumber (@biblionumbers) { ## Should be same as biblionumber my @biblioitemnumbers = keys %itemnumbers_of_biblioitem; - ## Hash of biblioitemnumber to 'biblioitem' table records - my $biblioiteminfos_of = GetBiblioItemInfosOf(@biblioitemnumbers); + my $biblioiteminfos_of = { + map { + my $biblioitem = $_; + ( $biblioitem->{biblioitemnumber} => $biblioitem ) + } @{ Koha::Biblioitems->search( + { biblioitemnumber => { -in => \@biblioitemnumbers } }, + { select => ['biblioitemnumber', 'publicationyear', 'itemtype']} + )->unblessed + } + }; my $frameworkcode = GetFrameworkCode( $biblionumber ); my @notforloan_avs = Koha::AuthorisedValues->search_by_koha_field({ kohafield => 'items.notforloan', frameworkcode => $frameworkcode }); -- 2.16.2