Bugzilla – Attachment 142278 Details for
Bug 31894
Extend hold hooks with more actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31894: Extend after_hold_action hook
Bug-31894-Extend-afterholdaction-hook.patch (text/plain), 2.84 KB, created by
David Nind
on 2022-10-20 18:51:56 UTC
(
hide
)
Description:
Bug 31894: Extend after_hold_action hook
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-10-20 18:51:56 UTC
Size:
2.84 KB
patch
obsolete
>From b7550017c7a9416907d9f305e2c83c3298dbd89e Mon Sep 17 00:00:00 2001 >From: Stefan Berndtsson <stefan.berndtsson@gmail.com> >Date: Mon, 17 Oct 2022 16:47:06 +0200 >Subject: [PATCH] Bug 31894: Extend after_hold_action hook > >Hook actions added: >after_hold_action adds new actions transfer, waiting and processing > >How to test: >Run tests in t/db_dependent/Koha/Plugins/Holds_hooks.t > >Sponsored by: Gothenburg University Library > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Hold.pm | 24 +++++++++++++++++++++++ > t/db_dependent/Koha/Plugins/Holds_hooks.t | 20 ++++++++++++++++++- > 2 files changed, 43 insertions(+), 1 deletion(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 378b902638..8379e3f718 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -200,6 +200,14 @@ sub set_transfer { > $self->found('T'); > $self->store(); > >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'transfer', >+ payload => { hold => $self->get_from_storage } >+ } >+ ); >+ > return $self; > } > >@@ -257,6 +265,14 @@ sub set_waiting { > > $self->set($values)->store(); > >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'waiting', >+ payload => { hold => $self->get_from_storage } >+ } >+ ); >+ > return $self; > } > >@@ -345,6 +361,14 @@ sub set_processing { > $self->found('P'); > $self->store(); > >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'processing', >+ payload => { hold => $self->get_from_storage } >+ } >+ ); >+ > return $self; > } > >diff --git a/t/db_dependent/Koha/Plugins/Holds_hooks.t b/t/db_dependent/Koha/Plugins/Holds_hooks.t >index c259aeb1bc..d1a9dba00d 100755 >--- a/t/db_dependent/Koha/Plugins/Holds_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Holds_hooks.t >@@ -130,7 +130,7 @@ subtest 'after_hold_action (placed) hook tests' => sub { > > subtest 'Koha::Hold tests' => sub { > >- plan tests => 4; >+ plan tests => 7; > > $schema->storage->txn_begin; > >@@ -181,6 +181,24 @@ subtest 'Koha::Hold tests' => sub { > qr/after_hold_action called with action: resume, ref: Koha::Hold/, > '->resume calls the after_hold_action hook'; > >+ warning_like { >+ $hold->set_transfer; >+ } >+ qr/after_hold_action called with action: transfer, ref: Koha::Hold/, >+ '->set_transfer calls the after_hold_action hook'; >+ >+ warning_like { >+ $hold->set_processing; >+ } >+ qr/after_hold_action called with action: processing, ref: Koha::Hold/, >+ '->set_processing calls the after_hold_action hook'; >+ >+ warning_like { >+ $hold->set_waiting; >+ } >+ qr/after_hold_action called with action: waiting, ref: Koha::Hold/, >+ '->set_waiting calls the after_hold_action hook'; >+ > warning_like { > $hold->cancel; > } >-- >2.30.2
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 31894
:
142265
| 142278 |
142612
|
142613
|
142747