From 410b65706d1c739816e6f5b4d79dd4cb4509ba43 Mon Sep 17 00:00:00 2001 From: Peter Lorimer Date: Thu, 30 Jun 2011 09:47:55 +0100 Subject: [PATCH] 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. --- C4/Search.pm | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index c3cff65..d8d2ec5 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); @@ -1423,7 +1424,7 @@ sub searchResults { #find branchname #get branch information..... my %branches; - my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches"); # FIXME : use C4::Branch::GetBranches + my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches "); $bsth->execute(); while ( my $bdata = $bsth->fetchrow_hashref ) { $branches{ $bdata->{'branchcode'} } = $bdata->{'branchname'}; @@ -1671,7 +1672,7 @@ sub searchResults { ($reservestatus, $reserveitem) = C4::Reserves::CheckReserves($item->{itemnumber}); } - # item is withdrawn, lost, damaged, not for loan, reserved or in transit + # item is withdrawn, lost or damaged if ( $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} @@ -1686,8 +1687,8 @@ 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 ? + + # can place hold on item ? if ((!$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems')) && !$item->{itemlost} && !$item->{withdrawn} @@ -1695,6 +1696,7 @@ sub searchResults { $can_place_holds = 1; } + $other_count++; my $key = $prefix . $item->{status}; @@ -2599,9 +2601,20 @@ $template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) ) =cut + + + 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 /) { @@ -2641,6 +2654,9 @@ OR adds a new authority record =cut + + + sub BiblioAddAuthorities{ my ( $record, $frameworkcode ) = @_; my $dbh=C4::Context->dbh; -- 1.7.4.1