Bugzilla – Attachment 130623 Details for
Bug 30072
Add more holds hooks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30072: Add missing hold actions plugin hooks
Bug-30072-Add-missing-hold-actions-plugin-hooks.patch (text/plain), 2.85 KB, created by
Kyle M Hall (khall)
on 2022-02-15 15:22:13 UTC
(
hide
)
Description:
Bug 30072: Add missing hold actions plugin hooks
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-02-15 15:22:13 UTC
Size:
2.85 KB
patch
obsolete
>From 0cb2ea10fc6e0b4834224af033e8b940de162dd6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 11 Feb 2022 15:28:31 -0300 >Subject: [PATCH] Bug 30072: Add missing hold actions plugin hooks > >This patch introduces the after_hold_action plugin hook, with 4 >different 'action' parameters: > >- fill >- cancel >- suspend >- resume > >To test: >1. Apply the unit tests >2. Run: > $ kshell > k$ t/db_dependent/Koha/Plugins/Holds_hooks.t -v >=> FAIL: The hooks are not in the code, so the expected output from the >Koha::Plugin::Test plugin is not there, and the tests fail >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Note: I think we could deprecate 'after_hold_create' and migrate it to >the one introduced here, using the 'place' action. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Hold.pm | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index e0fbc7af36..d4fb0e4c52 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -34,6 +34,7 @@ use Koha::Items; > use Koha::Libraries; > use Koha::Old::Holds; > use Koha::Calendar; >+use Koha::Plugins; > > use Koha::Exceptions::Hold; > >@@ -112,6 +113,14 @@ sub suspend_hold { > $self->suspend_until($date); > $self->store(); > >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'suspend', >+ payload => { hold => $self->get_from_storage } >+ } >+ ); >+ > logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self ) > if C4::Context->preference('HoldsLog'); > >@@ -132,6 +141,14 @@ sub resume { > > $self->store(); > >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'resume', >+ payload => { hold => $self->get_from_storage } >+ } >+ ); >+ > logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self ) > if C4::Context->preference('HoldsLog'); > >@@ -553,6 +570,15 @@ sub cancel { > } > > my $old_me = $self->_move_to_old; >+ >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'cancel', >+ payload => { hold => $old_me->get_from_storage } >+ } >+ ); >+ > # anonymize if required > $old_me->anonymize > if $patron->privacy == 2; >@@ -608,6 +634,15 @@ sub fill { > ); > > my $old_me = $self->_move_to_old; >+ >+ Koha::Plugins->call( >+ 'after_hold_action', >+ { >+ action => 'fill', >+ payload => { hold => $old_me->get_from_storage } >+ } >+ ); >+ > # anonymize if required > $old_me->anonymize > if $patron->privacy == 2; >-- >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 30072
:
130517
|
130518
|
130519
|
130522
|
130523
|
130524
|
130621
|
130622
|
130623
|
130624
|
130718
|
130719
|
130720
|
130721
|
130722
|
130723
|
131366
|
134005