Bug 14224: Improve escaped characters
[koha.git] / C4 / XISBN.pm
index 1211f9f..5512633 100644 (file)
@@ -4,18 +4,18 @@ package C4::XISBN;
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use XML::Simple;
 #use LWP::Simple;
@@ -26,13 +26,15 @@ use C4::External::Syndetics qw(get_syndetics_editions);
 use LWP::UserAgent;
 use HTTP::Request::Common;
 
+use Koha::SearchEngine;
+use Koha::SearchEngine::Search;
+
 use strict;
 #use warnings; FIXME - Bug 2505
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 BEGIN {
        require Exporter;
-    $VERSION = 3.07.00.049;
        @ISA = qw(Exporter);
        @EXPORT_OK = qw(
                &get_xisbns
@@ -64,10 +66,11 @@ sub _get_biblio_from_xisbn {
     my $xisbn = shift;
     my $dbh = C4::Context->dbh;
 
-    my ( $errors, $results, $total_hits ) = SimpleSearch( "nb=$xisbn", 0, 1 );
+    my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
+    my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 );
     return unless ( !$errors && scalar @$results );
 
-    my $record = MARC::Record::new_from_usmarc( $results->[0] );
+    my $record = C4::Search::new_record_from_zebra( 'biblioserver', $results->[0] );
     my $biblionumber = C4::Biblio::get_koha_field_from_marc('biblio', 'biblionumber', $record, '');
     return unless $biblionumber;