[Koha-patches] [PATCH] Bug 4215 OPAC "Search for title in" can fail with trailing slashes in title

Jane Wagner jwagner at ptfs.com
Thu Feb 18 17:45:50 CET 2010


While configuring Search for Title In links, I found that some target sites
can't process an incoming title search if the title being sent has a trailing
slash.  If the same search is sent without the trailing slash, it works fine.  I
modified opac-detail.pl to strip off the trailing slash (and space) for titles
being sent to other sites.
---
 opac/opac-detail.pl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index cf5cf1b..d43651b 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -586,6 +586,8 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref
 #Search for title in links
 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
     $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
+    $dat->{title} =~ s/\/+$//; # remove trailing slash
+    $dat->{title} =~ s/\s+$//; # remove trailing space
     $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
     $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
  $template->param('OPACSearchForTitleIn' => $search_for_title);
-- 
1.5.6.5




More information about the Koha-patches mailing list