Lines 96-101
use C4::OAI::Sets;
Link Here
|
96 |
use C4::Debug; |
96 |
use C4::Debug; |
97 |
|
97 |
|
98 |
use Koha::Caches; |
98 |
use Koha::Caches; |
|
|
99 |
use Koha::Authorities; |
99 |
use Koha::Authority::Types; |
100 |
use Koha::Authority::Types; |
100 |
use Koha::Acquisition::Currencies; |
101 |
use Koha::Acquisition::Currencies; |
101 |
use Koha::Biblio::Metadatas; |
102 |
use Koha::Biblio::Metadatas; |
Lines 347-355
sub ModBiblio {
Link Here
|
347 |
|
348 |
|
348 |
# Cleaning up invalid fields must be done early or SetUTF8Flag is liable to |
349 |
# Cleaning up invalid fields must be done early or SetUTF8Flag is liable to |
349 |
# throw an exception which probably won't be handled. |
350 |
# throw an exception which probably won't be handled. |
|
|
351 |
my $authsubfield = Koha::Authorities->authority_linking_subfield; |
350 |
foreach my $field ($record->fields()) { |
352 |
foreach my $field ($record->fields()) { |
351 |
if (! $field->is_control_field()) { |
353 |
if (! $field->is_control_field()) { |
352 |
if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield('9'))) { |
354 |
if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield($authsubfield))) { |
353 |
$record->delete_field($field); |
355 |
$record->delete_field($field); |
354 |
} |
356 |
} |
355 |
} |
357 |
} |
Lines 557-562
sub LinkBibHeadingsToAuthorities {
Link Here
|
557 |
|
559 |
|
558 |
$allowrelink = 1 unless defined $allowrelink; |
560 |
$allowrelink = 1 unless defined $allowrelink; |
559 |
my $num_headings_changed = 0; |
561 |
my $num_headings_changed = 0; |
|
|
562 |
my $authsubfield = Koha::Authorities->authority_linking_subfield; |
560 |
foreach my $field ( $bib->fields() ) { |
563 |
foreach my $field ( $bib->fields() ) { |
561 |
if ( defined $tagtolink ) { |
564 |
if ( defined $tagtolink ) { |
562 |
next unless $field->tag() == $tagtolink ; |
565 |
next unless $field->tag() == $tagtolink ; |
Lines 565-571
sub LinkBibHeadingsToAuthorities {
Link Here
|
565 |
next unless defined $heading; |
568 |
next unless defined $heading; |
566 |
|
569 |
|
567 |
# check existing $9 |
570 |
# check existing $9 |
568 |
my $current_link = $field->subfield('9'); |
571 |
my $current_link = $field->subfield($authsubfield); |
569 |
|
572 |
|
570 |
if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) ) |
573 |
if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) ) |
571 |
{ |
574 |
{ |
Lines 579-586
sub LinkBibHeadingsToAuthorities {
Link Here
|
579 |
->{ $heading->display_form() }++; |
582 |
->{ $heading->display_form() }++; |
580 |
next if defined $current_link and $current_link == $authid; |
583 |
next if defined $current_link and $current_link == $authid; |
581 |
|
584 |
|
582 |
$field->delete_subfield( code => '9' ) if defined $current_link; |
585 |
$field->delete_subfield( code => $authsubfield ) if defined $current_link; |
583 |
$field->add_subfields( '9', $authid ); |
586 |
$field->add_subfields( $authsubfield, $authid ); |
584 |
$num_headings_changed++; |
587 |
$num_headings_changed++; |
585 |
} |
588 |
} |
586 |
else { |
589 |
else { |
Lines 600-606
sub LinkBibHeadingsToAuthorities {
Link Here
|
600 |
$marcrecordauth->leader(' nz a22 o 4500'); |
603 |
$marcrecordauth->leader(' nz a22 o 4500'); |
601 |
SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' ); |
604 |
SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' ); |
602 |
} |
605 |
} |
603 |
$field->delete_subfield( code => '9' ) |
606 |
$field->delete_subfield( code => $authsubfield ) |
604 |
if defined $current_link; |
607 |
if defined $current_link; |
605 |
my @auth_subfields; |
608 |
my @auth_subfields; |
606 |
foreach my $subfield ( $field->subfields() ){ |
609 |
foreach my $subfield ( $field->subfields() ){ |
Lines 659-665
sub LinkBibHeadingsToAuthorities {
Link Here
|
659 |
$authid = |
662 |
$authid = |
660 |
C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '', |
663 |
C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '', |
661 |
$heading->auth_type() ); |
664 |
$heading->auth_type() ); |
662 |
$field->add_subfields( '9', $authid ); |
665 |
$field->add_subfields( $authsubfield, $authid ); |
663 |
$num_headings_changed++; |
666 |
$num_headings_changed++; |
664 |
$linker->update_cache($heading, $authid); |
667 |
$linker->update_cache($heading, $authid); |
665 |
$results{'added'}->{ $heading->display_form() }++; |
668 |
$results{'added'}->{ $heading->display_form() }++; |
Lines 1635-1640
sub GetMarcSubjects {
Link Here
|
1635 |
|
1638 |
|
1636 |
my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su'; |
1639 |
my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su'; |
1637 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1640 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
|
|
1641 |
my $authsubfield = Koha::Authorities->authority_linking_subfield; |
1638 |
|
1642 |
|
1639 |
foreach my $field ( $record->field($fields_filter) ) { |
1643 |
foreach my $field ( $record->field($fields_filter) ) { |
1640 |
next unless ($field->tag() >= $mintag && $field->tag() <= $maxtag); |
1644 |
next unless ($field->tag() >= $mintag && $field->tag() <= $maxtag); |
Lines 1643-1649
sub GetMarcSubjects {
Link Here
|
1643 |
my @link_loop; |
1647 |
my @link_loop; |
1644 |
|
1648 |
|
1645 |
# if there is an authority link, build the links with an= subfield9 |
1649 |
# if there is an authority link, build the links with an= subfield9 |
1646 |
my $subfield9 = $field->subfield('9'); |
1650 |
my $subfield9 = $field->subfield($authsubfield); |
1647 |
my $authoritylink; |
1651 |
my $authoritylink; |
1648 |
if ($subfield9) { |
1652 |
if ($subfield9) { |
1649 |
my $linkvalue = $subfield9; |
1653 |
my $linkvalue = $subfield9; |
Lines 1654-1660
sub GetMarcSubjects {
Link Here
|
1654 |
|
1658 |
|
1655 |
# other subfields |
1659 |
# other subfields |
1656 |
for my $subject_subfield (@subfields) { |
1660 |
for my $subject_subfield (@subfields) { |
1657 |
next if ( $subject_subfield->[0] eq '9' ); |
1661 |
next if ( $subject_subfield->[0] eq $authsubfield ); |
1658 |
|
1662 |
|
1659 |
# don't load unimarc subfields 3,4,5 |
1663 |
# don't load unimarc subfields 3,4,5 |
1660 |
next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) ); |
1664 |
next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) ); |
Lines 1727-1732
sub GetMarcAuthors {
Link Here
|
1727 |
|
1731 |
|
1728 |
my @marcauthors; |
1732 |
my @marcauthors; |
1729 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1733 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
|
|
1734 |
my $authsubfield = Koha::Authorities->authority_linking_subfield; |
1730 |
|
1735 |
|
1731 |
foreach my $field ( $record->field($fields_filter) ) { |
1736 |
foreach my $field ( $record->field($fields_filter) ) { |
1732 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
1737 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
Lines 1736-1742
sub GetMarcAuthors {
Link Here
|
1736 |
my $count_auth = 0; |
1741 |
my $count_auth = 0; |
1737 |
|
1742 |
|
1738 |
# if there is an authority link, build the link with Koha-Auth-Number: subfield9 |
1743 |
# if there is an authority link, build the link with Koha-Auth-Number: subfield9 |
1739 |
my $subfield9 = $field->subfield('9'); |
1744 |
my $subfield9 = $field->subfield($authsubfield); |
1740 |
if ($subfield9) { |
1745 |
if ($subfield9) { |
1741 |
my $linkvalue = $subfield9; |
1746 |
my $linkvalue = $subfield9; |
1742 |
$linkvalue =~ s/(\(|\))//g; |
1747 |
$linkvalue =~ s/(\(|\))//g; |
Lines 1746-1752
sub GetMarcAuthors {
Link Here
|
1746 |
# other subfields |
1751 |
# other subfields |
1747 |
my $unimarc3; |
1752 |
my $unimarc3; |
1748 |
for my $authors_subfield (@subfields) { |
1753 |
for my $authors_subfield (@subfields) { |
1749 |
next if ( $authors_subfield->[0] eq '9' ); |
1754 |
next if ( $authors_subfield->[0] eq $authsubfield ); |
1750 |
|
1755 |
|
1751 |
# unimarc3 contains the $3 of the author for UNIMARC. |
1756 |
# unimarc3 contains the $3 of the author for UNIMARC. |
1752 |
# For french academic libraries, it's the "ppn", and it's required for idref webservice |
1757 |
# For french academic libraries, it's the "ppn", and it's required for idref webservice |
Lines 1882-1887
sub GetMarcSeries {
Link Here
|
1882 |
|
1887 |
|
1883 |
my @marcseries; |
1888 |
my @marcseries; |
1884 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1889 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
|
|
1890 |
my $authsubfield = Koha::Authorities->authority_linking_subfield; |
1885 |
|
1891 |
|
1886 |
foreach my $field ( $record->field($fields_filter) ) { |
1892 |
foreach my $field ( $record->field($fields_filter) ) { |
1887 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
1893 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
Lines 1892-1898
sub GetMarcSeries {
Link Here
|
1892 |
for my $series_subfield (@subfields) { |
1898 |
for my $series_subfield (@subfields) { |
1893 |
|
1899 |
|
1894 |
# ignore $9, used for authority link |
1900 |
# ignore $9, used for authority link |
1895 |
next if ( $series_subfield->[0] eq '9' ); |
1901 |
next if ( $series_subfield->[0] eq $authsubfield ); |
1896 |
|
1902 |
|
1897 |
my $volume_number; |
1903 |
my $volume_number; |
1898 |
my $code = $series_subfield->[0]; |
1904 |
my $code = $series_subfield->[0]; |