|
Lines 36-41
my $want_help = 0;
Link Here
|
| 36 |
my $auth_limit; |
36 |
my $auth_limit; |
| 37 |
my $bib_limit; |
37 |
my $bib_limit; |
| 38 |
my $commit = 100; |
38 |
my $commit = 100; |
|
|
39 |
my $tagtolink; |
| 39 |
|
40 |
|
| 40 |
my $result = GetOptions( |
41 |
my $result = GetOptions( |
| 41 |
'v|verbose' => \$verbose, |
42 |
'v|verbose' => \$verbose, |
|
Lines 44-49
my $result = GetOptions(
Link Here
|
| 44 |
'a|auth-limit=s' => \$auth_limit, |
45 |
'a|auth-limit=s' => \$auth_limit, |
| 45 |
'b|bib-limit=s' => \$bib_limit, |
46 |
'b|bib-limit=s' => \$bib_limit, |
| 46 |
'c|commit=i' => \$commit, |
47 |
'c|commit=i' => \$commit, |
|
|
48 |
'g|tagtolink=i' => \$tagtolink, |
| 47 |
'h|help' => \$want_help |
49 |
'h|help' => \$want_help |
| 48 |
); |
50 |
); |
| 49 |
|
51 |
|
|
Lines 77-89
my %linked_headings;
Link Here
|
| 77 |
my %fuzzy_headings; |
79 |
my %fuzzy_headings; |
| 78 |
my $dbh = C4::Context->dbh; |
80 |
my $dbh = C4::Context->dbh; |
| 79 |
$dbh->{AutoCommit} = 0; |
81 |
$dbh->{AutoCommit} = 0; |
| 80 |
process_bibs( $linker, $bib_limit, $auth_limit, $commit ); |
82 |
process_bibs( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ); |
| 81 |
$dbh->commit(); |
83 |
$dbh->commit(); |
| 82 |
|
84 |
|
| 83 |
exit 0; |
85 |
exit 0; |
| 84 |
|
86 |
|
| 85 |
sub process_bibs { |
87 |
sub process_bibs { |
| 86 |
my ( $linker, $bib_limit, $auth_limit, $commit ) = @_; |
88 |
my ( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ) = @_; |
| 87 |
my $bib_where = ''; |
89 |
my $bib_where = ''; |
| 88 |
my $starttime = time(); |
90 |
my $starttime = time(); |
| 89 |
if ($bib_limit) { |
91 |
if ($bib_limit) { |
|
Lines 95-101
sub process_bibs {
Link Here
|
| 95 |
$sth->execute(); |
97 |
$sth->execute(); |
| 96 |
while ( my ($biblionumber) = $sth->fetchrow_array() ) { |
98 |
while ( my ($biblionumber) = $sth->fetchrow_array() ) { |
| 97 |
$num_bibs_processed++; |
99 |
$num_bibs_processed++; |
| 98 |
process_bib( $linker, $biblionumber ); |
100 |
process_bib( $linker, $biblionumber, $tagtolink ); |
| 99 |
|
101 |
|
| 100 |
if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { |
102 |
if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { |
| 101 |
print_progress_and_commit($num_bibs_processed); |
103 |
print_progress_and_commit($num_bibs_processed); |
|
Lines 187-192
_FUZZY_HEADER_
Link Here
|
| 187 |
sub process_bib { |
189 |
sub process_bib { |
| 188 |
my $linker = shift; |
190 |
my $linker = shift; |
| 189 |
my $biblionumber = shift; |
191 |
my $biblionumber = shift; |
|
|
192 |
my $tagtolink = shift; |
| 190 |
|
193 |
|
| 191 |
my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); |
194 |
my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); |
| 192 |
unless ( defined $bib ) { |
195 |
unless ( defined $bib ) { |
|
Lines 197-205
sub process_bib {
Link Here
|
| 197 |
} |
200 |
} |
| 198 |
|
201 |
|
| 199 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
202 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
|
|
203 |
my $allowrelink = C4::Context->preference("CatalogModuleRelink") || ''; |
| 200 |
|
204 |
|
| 201 |
my ( $headings_changed, $results ) = |
205 |
my ( $headings_changed, $results ) = |
| 202 |
LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode ); |
206 |
LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink ); |
| 203 |
foreach my $key ( keys %{ $results->{'unlinked'} } ) { |
207 |
foreach my $key ( keys %{ $results->{'unlinked'} } ) { |
| 204 |
$unlinked_headings{$key} += $results->{'unlinked'}->{$key}; |
208 |
$unlinked_headings{$key} += $results->{'unlinked'}->{$key}; |
| 205 |
} |
209 |
} |
|
Lines 246-251
link_bibs_to_authorities.pl
Link Here
|
| 246 |
link_bibs_to_authorities.pl --commit=1000 |
250 |
link_bibs_to_authorities.pl --commit=1000 |
| 247 |
link_bibs_to_authorities.pl --auth-limit=STRING |
251 |
link_bibs_to_authorities.pl --auth-limit=STRING |
| 248 |
link_bibs_to_authorities.pl --bib-limit=STRING |
252 |
link_bibs_to_authorities.pl --bib-limit=STRING |
|
|
253 |
link_bibs_to_authorities.pl -g=700 |
| 249 |
|
254 |
|
| 250 |
=head1 DESCRIPTION |
255 |
=head1 DESCRIPTION |
| 251 |
|
256 |
|
|
Lines 281-286
Only process those bib records that match the user-specified WHERE clause.
Link Here
|
| 281 |
|
286 |
|
| 282 |
Commit the results to the database after every N records are processed. |
287 |
Commit the results to the database after every N records are processed. |
| 283 |
|
288 |
|
|
|
289 |
=item B<-g=N> |
| 290 |
|
| 291 |
Only process those headings found in MARC field N. |
| 292 |
|
| 284 |
=item B<--test> |
293 |
=item B<--test> |
| 285 |
|
294 |
|
| 286 |
Only test the authority linking and report the results; do not change the bib |
295 |
Only test the authority linking and report the results; do not change the bib |
| 287 |
- |
|
|