Lines 21-26
package C4::AuthoritiesMarc;
Link Here
|
21 |
use strict; |
21 |
use strict; |
22 |
use warnings; |
22 |
use warnings; |
23 |
use MARC::Field; |
23 |
use MARC::Field; |
|
|
24 |
use List::MoreUtils qw(any); |
24 |
|
25 |
|
25 |
use C4::Context; |
26 |
use C4::Context; |
26 |
use C4::Biblio qw( GetFrameworkCode ModBiblio ); |
27 |
use C4::Biblio qw( GetFrameworkCode ModBiblio ); |
Lines 425-432
sub GuessAuthTypeCode {
Link Here
|
425 |
'280'=>{authtypecode=>'GENRE/FORM'}, |
426 |
'280'=>{authtypecode=>'GENRE/FORM'}, |
426 |
} |
427 |
} |
427 |
}; |
428 |
}; |
428 |
foreach my $field (keys %{$heading_fields->{uc(C4::Context->preference('marcflavour'))} }) { |
429 |
my $marcflavour = uc( C4::Context->preference('marcflavour') ); |
429 |
return $heading_fields->{uc(C4::Context->preference('marcflavour'))}->{$field}->{'authtypecode'} if (defined $record->field($field)); |
430 |
my @authtypecodes = Koha::Authority::Types->search->get_column('authtypecode'); |
|
|
431 |
foreach my $field ( keys %{ $heading_fields->{$marcflavour} } ) { |
432 |
if ( defined $record->field($field) ) { |
433 |
my $authtypecode = $heading_fields->{$marcflavour}->{$field}->{'authtypecode'}; |
434 |
if ( any { $authtypecode eq $_ } @authtypecodes ) { |
435 |
return $authtypecode; |
436 |
} |
437 |
else { |
438 |
warn "Authority type $authtypecode not configured"; |
439 |
return; |
440 |
} |
441 |
} |
430 |
} |
442 |
} |
431 |
return; |
443 |
return; |
432 |
} |
444 |
} |
433 |
- |
|
|