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

(-)a/C4/AuthoritiesMarc.pm (-5 / +25 lines)
Lines 1669-1676 sub merge { Link Here
1669
    my $biblios = Koha::Biblios->search( { biblionumber => { -in => \@biblionumbers } } );
1669
    my $biblios = Koha::Biblios->search( { biblionumber => { -in => \@biblionumbers } } );
1670
1670
1671
    while ( my $biblio = $biblios->next ) {
1671
    while ( my $biblio = $biblios->next ) {
1672
        my $marcrecord = $biblio->metadata->record;
1672
        my $marcrecord        = $biblio->metadata->record;
1673
        my $update     = 0;
1673
        my $update            = 0;
1674
        my $reindex_if_needed = 0;
1674
        foreach my $tagfield (@$tags_using_authtype) {
1675
        foreach my $tagfield (@$tags_using_authtype) {
1675
            my $countfrom = 0;    # used in strict mode to remove duplicates
1676
            my $countfrom = 0;    # used in strict mode to remove duplicates
1676
            foreach my $field ( $marcrecord->field($tagfield) ) {
1677
            foreach my $field ( $marcrecord->field($tagfield) ) {
Lines 1743-1754 sub merge { Link Here
1743
                if ( $tags_new && @$tags_new ) {
1744
                if ( $tags_new && @$tags_new ) {
1744
                    $marcrecord->delete_field($field);
1745
                    $marcrecord->delete_field($field);
1745
                    append_fields_ordered( $marcrecord, $field_to );
1746
                    append_fields_ordered( $marcrecord, $field_to );
1747
                    $update = 1;
1746
                } else {
1748
                } else {
1747
                    $field->replace_with($field_to);
1749
1750
                    # If there was no real change of the linked bibliographic
1751
                    # field, there is also no need to make ModBiblio.
1752
                    # Only a refresh of index could be helpful in case of
1753
                    # a change in the tracing fields
1754
                    if ( $field->as_formatted ne $field_to->as_formatted ) {
1755
                        $field->replace_with($field_to);
1756
                        $update = 1;
1757
                    } else {
1758
                        $reindex_if_needed = 1;
1759
                    }
1748
                }
1760
                }
1749
                $update = 1;
1750
            }
1761
            }
1751
        }
1762
        }
1763
        if (
1764
              !$update
1765
            && $reindex_if_needed
1766
            && (   C4::Context->preference('IncludeSeeFromInSearches')
1767
                || C4::Context->preference('IncludeSeeAlsoFromInSearches') )
1768
            )
1769
        {
1770
            my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
1771
            $indexer->index_records( $biblio->biblionumber, "specialUpdate", "biblioserver" );
1772
        }
1752
        next if !$update;
1773
        next if !$update;
1753
        ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } );
1774
        ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } );
1754
        $counteditedbiblio++;
1775
        $counteditedbiblio++;
1755
- 

Return to bug 34739