From 13c3045257d6822fdcce57142b6b25856932acaf 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 Content-Type: text/plain; charset=utf-8 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 Signed-off-by: Marcel de Rooy --- 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 dac0656..800a48c 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 d94a8ab..f92b2ab 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.1.4