|
Lines 37-42
my $auth_limit;
Link Here
|
| 37 |
my $bib_limit; |
37 |
my $bib_limit; |
| 38 |
my $commit = 100; |
38 |
my $commit = 100; |
| 39 |
my $tagtolink; |
39 |
my $tagtolink; |
|
|
40 |
my $allowrelink = C4::Context->preference("CatalogModuleRelink") || ''; |
| 40 |
|
41 |
|
| 41 |
my $result = GetOptions( |
42 |
my $result = GetOptions( |
| 42 |
'v|verbose' => \$verbose, |
43 |
'v|verbose' => \$verbose, |
|
Lines 79-91
my %linked_headings;
Link Here
|
| 79 |
my %fuzzy_headings; |
80 |
my %fuzzy_headings; |
| 80 |
my $dbh = C4::Context->dbh; |
81 |
my $dbh = C4::Context->dbh; |
| 81 |
$dbh->{AutoCommit} = 0; |
82 |
$dbh->{AutoCommit} = 0; |
| 82 |
process_bibs( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ); |
83 |
process_bibs( $linker, $bib_limit, $auth_limit, $commit, { tagtolink => $tagtolink, allowrelink => $allowrelink }); |
| 83 |
$dbh->commit(); |
84 |
$dbh->commit(); |
| 84 |
|
85 |
|
| 85 |
exit 0; |
86 |
exit 0; |
| 86 |
|
87 |
|
| 87 |
sub process_bibs { |
88 |
sub process_bibs { |
| 88 |
my ( $linker, $bib_limit, $auth_limit, $commit, $tagtolink ) = @_; |
89 |
my ( $linker, $bib_limit, $auth_limit, $commit, $args ) = @_; |
|
|
90 |
my $tagtolink = $args->{tagtolink}; |
| 91 |
my $allowrelink = $args->{allowrelink}; |
| 89 |
my $bib_where = ''; |
92 |
my $bib_where = ''; |
| 90 |
my $starttime = time(); |
93 |
my $starttime = time(); |
| 91 |
if ($bib_limit) { |
94 |
if ($bib_limit) { |
|
Lines 95-103
sub process_bibs {
Link Here
|
| 95 |
"SELECT biblionumber FROM biblio $bib_where ORDER BY biblionumber ASC"; |
98 |
"SELECT biblionumber FROM biblio $bib_where ORDER BY biblionumber ASC"; |
| 96 |
my $sth = $dbh->prepare($sql); |
99 |
my $sth = $dbh->prepare($sql); |
| 97 |
$sth->execute(); |
100 |
$sth->execute(); |
|
|
101 |
my $linker_args = { tagtolink => $tagtolink, allowrelink => $allowrelink }; |
| 98 |
while ( my ($biblionumber) = $sth->fetchrow_array() ) { |
102 |
while ( my ($biblionumber) = $sth->fetchrow_array() ) { |
| 99 |
$num_bibs_processed++; |
103 |
$num_bibs_processed++; |
| 100 |
process_bib( $linker, $biblionumber, $tagtolink ); |
104 |
process_bib( $linker, $biblionumber, $linker_args ); |
| 101 |
|
105 |
|
| 102 |
if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { |
106 |
if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { |
| 103 |
print_progress_and_commit($num_bibs_processed); |
107 |
print_progress_and_commit($num_bibs_processed); |
|
Lines 189-196
_FUZZY_HEADER_
Link Here
|
| 189 |
sub process_bib { |
193 |
sub process_bib { |
| 190 |
my $linker = shift; |
194 |
my $linker = shift; |
| 191 |
my $biblionumber = shift; |
195 |
my $biblionumber = shift; |
| 192 |
my $tagtolink = shift; |
196 |
my $args = shift; |
| 193 |
|
197 |
my $tagtolink = $args->{tagtolink}; |
|
|
198 |
my $allowrelink = $args->{allowrelink}; |
| 194 |
my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); |
199 |
my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); |
| 195 |
unless ( defined $bib ) { |
200 |
unless ( defined $bib ) { |
| 196 |
print |
201 |
print |
|
Lines 200-206
sub process_bib {
Link Here
|
| 200 |
} |
205 |
} |
| 201 |
|
206 |
|
| 202 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
207 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
| 203 |
my $allowrelink = C4::Context->preference("CatalogModuleRelink") || ''; |
|
|
| 204 |
|
208 |
|
| 205 |
my ( $headings_changed, $results ) = |
209 |
my ( $headings_changed, $results ) = |
| 206 |
LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink ); |
210 |
LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink ); |
| 207 |
- |
|
|