From 7f6f3b924e5bc9343bb475a1add714923a025913 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E2=80=9CByWater?= <“staff@bywatersolutions.com”> Date: Thu, 16 Jan 2014 15:00:40 -0500 Subject: [PATCH] Bug 11572: ensure that running Z39.50 search from staff search results detects ISBN In Koha 3.8, if a standard catalog search was performed and the user clicked the Z39.50 search button, the search string would automatically be placed in the isbn field for the Z39.50 search form. Changes to the code have since broken this functionality. Test Plan: 1) From mainpage.pl, use "Search the catalog" to search for the string "9781570672835" 2) Click the Z39.50 Search button 3) Note the string is placed in the title field 4) Apply this patch 5) Repeat steps 1-2 6) Note the string is placed in the isbn field Signed-off-by: Mark Tompsett Signed-off-by: Katrin Fischer Tested old and new ISBN with and without hyphens. Also tested some other keyword searches. Signed-off-by: Galen Charlton Note that the behavior will be a bit odd if you do a 'replace via Z39.50' from a bib record whose title happens to be an ISBN, but this scenario seems unlikely enough to ignore. --- C4/Search.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 18a0f5f232..a7aa0f716f 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2276,11 +2276,18 @@ $template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) ) sub z3950_search_args { my $bibrec = shift; - my $isbn = Business::ISBN->new($bibrec); + + my $isbn_string = ref( $bibrec ) ? $bibrec->{title} : $bibrec; + my $isbn = Business::ISBN->new( $isbn_string ); if (defined $isbn && $isbn->is_valid) { - $bibrec = { isbn => $bibrec } if !ref $bibrec; + if ( ref($bibrec) ) { + $bibrec->{isbn} = $isbn_string; + $bibrec->{title} = undef; + } else { + $bibrec = { isbn => $isbn_string }; + } } else { $bibrec = { title => $bibrec } if !ref $bibrec; -- 2.39.5