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 } ); |