Bugzilla – Attachment 126307 Details for
Bug 27173
Add plugin hooks for authority record changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27173: Add plugin hooks for authority record changes
Bug-27173-Add-plugin-hooks-for-authority-record-ch.patch (text/plain), 2.70 KB, created by
Martin Renvoize (ashimema)
on 2021-10-15 07:32:35 UTC
(
hide
)
Description:
Bug 27173: Add plugin hooks for authority record changes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-15 07:32:35 UTC
Size:
2.70 KB
patch
obsolete
>From c5070ea6a45b0d46d399d1317f1cdcce8d11526f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 8 Dec 2020 15:54:00 +0100 >Subject: [PATCH] Bug 27173: Add plugin hooks for authority record changes > >2021-09-28 Updated version > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/AuthoritiesMarc.pm | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 2b31146199..36cbf5c43b 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -20,6 +20,8 @@ package C4::AuthoritiesMarc; > > use strict; > use warnings; >+use MARC::Field; >+ > use C4::Context; > use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio ); > use C4::Search qw( FindDuplicate new_record_from_zebra ); >@@ -625,11 +627,15 @@ sub AddAuthority { > } > > # Save record into auth_header, update 001 >+ my $action; > if (!$authid ) { >+ $action = 'create'; > # Save a blank record, get authid > $dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, '' ); > $authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); > logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); >+ } else { >+ $action = 'modify'; > } > # Insert/update the recordID in MARC record > $record->delete_field( $record->field('001') ); >@@ -639,6 +645,7 @@ sub AddAuthority { > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); > $indexer->index_records( $authid, "specialUpdate", "authorityserver", $record ); > >+ _after_authority_action_hooks({ action => $action, authority_id => $authid }); > return ( $authid ); > } > >@@ -667,6 +674,8 @@ sub DelAuthority { > logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::AUTHORITIES_INDEX }); > $indexer->index_records( $authid, "recordDelete", "authorityserver", undef ); >+ >+ _after_authority_action_hooks({ action => 'delete', authority_id => $authid }); > } > > =head2 ModAuthority >@@ -1584,6 +1593,17 @@ sub compare_fields { > } > > >+=head2 _after_authority_action_hooks >+ >+Helper method that takes care of calling all plugin hooks >+ >+=cut >+ >+sub _after_authority_action_hooks { >+ my ( $args ) = @_; # hash keys: action, authority_id >+ return Koha::Plugins->call( 'after_authority_action', $args ); >+} >+ > END { } # module clean-up code here (global destructor) > > 1; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27173
:
125409
|
125410
|
125411
|
125412
|
125715
|
125716
| 126307 |
126308