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

(-)a/C4/AuthoritiesMarc.pm (-4 / +24 lines)
Lines 1595-1600 sub merge { Link Here
1595
    while ( my $biblio = $biblios->next ) {
1595
    while ( my $biblio = $biblios->next ) {
1596
        my $marcrecord = $biblio->metadata->record;
1596
        my $marcrecord = $biblio->metadata->record;
1597
        my $update = 0;
1597
        my $update = 0;
1598
        my $reindex_if_needed = 0;
1598
        foreach my $tagfield (@$tags_using_authtype) {
1599
        foreach my $tagfield (@$tags_using_authtype) {
1599
            my $countfrom = 0;    # used in strict mode to remove duplicates
1600
            my $countfrom = 0;    # used in strict mode to remove duplicates
1600
            foreach my $field ( $marcrecord->field($tagfield) ) {
1601
            foreach my $field ( $marcrecord->field($tagfield) ) {
Lines 1656-1670 sub merge { Link Here
1656
                $field_to->delete_subfield( code => '9' );
1657
                $field_to->delete_subfield( code => '9' );
1657
                $field_to->add_subfields( 9 => $mergeto );
1658
                $field_to->add_subfields( 9 => $mergeto );
1658
1659
1659
                if ($tags_new && @$tags_new) {
1660
                if ( $tags_new && @$tags_new ) {
1660
                    $marcrecord->delete_field($field);
1661
                    $marcrecord->delete_field($field);
1661
                    append_fields_ordered( $marcrecord, $field_to );
1662
                    append_fields_ordered( $marcrecord, $field_to );
1663
                    $update = 1;
1662
                } else {
1664
                } else {
1663
                    $field->replace_with($field_to);
1665
1666
                    # If there was no real change of the linked bibliographic
1667
                    # field, there is also no need to make ModBiblio.
1668
                    # Only a refresh of index could be helpful in case of
1669
                    # a change in the tracing fields
1670
                    if ( $field->as_formatted ne $field_to->as_formatted ) {
1671
                        $field->replace_with($field_to);
1672
                        $update = 1;
1673
                    } else {
1674
                        $reindex_if_needed = 1;
1675
                    }
1664
                }
1676
                }
1665
                $update = 1;
1666
            }
1677
            }
1667
        }
1678
        }
1679
        if (
1680
              !$update
1681
            && $reindex_if_needed
1682
            && (   C4::Context->preference('IncludeSeeFromInSearches')
1683
                || C4::Context->preference('IncludeSeeAlsoFromInSearches') )
1684
            )
1685
        {
1686
            my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
1687
            $indexer->index_records( $biblio->biblionumber, "specialUpdate", "biblioserver" );
1688
        }
1668
        next if !$update;
1689
        next if !$update;
1669
        ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } );
1690
        ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } );
1670
        $counteditedbiblio++;
1691
        $counteditedbiblio++;
1671
- 

Return to bug 34739