Bug 17600: Standardize our EXPORT_OK
[srvgit] / misc / batchImportMARCWithBiblionumbers.pl
index a1bf26e..b96e012 100755 (executable)
@@ -2,23 +2,24 @@
 # load records that already have biblionumber set into a koha system
 # Written by TG on 10/04/2006
 use strict;
+#use warnings; FIXME - Bug 2505
 BEGIN {
     # find Koha's Perl modules
     # test carefully before changing this
-    use FindBin;
+    use FindBin ();
     eval { require "$FindBin::Bin/kohalib.pl" };
 }
 
 # Koha modules used
 
+use Koha::Script;
 use C4::Context;
-use C4::Biblio;
-use MARC::Record;
+use C4::Biblio qw( GetMarcFromKohaField );
 use MARC::File::USMARC;
 use MARC::File::XML;
 use MARC::Batch;
-use Time::HiRes qw(gettimeofday);
-use Getopt::Long;
+use Time::HiRes qw( gettimeofday );
+use Getopt::Long qw( GetOptions );
 use IO::File;
 
 my  $input_marc_file = '';
@@ -51,11 +52,11 @@ my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file,
 my $batch = MARC::Batch->new( 'USMARC', $fh );
 $batch->warnings_off();
 $batch->strict_off();
-my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
+my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField( "biblio.biblionumber" );
 
 my $i=0;
 while ( my $record = $batch->next() ) {
-       my $biblionumber=$record->field($tagfield)->subfield($biblionumtagsubfield);
+    my $biblionumber = ($tagfield < 10) ? $record->field($tagfield)->data : $record->subfield($tagfield, $biblionumtagsubfield);
        $i++;
        $sth2->execute($record->as_usmarc,$biblionumber) if $biblionumber;
        print "$biblionumber \n";
@@ -76,7 +77,7 @@ sub search {
                return("error",undef);
        }
        my $oAResult;
-       my $Anewq= new ZOOM::Query::PQF($nquery);
+       my $Anewq= ZOOM::Query::PQF->new($nquery);
        eval {
        $oAResult= $oAuth->search_pqf($nquery) ; 
        };