From d78bbbeddd0ca8dfb9555977638d177b3b2cbb9b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 May 2023 16:36:26 +0200 Subject: [PATCH] Bug 32060: Use selectrow_array Trivial ergonomic patch, use selectrow_array, no need to prepare the query + perltidy the sub Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- C4/Biblio.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b24a0a7c5f..2c63adb00e 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1833,15 +1833,15 @@ sub UpsertMarcControlField { sub GetFrameworkCode { my ($biblionumber) = @_; - my $cache = Koha::Cache::Memory::Lite->get_instance(); - my $cache_key = "FrameworkCode-$biblionumber"; - my $frameworkcode = $cache->get_from_cache($cache_key); - unless (defined $frameworkcode) { + my $cache = Koha::Cache::Memory::Lite->get_instance(); + my $cache_key = "FrameworkCode-$biblionumber"; + my $frameworkcode = $cache->get_from_cache($cache_key); + unless ( defined $frameworkcode ) { my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("SELECT frameworkcode FROM biblio WHERE biblionumber=?"); - $sth->execute($biblionumber); - ($frameworkcode) = $sth->fetchrow; - $cache->set_in_cache($cache_key, $frameworkcode); + ($frameworkcode) = $dbh->selectrow_array( + "SELECT frameworkcode FROM biblio WHERE biblionumber=?", + undef, $biblionumber ); + $cache->set_in_cache( $cache_key, $frameworkcode ); } return $frameworkcode; } -- 2.39.5