Bugzilla – Attachment 163327 Details for
Bug 34943
Add a pre-save plugin hook for biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34943: (QA follow-up) Use `before_biblio_action` and an `action` param
Bug-34943-QA-follow-up-Use-beforebiblioaction-and-.patch (text/plain), 2.73 KB, created by
Martin Renvoize (ashimema)
on 2024-03-18 13:26:17 UTC
(
hide
)
Description:
Bug 34943: (QA follow-up) Use `before_biblio_action` and an `action` param
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-03-18 13:26:17 UTC
Size:
2.73 KB
patch
obsolete
>From 5921f8aaa8dabfd733c62c1c634bed0a519f508c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 11 Mar 2024 14:33:25 -0300 >Subject: [PATCH] Bug 34943: (QA follow-up) Use `before_biblio_action` and an > `action` param > >This patch harmonizes the hook name and parameters with the rest of the >codebase. > >To test: >1. Apply this patch >2. Run: > $ ktd --shell > k$ qa >=> SUCCESS: All looks green, and tests still pass (i.e. they were >correctly adjusted to the new schema). >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Biblio.pm | 5 ++++- > .../Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 2 +- > t/lib/plugins/Koha/Plugin/Test.pm | 9 +++++++-- > 3 files changed, 12 insertions(+), 4 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 8bf80643743..51e0b5daa8a 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2889,7 +2889,10 @@ sub ModBiblioMarc { > Koha::Util::MARC::set_marc_field($record, C4::Context->preference('MarcFieldForModifierName'), $borrowername); > } > >- Koha::Plugins->call( 'before_biblio_metadata_store', $record ); >+ Koha::Plugins->call( >+ 'before_biblio_action', >+ { action => 'save', payload => { biblio_id => $biblionumber, record => $record } } >+ ); > > $m_rs->metadata( $record->as_xml_record($encoding) ); > $m_rs->store; >diff --git a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >index cd4d61c530c..8f34ec0bdc3 100755 >--- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >@@ -88,7 +88,7 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { > Koha::Plugins::Methods->delete; > }; > >-subtest 'before_biblio_metadata_store() hooks tests' => sub { >+subtest 'before_biblio_action() hooks tests' => sub { > > plan tests => 5; > >diff --git a/t/lib/plugins/Koha/Plugin/Test.pm b/t/lib/plugins/Koha/Plugin/Test.pm >index cb45dd6e5c5..4154994984d 100644 >--- a/t/lib/plugins/Koha/Plugin/Test.pm >+++ b/t/lib/plugins/Koha/Plugin/Test.pm >@@ -149,8 +149,13 @@ sub after_hold_create { > Koha::Exception->throw("after_hold_create called with parameter " . ref($param) ); > } > >-sub before_biblio_metadata_store { >- my ( $self, $record ) = @_; >+sub before_biblio_action { >+ my ( $self, $params ) = @_; >+ >+ my $action = $params->{action} // ''; >+ my $payload = $params->{payload}; >+ my $bibli_id = $payload->{biblio_id}; >+ my $record = $payload->{record}; > > $record->insert_fields_ordered( > MARC::Field->new( >-- >2.44.0
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 34943
:
159680
|
159681
|
159682
|
159683
|
159684
|
159685
|
159686
|
159687
|
159690
|
159691
|
161695
|
161696
|
163048
|
163325
|
163326
|
163327
|
163711
|
163712
|
163713