@@ -, +, @@ - Activate FRBRizeEditions and XISBN sysprefs - Go to a biblio witch has several editions - Note its normalized ISBN (you may look in amazon links) - Replace [ISBN] by biblio normalized ISBN in this URL : http://xisbn.worldcat.org/webservices/xid/isbn/[ISBN]?method=getEditions&format=xml&fl=form,year,lang,ed - Go to this URL and see which ISBNs are returned - Perform a simple search on thoses ISBNs : nb:1234567890 - Look at "Editions" tab --- C4/XISBN.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/C4/XISBN.pm +++ a/C4/XISBN.pm @@ -21,6 +21,7 @@ use XML::Simple; #use LWP::Simple; use C4::Biblio; use C4::Koha; +use C4::Search; use C4::External::Syndetics qw(get_syndetics_editions); use LWP::UserAgent; use HTTP::Request::Common; @@ -61,18 +62,19 @@ This module provides facilities for retrieving ThingISBN and XISBN content in Ko sub _get_biblio_from_xisbn { my $xisbn = shift; - $xisbn.='%'; my $dbh = C4::Context->dbh; - my $query = "SELECT biblionumber FROM biblioitems WHERE isbn LIKE ?"; - my $sth = $dbh->prepare($query); - $sth->execute($xisbn); - my $xbib_data = $sth->fetchrow_hashref(); - my $xbiblio; - if ($xbib_data->{biblionumber}) { - $xbiblio = GetBiblioData($xbib_data->{biblionumber}); - $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn}); - } - return ($xbiblio); + + my ( $errors, $results, $total_hits ) = SimpleSearch( "nb=$xisbn", 0, 1 ); + return unless ( !$errors && scalar @$results ); + + my $record = MARC::Record::new_from_usmarc( $results->[0] ); + my $biblionumber = C4::Biblio::get_koha_field_from_marc('biblio', 'biblionumber', $record, ''); + return unless $biblionumber; + + my $xbiblio = GetBiblioData($biblionumber); + return unless $xbiblio; + $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn}); + return $xbiblio; } =head1 get_xisbns($isbn); --