From 7f3b26bc74fc49d310a9bcfeaebbaa661ee23de9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 9 Aug 2019 09:18:13 +0000 Subject: [PATCH] Bug 23329: (follow-up) Allow item URI with a biblionumber parameter If you pass a URI with a biblionumber without specifying the itemnumber, tracklinks did not redirect an item URI. Test plan: [1] Add URI in an item. [2] Pass this URI with the itemnumber to tracklinks. Should pass. [3] Pass this URI with the biblionumber to tracklinks. Should pass now too. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- opac/tracklinks.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index 31fc930b0e..09afd3209a 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -56,8 +56,14 @@ if ($uri && ($biblionumber || $itemnumber) ) { my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); my $marc_urls = C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')); + my $search_crit = { uri => $uri }; + if( $itemnumber ) { # itemnumber is leading over biblionumber + $search_crit->{itemnumber} = $itemnumber; + } elsif( $biblionumber ) { + $search_crit->{biblionumber} = $biblionumber; + } if ( ( any { $_ eq $uri } map { $_->{MARCURL} } @$marc_urls ) - || Koha::Items->search( { itemnumber => $itemnumber, uri => $uri } )->count ) + || Koha::Items->search( $search_crit )->count ) { $tracker->trackclick( { -- 2.39.5