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

(-)a/C4/AuthoritiesMarc.pm (-2 / +16 lines)
Lines 674-680 sub AddAuthority { Link Here
674
        $action = 'create';
674
        $action = 'create';
675
675
676
        # Save a blank record, get authid
676
        # Save a blank record, get authid
677
        $authority = Koha::Authority->new( { datecreated => \'NOW()', marcxml => '' } )->store();
677
        $authority = Koha::Authority->new(
678
            {
679
                datecreated  => \'NOW()',
680
                marcxml      => '',
681
                authtypecode => $authtypecode
682
            }
683
        )->store();
678
        $authority->discard_changes();
684
        $authority->discard_changes();
679
        $authid = $authority->authid;
685
        $authid = $authority->authid;
680
        logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
686
        logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
Lines 687-695 sub AddAuthority { Link Here
687
    $record->delete_field( $record->field('001') );
693
    $record->delete_field( $record->field('001') );
688
    $record->insert_fields_ordered( MARC::Field->new( '001', $authid ) );
694
    $record->insert_fields_ordered( MARC::Field->new( '001', $authid ) );
689
695
696
    my $heading = $authority->heading_object( { record => $record } );
697
690
    # Update
698
    # Update
691
    $authority->update(
699
    $authority->update(
692
        { authtypecode => $authtypecode, marc => $record->as_usmarc, marcxml => $record->as_xml_record($format) } );
700
        {
701
            authtypecode => $authtypecode,
702
            marc         => $record->as_usmarc,
703
            marcxml      => $record->as_xml_record($format),
704
            heading      => $heading->display_form,
705
        }
706
    );
693
707
694
    unless ($skip_record_index) {
708
    unless ($skip_record_index) {
695
        my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
709
        my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::AUTHORITIES_INDEX } );
(-)a/C4/Heading/MARC21.pm (-2 / +1 lines)
Lines 201-207 my $auth_heading_fields = { Link Here
201
        main_entry => 1
201
        main_entry => 1
202
    },
202
    },
203
    '151' => {
203
    '151' => {
204
        auth_type  => 'GEOG_NAME',
204
        auth_type  => 'GEOGR_NAME',
205
        subfields  => 'avxyz68',
205
        subfields  => 'avxyz68',
206
        main_entry => 1
206
        main_entry => 1
207
    },
207
    },
Lines 344-350 sub parse_heading { Link Here
344
      _get_search_heading( $field, $field_info->{'subfields'} );
344
      _get_search_heading( $field, $field_info->{'subfields'} );
345
    my $display_heading =
345
    my $display_heading =
346
      _get_display_heading( $field, $field_info->{'subfields'} );
346
      _get_display_heading( $field, $field_info->{'subfields'} );
347
348
    return ( $auth_type, $thesaurus, $search_heading, $display_heading,
347
    return ( $auth_type, $thesaurus, $search_heading, $display_heading,
349
        'exact' );
348
        'exact' );
350
}
349
}
(-)a/Koha/Authority.pm (-1 / +28 lines)
Lines 24-29 use base qw(Koha::Object); Link Here
24
use Koha::Authority::ControlledIndicators;
24
use Koha::Authority::ControlledIndicators;
25
use Koha::SearchEngine::Search;
25
use Koha::SearchEngine::Search;
26
26
27
use C4::Heading qw( new_from_field );
28
27
=head1 NAME
29
=head1 NAME
28
30
29
Koha::Authority - Koha Authority Object class
31
Koha::Authority - Koha Authority Object class
Lines 61-66 sub linked_biblionumbers { Link Here
61
    return Koha::Authorities->linked_biblionumbers( $params );
63
    return Koha::Authorities->linked_biblionumbers( $params );
62
}
64
}
63
65
66
=head3 heading_object
67
68
    Routine to return the C4::Heading object for this authority
69
70
=cut
71
72
sub heading_object {
73
74
    my ( $self, $params ) = @_;
75
    my $record = $params->{record};
76
77
    if ( !$self->{_report_tag} ) {
78
        my $authtype = Koha::Authority::Types->find( $self->authtypecode );
79
        return {} if !$authtype;    # very exceptional
80
        $self->{_report_tag} = $authtype->auth_tag_to_report;
81
    }
82
83
    if ( !$record ) {
84
        $record = $self->record;
85
    }
86
    my $field   = $record->field( $self->{_report_tag} );
87
    my $heading = C4::Heading->new_from_field( $field, undef, 1 );    #new auth heading
88
    return $heading;
89
90
}
91
64
=head3 controlled_indicators
92
=head3 controlled_indicators
65
93
66
    Some authority types control the indicators of some corresponding
94
    Some authority types control the indicators of some corresponding
67
- 

Return to bug 30047