|
Lines 20-25
package C4::AuthoritiesMarc;
Link Here
|
| 20 |
|
20 |
|
| 21 |
use strict; |
21 |
use strict; |
| 22 |
use warnings; |
22 |
use warnings; |
|
|
23 |
use MARC::Field; |
| 24 |
|
| 23 |
use C4::Context; |
25 |
use C4::Context; |
| 24 |
use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio ); |
26 |
use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio ); |
| 25 |
use C4::Search qw( FindDuplicate new_record_from_zebra ); |
27 |
use C4::Search qw( FindDuplicate new_record_from_zebra ); |
|
Lines 625-635
sub AddAuthority {
Link Here
|
| 625 |
} |
627 |
} |
| 626 |
|
628 |
|
| 627 |
# Save record into auth_header, update 001 |
629 |
# Save record into auth_header, update 001 |
|
|
630 |
my $action; |
| 628 |
if (!$authid ) { |
631 |
if (!$authid ) { |
|
|
632 |
$action = 'create'; |
| 629 |
# Save a blank record, get authid |
633 |
# Save a blank record, get authid |
| 630 |
$dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, '' ); |
634 |
$dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, '' ); |
| 631 |
$authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); |
635 |
$authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); |
| 632 |
logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); |
636 |
logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); |
|
|
637 |
} else { |
| 638 |
$action = 'modify'; |
| 633 |
} |
639 |
} |
| 634 |
# Insert/update the recordID in MARC record |
640 |
# Insert/update the recordID in MARC record |
| 635 |
$record->delete_field( $record->field('001') ); |
641 |
$record->delete_field( $record->field('001') ); |
|
Lines 639-644
sub AddAuthority {
Link Here
|
| 639 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); |
645 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); |
| 640 |
$indexer->index_records( $authid, "specialUpdate", "authorityserver", $record ); |
646 |
$indexer->index_records( $authid, "specialUpdate", "authorityserver", $record ); |
| 641 |
|
647 |
|
|
|
648 |
_after_authority_action_hooks({ action => $action, authority_id => $authid }); |
| 642 |
return ( $authid ); |
649 |
return ( $authid ); |
| 643 |
} |
650 |
} |
| 644 |
|
651 |
|
|
Lines 667-672
sub DelAuthority {
Link Here
|
| 667 |
logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); |
674 |
logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); |
| 668 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); |
675 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); |
| 669 |
$indexer->index_records( $authid, "recordDelete", "authorityserver", undef ); |
676 |
$indexer->index_records( $authid, "recordDelete", "authorityserver", undef ); |
|
|
677 |
|
| 678 |
_after_authority_action_hooks({ action => 'delete', authority_id => $authid }); |
| 670 |
} |
679 |
} |
| 671 |
|
680 |
|
| 672 |
=head2 ModAuthority |
681 |
=head2 ModAuthority |
|
Lines 1584-1589
sub compare_fields {
Link Here
|
| 1584 |
} |
1593 |
} |
| 1585 |
|
1594 |
|
| 1586 |
|
1595 |
|
|
|
1596 |
=head2 _after_authority_action_hooks |
| 1597 |
|
| 1598 |
Helper method that takes care of calling all plugin hooks |
| 1599 |
|
| 1600 |
=cut |
| 1601 |
|
| 1602 |
sub _after_authority_action_hooks { |
| 1603 |
my ( $args ) = @_; # hash keys: action, authority_id |
| 1604 |
return Koha::Plugins->call( 'after_authority_action', $args ); |
| 1605 |
} |
| 1606 |
|
| 1587 |
END { } # module clean-up code here (global destructor) |
1607 |
END { } # module clean-up code here (global destructor) |
| 1588 |
|
1608 |
|
| 1589 |
1; |
1609 |
1; |
| 1590 |
- |
|
|