From 90620188d507096bdf3ee32934dc485bbf6db710 Mon Sep 17 00:00:00 2001 From: Peter Lorimer Date: Thu, 30 Jun 2011 09:47:55 +0100 Subject: [PATCH] [Signed Off] 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. Content-Type: text/plain; charset="utf-8" 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 --- C4/Search.pm | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 4a8de5c..9afdaf2 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -33,6 +33,7 @@ use C4::Debug; use C4::Items; use YAML; use URI::Escape; +use Business::ISBN; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); @@ -1713,7 +1714,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} @@ -2628,7 +2629,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 /) { -- 1.7.5.4