From 64176acbc903f049c7d1508745961b72c0cc1c52 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 25 Jul 2022 15:08:35 +0200 Subject: [PATCH] Bug 29697: tracklinks should not explode on invalid marc record Caught by t/db_dependent/www/regressions.t # Failed test '404 for itemnumber containing different URI' # at t/db_dependent/www/regressions.t line 124. # got: '500' # expected: '404' # Failed test '302 for itemnumber with matching URI' # at t/db_dependent/www/regressions.t line 126. # got: '500' # expected: '302' # Failed test '404 for itemnumber containing different URI' # at t/db_dependent/www/regressions.t line 139. # got: '500' # expected: '404' # Failed test '302 for itemnumber with matching URI' # at t/db_dependent/www/regressions.t line 141. # got: '500' # expected: '302' # Looks like you failed 4 tests of 36. Signed-off-by: Tomas Cohen Arazi --- opac/tracklinks.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index ee74d8bd82..8f8e0ddb78 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -61,7 +61,7 @@ if ($uri && ($biblionumber || $itemnumber) ) { } my $biblio = Koha::Biblios->find($biblionumber); - my $record = $biblio->metadata->record; + my $record = eval{ $biblio->metadata->record }; my $marc_urls = $record ? C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')) : []; my $search_crit = { uri => { -like => "%$uri%" } }; if( $itemnumber ) { # itemnumber is leading over biblionumber -- 2.39.5