#1474 : Bulkmarcimport croaks when Log is ON
[koha_gimpoz] / misc / bulkauthimport.pl
index 728a1f1..0d37b64 100755 (executable)
@@ -36,7 +36,7 @@ parameters :
 \tc : the char encoding. At the moment, only MARC21 and UNIMARC supported. MARC21 by default.
 \d : delete EVERYTHING related to biblio in koha-DB before import  :tables :
 \t\tbiblio, \t\tbiblioitems, \t\tsubjects,\titems
-\t\tadditionalauthors, \tbibliosubtitles, \tmarc_biblio,
+\tmarc_biblio,
 \t\tmarc_subfield_table, \tmarc_word, \t\tmarc_blob_subfield
 IMPORTANT : don't use this script before you've entered and checked twice (or more) your  MARC parameters tables.
 If you fail this, the import won't work correctly and you will get invalid datas.
@@ -52,8 +52,6 @@ my $dbh = C4::Context->dbh;
 if ($delete) {
        print "deleting authorities\n";
        $dbh->do("delete from auth_header");
-       $dbh->do("delete from auth_subfield_table");
-       $dbh->do("delete from auth_word");
 }
 if ($test_parameter) {
        print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
@@ -102,17 +100,17 @@ while ( my $record = $batch->next() ) {
        warn "$i ==>".$newRecord->as_formatted() if $verbose eq 2;
        my $authtypecode=substr($newRecord->leader(),9,1);
        $authtypecode="NP" if ($authtypecode eq 'a'); # personnes
-       $authtypecode="CO" if ($authtypecode eq 'b'); # collectivités
-       $authtypecode="NG" if ($authtypecode eq 'c'); # géographique
+       $authtypecode="CO" if ($authtypecode eq 'b'); # collectivit
+       $authtypecode="NG" if ($authtypecode eq 'c'); # ggraphique
        $authtypecode="NM" if ($authtypecode eq 'd'); # marque
        $authtypecode="NF" if ($authtypecode eq 'e'); # famille
        $authtypecode="TI" if ($authtypecode eq 'f'); # Titre uniforme
        $authtypecode="TI" if ($authtypecode eq 'h'); # auteur/titre
-       $authtypecode="MM" if ($authtypecode eq 'j'); # mot matière
+       $authtypecode="MM" if ($authtypecode eq 'j'); # mot matie
        warn "XX => $authtypecode";
        # now, create biblio and items with NEWnewXX call.
        unless ($test_parameter) {
-               my ($authid) = AUTHaddauthority($dbh,$newRecord,0,$authtypecode);
+               my ($authid) = AddAuthority($newRecord,0,$authtypecode);
                warn "ADDED authority NB $authid in DB\n" if $verbose;
        }
 }