Bugzilla – Attachment 193326 Details for
Bug 36542
In C4/AddBiblio, plugin hook after_biblio_action is triggered before the record is actually saved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36542: Update unit test
8525a71.patch (text/plain), 2.65 KB, created by
Kyle M Hall (khall)
on 2026-02-17 15:07:52 UTC
(
hide
)
Description:
Bug 36542: Update unit test
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2026-02-17 15:07:52 UTC
Size:
2.65 KB
patch
obsolete
>From 8525a71874c60410de525e30ac2514b25e9319a9 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 17 Feb 2026 09:59:13 -0500 >Subject: [PATCH] Bug 36542: Update unit test > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 4 ++-- > t/lib/plugins/Koha/Plugin/Test.pm | 12 +++++++++++- > 2 files changed, 13 insertions(+), 3 deletions(-) > >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 09f9517741f..d3bfd6041c5 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 >@@ -62,11 +62,11 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { > my $biblio_id; > > warning_like { ( $biblio_id, undef ) = C4::Biblio::AddBiblio( MARC::Record->new(), '' ); } >- qr/after_biblio_action called with action: create, ref: Koha::Biblio/, >+ qr/after_biblio_action called with action: create, ref: Koha::Biblio, biblio found/, > 'AddBiblio calls the hook with action=create'; > > warning_like { C4::Biblio::ModBiblio( MARC::Record->new(), $biblio_id, '' ); } >- qr/after_biblio_action called with action: modify, ref: Koha::Biblio/, >+ qr/after_biblio_action called with action: modify, ref: Koha::Biblio, biblio found/, > 'ModBiblio calls the hook with action=modify'; > > my $item; >diff --git a/t/lib/plugins/Koha/Plugin/Test.pm b/t/lib/plugins/Koha/Plugin/Test.pm >index 4d6bd517f69..0d9ad568c39 100644 >--- a/t/lib/plugins/Koha/Plugin/Test.pm >+++ b/t/lib/plugins/Koha/Plugin/Test.pm >@@ -6,6 +6,8 @@ use Modern::Perl; > use Koha::Exception; > use Koha::Plugins::Tab; > >+use Koha::Biblios; >+ > use MARC::Field; > use Mojo::JSON qw( decode_json ); > >@@ -192,7 +194,15 @@ sub after_biblio_action { > my $biblio_id = $payload->{biblio_id}; > > if ( $action ne 'delete' ) { >- Koha::Exception->throw( "after_biblio_action called with action: $action, ref: " . ref($biblio) ); >+ $biblio = Koha::Biblios->find($biblio_id); >+ if ($biblio) { >+ $biblio_id = $biblio->id; >+ Koha::Exception->throw( >+ "after_biblio_action called with action: $action, ref: " . ref($biblio) . ", biblio found" ); >+ } else { >+ Koha::Exception->throw( >+ "after_biblio_action called with action: $action, ref: " . ref($biblio) . ", biblio not found" ); >+ } > } else { > Koha::Exception->throw("after_biblio_action called with action: $action, id: $biblio_id") if $biblio_id; > } >-- >2.50.1 (Apple Git-155) >
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 36542
:
164589
|
164607
|
184896
|
190939
|
193325
| 193326