From 46a8968e0274fa2eba07abd49ce63ebdf9f3b5e5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 18 Mar 2021 09:38:06 +1300 Subject: [PATCH] Bug 27979: Modify TrackClicks to verify URL exists in DB when multiple uri To test: 1) Go to Admin -> system preferences and enable the TrackClicks syspref (set to Track or Track anonymously) 2) Find a record in the staff client with an item. Edit the item and put two external URLs in the Uniform Resource Identifier field, e.g. "https://www.google.com/ | https://twitter.com/" 3) Search for that record in the OPAC. Notice the two links in the holdings table. 4) Click a link and confirm that you are directed to a 404. 5) Apply the patch and refresh the page 6) Click a link and confirm that you are directed to the page as expected 7) Go back to edit the record in the staff client and remove one of the links from the URI field 8) Go back to the OPAC and confirm you can still access the link as expected when there is only one URI Sponsored-by: Catalyst IT Signed-off-by: David Nind --- opac/tracklinks.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index ab07f033be..e357f0a1df 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -61,7 +61,7 @@ if ($uri && ($biblionumber || $itemnumber) ) { my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); my $marc_urls = $record ? C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')) : []; - my $search_crit = { uri => $uri }; + my $search_crit = { uri => { -like => "%$uri%" } }; if( $itemnumber ) { # itemnumber is leading over biblionumber $search_crit->{itemnumber} = $itemnumber; } elsif( $biblionumber ) { -- 2.11.0