From 22aed769a69fd3b6d1864889d9f63406d92052f9 Mon Sep 17 00:00:00 2001 From: Peter Lorimer Date: Thu, 30 Jun 2011 09:47:55 +0100 Subject: [PATCH] Bug 6539 - When searching the catalogue, if I get no results then hit the Z39.50 search the title field in the pop up window is populated with what I searched for. If I search for a valid ISBN number and hit the Z39.50 search, the title field is populated with the ISBN number I searched for. This number should populate the ISBN field and not the title field. http://bugs.koha-community.org/show_bug.cgi?id=6539 Signed-off-by: Katrin Fischer To test: - Search new ISBN using ISBN search from advanced search page - 0 results - click on Z39.50 search - Z30.50 form will have your ISBN in ISBN search option I am signing off on this, because it's an improvement over the current behaviour. I see some problems though that should perhaps be addressed in a separate bug or as a follow-up: If you use th catalog search field and search for an ISBN or a keyword the right fields of the Z39.50 search form will be populated, but the search index will be put in front: ISBN: kw,wrdl: 9783492251495 or Title: kw,wrdl: koha testing If you search for ISBN as keyword on the advanced search page, it will still populate the Title search. Signed-off-by: Liz Rea Signed-off-by: Paul Poulain --- C4/Search.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index f090fd8e63..0600cb9f81 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -34,6 +34,7 @@ use C4::Items; use C4::Charset; use YAML; use URI::Escape; +use Business::ISBN; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); @@ -1721,7 +1722,7 @@ sub searchResults { $item_in_transit_count++ if $transfertwhen ne ''; $item_onhold_count++ if $reservestatus eq 'Waiting'; $item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; - + # can place hold on item ? if ((!$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems')) && !$item->{itemlost} @@ -2637,7 +2638,15 @@ $template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) ) sub z3950_search_args { my $bibrec = shift; - $bibrec = { title => $bibrec } if !ref $bibrec; + my $isbn = Business::ISBN->new($bibrec); + + if (defined $isbn && $isbn->is_valid) + { + $bibrec = { isbn => $bibrec } if !ref $bibrec; +} +else { + $bibrec = { title => $bibrec } if !ref $bibrec; +} my $array = []; for my $field (qw/ lccn isbn issn title author dewey subject /) { -- 2.39.5