View | Details | Raw Unified | Return to bug 9728
Collapse All | Expand All

(-)a/C4/XISBN.pm (-12 / +13 lines)
Lines 21-26 use XML::Simple; Link Here
21
#use LWP::Simple;
21
#use LWP::Simple;
22
use C4::Biblio;
22
use C4::Biblio;
23
use C4::Koha;
23
use C4::Koha;
24
use C4::Search;
24
use C4::External::Syndetics qw(get_syndetics_editions);
25
use C4::External::Syndetics qw(get_syndetics_editions);
25
use LWP::UserAgent;
26
use LWP::UserAgent;
26
use HTTP::Request::Common;
27
use HTTP::Request::Common;
Lines 61-78 This module provides facilities for retrieving ThingISBN and XISBN content in Ko Link Here
61
62
62
sub _get_biblio_from_xisbn {
63
sub _get_biblio_from_xisbn {
63
    my $xisbn = shift;
64
    my $xisbn = shift;
64
    $xisbn.='%';
65
    my $dbh = C4::Context->dbh;
65
    my $dbh = C4::Context->dbh;
66
    my $query = "SELECT biblionumber FROM biblioitems WHERE isbn LIKE ?";
66
67
    my $sth = $dbh->prepare($query);
67
    my ( $errors, $results, $total_hits ) = SimpleSearch( "nb=$xisbn", 0, 1 );
68
    $sth->execute($xisbn);
68
    return unless ( !$errors && scalar @$results );
69
    my $xbib_data =  $sth->fetchrow_hashref();
69
70
    my $xbiblio;
70
    my $record = MARC::Record::new_from_usmarc( $results->[0] );
71
    if ($xbib_data->{biblionumber}) {
71
    my $biblionumber = C4::Biblio::get_koha_field_from_marc('biblio', 'biblionumber', $record, '');
72
        $xbiblio = GetBiblioData($xbib_data->{biblionumber});
72
    return unless $biblionumber;
73
        $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn});
73
74
    }
74
    my $xbiblio = GetBiblioData($biblionumber);
75
    return ($xbiblio);
75
    return unless $xbiblio;
76
    $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn});
77
    return $xbiblio;
76
}
78
}
77
79
78
=head1 get_xisbns($isbn);
80
=head1 get_xisbns($isbn);
79
- 

Return to bug 9728