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

(-)a/Koha/MetadataRecord/Authority.pm (-7 lines)
Lines 93-105 sub get_from_authid { Link Here
93
    return if ($@);
93
    return if ($@);
94
    $record->encoding('UTF-8');
94
    $record->encoding('UTF-8');
95
95
96
    # NOTE: GuessAuthTypeCode has no business in Koha::MetadataRecord::Authority, which is an
97
    #       object-oriented class. Eventually perhaps there will be utility
98
    #       classes in the Koha:: namespace, but there are not at the moment,
99
    #       so this shim seems like the best option all-around.
100
    require C4::AuthoritiesMarc;
101
    $authtypecode ||= C4::AuthoritiesMarc::GuessAuthTypeCode($record);
102
103
    my $self = $class->SUPER::new( { authid => $authid,
96
    my $self = $class->SUPER::new( { authid => $authid,
104
                                     authtypecode => $authtypecode,
97
                                     authtypecode => $authtypecode,
105
                                     schema => $marcflavour,
98
                                     schema => $marcflavour,
(-)a/authorities/merge.pl (-5 / +8 lines)
Lines 27-32 use Koha::MetadataRecord::Authority; Link Here
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Biblio;
28
use C4::Biblio;
29
29
30
use Koha::Exceptions;
31
30
my $input  = new CGI;
32
my $input  = new CGI;
31
my @authid = $input->multi_param('authid');
33
my @authid = $input->multi_param('authid');
32
my $merge  = $input->param('merge');
34
my $merge  = $input->param('merge');
Lines 87-100 else { Link Here
87
        push @errors, { code => "WRONG_COUNT", value => scalar(@authid) };
89
        push @errors, { code => "WRONG_COUNT", value => scalar(@authid) };
88
    }
90
    }
89
    else {
91
    else {
90
        my $recordObj1 = Koha::MetadataRecord::Authority->get_from_authid($authid[0]) || Koha::MetadataRecord::Authority->new();
92
        my $recordObj1 = Koha::MetadataRecord::Authority->get_from_authid($authid[0]);
91
        my $recordObj2;
93
        Koha::Exceptions::ObjectNotFound->throw( "No authority record found for authid $authid[0]\n" ) if !$recordObj1;
92
94
95
        my $recordObj2;
93
        if (defined $mergereference && $mergereference eq 'breeding') {
96
        if (defined $mergereference && $mergereference eq 'breeding') {
94
            $recordObj2 =  Koha::MetadataRecord::Authority->get_from_breeding($authid[1]) || Koha::MetadataRecord::Authority->new();
97
            $recordObj2 =  Koha::MetadataRecord::Authority->get_from_breeding($authid[1]);
95
        } else {
98
        } else {
96
            $recordObj2 =  Koha::MetadataRecord::Authority->get_from_authid($authid[1]) || Koha::MetadataRecord::Authority->new();
99
            $recordObj2 =  Koha::MetadataRecord::Authority->get_from_authid($authid[1]);
97
        }
100
        }
101
        Koha::Exceptions::ObjectNotFound->throw( "No authority record found for authid $authid[1]\n" ) if !$recordObj2;
98
102
99
        if ($mergereference) {
103
        if ($mergereference) {
100
104
101
- 

Return to bug 17380