# script that rebuild thesaurus from biblio table.
use strict;
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/kohalib.pl" };
+}
# Koha modules used
use MARC::File::USMARC;
# my @subf = $subfields =~ /(##\d\d\d##.)/g;
$|=1; # flushes output
-my $authfrom = AUTHgetauthority($dbh,$mergefrom);
-my $authto = AUTHgetauthority($dbh,$mergeto);
+my $authfrom = AUTHgetauthority($mergefrom);
+my $authto = AUTHgetauthority($mergeto);
-my $authtypecodefrom = AUTHfind_authtypecode($dbh,$mergefrom);
-my $authtypecodeto = AUTHfind_authtypecode($dbh,$mergeto);
+my $authtypecodefrom = AUTHfind_authtypecode($mergefrom);
+my $authtypecodeto = AUTHfind_authtypecode($mergeto);
unless ($noconfirm) {
print "************\n";
# delete all subfields that are in the same tag/tagorder and that are in the authority (& that are not in tab ignore in the biblio)
# then recreate them with the new authority.
foreach my $subfield (@record_from) {
- &MARCdelsubfield($dbh,$bibid,$tag,$tagorder,$subfield->[0]);
+ &MARCdelsubfield($bibid,$tag,$tagorder,$subfield->[0]);
}
&MARCdelsubfield($dbh,$bibid,$tag,$tagorder,'9');
foreach my $subfield (@record_to) {
- &MARCaddsubfield($dbh,$bibid,$tag,$tag_indicator,$tagorder,$subfield->[0],$subfieldorder,$subfield->[1]);
+ &MARCaddsubfield($bibid,$tag,$tag_indicator,$tagorder,$subfield->[0],$subfieldorder,$subfield->[1]);
}
- &MARCaddsubfield($dbh,$bibid,$tag,$tag_indicator,$tagorder,'9',$subfieldorder,$mergeto);
- my $biblio = GetMarcBiblio($bibid);
+ &MARCaddsubfield($bibid,$tag,$tag_indicator,$tagorder,'9',$subfieldorder,$mergeto);
+ $biblio = GetMarcBiblio($bibid);
print "AFTER : ".$biblio->as_formatted."\n" if $verbose;
$nbdone++;
# &MARCdelsubfield($dbh,$bibid,$tag,$tagorder,$subfieldcode,$subfieldorder);
}
my $timeneeded = gettimeofday - $starttime;
-print "$nbdone authorities done in $timeneeded seconds" unless $noconfirm;
\ No newline at end of file
+print "$nbdone authorities done in $timeneeded seconds" unless $noconfirm;