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

(-)a/C4/AuthoritiesMarc.pm (-3 / +14 lines)
Lines 19-24 package C4::AuthoritiesMarc; Link Here
19
19
20
use strict;
20
use strict;
21
use warnings;
21
use warnings;
22
use List::MoreUtils qw(any);
22
use C4::Context;
23
use C4::Context;
23
use MARC::Record;
24
use MARC::Record;
24
use C4::Biblio;
25
use C4::Biblio;
Lines 411-418 sub GuessAuthTypeCode { Link Here
411
        '280'=>{authtypecode=>'GENRE/FORM'},
412
        '280'=>{authtypecode=>'GENRE/FORM'},
412
    }
413
    }
413
};
414
};
414
    foreach my $field (keys %{$heading_fields->{uc(C4::Context->preference('marcflavour'))} }) {
415
    my $marcflavour = uc( C4::Context->preference('marcflavour') );
415
       return $heading_fields->{uc(C4::Context->preference('marcflavour'))}->{$field}->{'authtypecode'} if (defined $record->field($field));
416
    my @authtypes   = Koha::Authority::Types->search;
417
    foreach my $field ( keys %{ $heading_fields->{$marcflavour} } ) {
418
        if ( defined $record->field($field) ) {
419
            my $authtypecode = $heading_fields->{$marcflavour}->{$field}->{'authtypecode'};
420
            if ( any { $authtypecode eq $_->authtypecode } @authtypes ) {
421
                return $authtypecode;
422
            }
423
            else {
424
                warn "Authority type $authtypecode not configured";
425
                return;
426
            }
427
        }
416
    }
428
    }
417
    return;
429
    return;
418
}
430
}
419
- 

Return to bug 23380