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 <Katrin.Fischer.83@web.de>

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 <wizzyrea@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Peter Lorimer 2011-06-30 09:47:55 +01:00 committed by Paul Poulain
parent 049ac6e2a7
commit 22aed769a6

View file

@ -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 /)
{