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