|
Lines 657-663
sub LinkBibHeadingsToAuthorities {
Link Here
|
| 657 |
if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) ) |
657 |
if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) ) |
| 658 |
{ |
658 |
{ |
| 659 |
$results{'linked'}->{ $heading->display_form() }++; |
659 |
$results{'linked'}->{ $heading->display_form() }++; |
| 660 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED'}) if $verbose; |
660 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED', data => $heading->display_form()}) if $verbose; |
| 661 |
next; |
661 |
next; |
| 662 |
} |
662 |
} |
| 663 |
|
663 |
|
|
Lines 666-679
sub LinkBibHeadingsToAuthorities {
Link Here
|
| 666 |
$results{ $fuzzy ? 'fuzzy' : 'linked' } |
666 |
$results{ $fuzzy ? 'fuzzy' : 'linked' } |
| 667 |
->{ $heading->display_form() }++; |
667 |
->{ $heading->display_form() }++; |
| 668 |
if(defined $current_link and $current_link == $authid) { |
668 |
if(defined $current_link and $current_link == $authid) { |
| 669 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED'}) if $verbose; |
669 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED', data => $heading->display_form()}) if $verbose; |
| 670 |
next; |
670 |
next; |
| 671 |
} |
671 |
} |
| 672 |
|
672 |
|
| 673 |
$field->delete_subfield( code => '9' ) if defined $current_link; |
673 |
$field->delete_subfield( code => '9' ) if defined $current_link; |
| 674 |
$field->add_subfields( '9', $authid ); |
674 |
$field->add_subfields( '9', $authid ); |
| 675 |
$num_headings_changed++; |
675 |
$num_headings_changed++; |
| 676 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'LOCAL_FOUND'}) if $verbose; |
676 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'LOCAL_FOUND', data => $heading->display_form()}) if $verbose; |
| 677 |
} |
677 |
} |
| 678 |
else { |
678 |
else { |
| 679 |
my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); |
679 |
my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); |
|
Lines 681-694
sub LinkBibHeadingsToAuthorities {
Link Here
|
| 681 |
&& (!$allowrelink || C4::Context->preference('LinkerKeepStale')) ) |
681 |
&& (!$allowrelink || C4::Context->preference('LinkerKeepStale')) ) |
| 682 |
{ |
682 |
{ |
| 683 |
$results{'fuzzy'}->{ $heading->display_form() }++; |
683 |
$results{'fuzzy'}->{ $heading->display_form() }++; |
| 684 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED'}) if $verbose; |
684 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $current_link, status => 'UNCHANGED', data => $heading->display_form()}) if $verbose; |
| 685 |
} |
685 |
} |
| 686 |
elsif ( C4::Context->preference('AutoCreateAuthorities') ) { |
686 |
elsif ( C4::Context->preference('AutoCreateAuthorities') ) { |
| 687 |
if ( _check_valid_auth_link( $current_link, $field ) ) { |
687 |
if ( _check_valid_auth_link( $current_link, $field ) ) { |
| 688 |
$results{'linked'}->{ $heading->display_form() }++; |
688 |
$results{'linked'}->{ $heading->display_form() }++; |
| 689 |
} elsif ( $match_count > 1 ) { |
689 |
} elsif ( $match_count > 1 ) { |
| 690 |
$results{'unlinked'}->{ $heading->display_form() }++; |
690 |
$results{'unlinked'}->{ $heading->display_form() }++; |
| 691 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'MULTIPLE_MATCH', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; |
691 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'MULTIPLE_MATCH', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report, data => $heading->display_form() }) if $verbose; |
| 692 |
} elsif ( !$match_count ) { |
692 |
} elsif ( !$match_count ) { |
| 693 |
my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); |
693 |
my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); |
| 694 |
my $marcrecordauth = MARC::Record->new(); |
694 |
my $marcrecordauth = MARC::Record->new(); |
|
Lines 759-786
sub LinkBibHeadingsToAuthorities {
Link Here
|
| 759 |
$num_headings_changed++; |
759 |
$num_headings_changed++; |
| 760 |
$linker->update_cache($heading, $authid); |
760 |
$linker->update_cache($heading, $authid); |
| 761 |
$results{'added'}->{ $heading->display_form() }++; |
761 |
$results{'added'}->{ $heading->display_form() }++; |
| 762 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'CREATED'}) if $verbose; |
762 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'CREATED', data => $heading->display_form()}) if $verbose; |
| 763 |
} |
763 |
} |
| 764 |
} |
764 |
} |
| 765 |
elsif ( defined $current_link ) { |
765 |
elsif ( defined $current_link ) { |
| 766 |
if ( _check_valid_auth_link( $current_link, $field ) ) { |
766 |
if ( _check_valid_auth_link( $current_link, $field ) ) { |
| 767 |
$results{'linked'}->{ $heading->display_form() }++; |
767 |
$results{'linked'}->{ $heading->display_form() }++; |
| 768 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'UNCHANGED'}) if $verbose; |
768 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'UNCHANGED', data => $heading->display_form()}) if $verbose; |
| 769 |
} |
769 |
} |
| 770 |
else { |
770 |
else { |
| 771 |
$field->delete_subfield( code => '9' ); |
771 |
$field->delete_subfield( code => '9' ); |
| 772 |
$num_headings_changed++; |
772 |
$num_headings_changed++; |
| 773 |
$results{'unlinked'}->{ $heading->display_form() }++; |
773 |
$results{'unlinked'}->{ $heading->display_form() }++; |
| 774 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; |
774 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report, data => $heading->display_form()}) if $verbose; |
| 775 |
} |
775 |
} |
| 776 |
} |
776 |
} |
| 777 |
elsif ( $match_count > 1 ) { |
777 |
elsif ( $match_count > 1 ) { |
| 778 |
$results{'unlinked'}->{ $heading->display_form() }++; |
778 |
$results{'unlinked'}->{ $heading->display_form() }++; |
| 779 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'MULTIPLE_MATCH', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; |
779 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'MULTIPLE_MATCH', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report, data => $heading->display_form() }) if $verbose; |
| 780 |
} |
780 |
} |
| 781 |
else { |
781 |
else { |
| 782 |
$results{'unlinked'}->{ $heading->display_form() }++; |
782 |
$results{'unlinked'}->{ $heading->display_form() }++; |
| 783 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; |
783 |
push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report, data => $heading->display_form()}) if $verbose; |
| 784 |
} |
784 |
} |
| 785 |
} |
785 |
} |
| 786 |
|
786 |
|