View | Details | Raw Unified | Return to bug 26641
Collapse All | Expand All

(-)a/misc/link_bibs_to_authorities.pl (-7 / +9 lines)
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 97-103 sub process_bibs { Link Here
97
    $sth->execute();
100
    $sth->execute();
98
    while ( my ($biblionumber) = $sth->fetchrow_array() ) {
101
    while ( my ($biblionumber) = $sth->fetchrow_array() ) {
99
        $num_bibs_processed++;
102
        $num_bibs_processed++;
100
        process_bib( $linker, $biblionumber, $tagtolink );
103
        process_bib( $linker, $biblionumber, { tagtolink => $tagtolink, allowrelink => $allowrelink } );
101
104
102
        if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) {
105
        if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) {
103
            print_progress_and_commit($num_bibs_processed);
106
            print_progress_and_commit($num_bibs_processed);
Lines 189-196 _FUZZY_HEADER_ Link Here
189
sub process_bib {
192
sub process_bib {
190
    my $linker       = shift;
193
    my $linker       = shift;
191
    my $biblionumber = shift;
194
    my $biblionumber = shift;
192
    my $tagtolink    = shift;
195
    my $args = shift;
193
196
    my $tagtolink    = $args->{tagtolink};
197
    my $allowrelink = $args->{allowrelink};
194
    my $bib = GetMarcBiblio({ biblionumber => $biblionumber });
198
    my $bib = GetMarcBiblio({ biblionumber => $biblionumber });
195
    unless ( defined $bib ) {
199
    unless ( defined $bib ) {
196
        print
200
        print
Lines 200-206 sub process_bib { Link Here
200
    }
204
    }
201
205
202
    my $frameworkcode = GetFrameworkCode($biblionumber);
206
    my $frameworkcode = GetFrameworkCode($biblionumber);
203
    my $allowrelink = C4::Context->preference("CatalogModuleRelink") || '';
204
207
205
    my ( $headings_changed, $results ) =
208
    my ( $headings_changed, $results ) =
206
      LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink );
209
      LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink );
207
- 

Return to bug 26641