Bugzilla – Attachment 107366 Details for
Bug 26063
Use Koha::Plugins->call for other hooks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26063: Use Koha::Plugins->call for circulation hooks
Bug-26063-Use-KohaPlugins-call-for-circulation-hoo.patch (text/plain), 3.37 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-07-24 19:05:28 UTC
(
hide
)
Description:
Bug 26063: Use Koha::Plugins->call for circulation hooks
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-07-24 19:05:28 UTC
Size:
3.37 KB
patch
obsolete
>From 4a3abad6f346fa6f056b4f45a9d169534fbcc416 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 24 Jul 2020 16:00:52 -0300 >Subject: [PATCH] Bug 26063: Use Koha::Plugins->call for circulation hooks > >This patch gets rid of a helper method used for calling the plugin >hooks. > >To test: >1. Run: > $ kshell > k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t >=> SUCCESS: Tests pass! >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests still pass! >4. Sign off :-D > >Sponsored-by: ByWater Solutions > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Circulation.pm | 62 ++++++++++++----------------------------------- > 1 file changed, 16 insertions(+), 46 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f8d9fa010e..8d765f72d1 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1548,15 +1548,13 @@ sub AddIssue { > $item_object->itemnumber, > ) if C4::Context->preference("IssueLog"); > >- _after_circ_actions( >- { >- action => 'checkout', >- payload => { >- type => ( $onsite_checkout ? 'onsite_checkout' : 'issue' ), >- checkout => $issue->get_from_storage >- } >+ Koha::Plugins->call('after_circ_action', { >+ action => 'checkout', >+ payload => { >+ type => ( $onsite_checkout ? 'onsite_checkout' : 'issue' ), >+ checkout => $issue->get_from_storage > } >- ) if C4::Context->config("enable_plugins"); >+ }); > } > } > return $issue; >@@ -2212,14 +2210,12 @@ sub AddReturn { > > my $checkin = Koha::Old::Checkouts->find($issue->id); > >- _after_circ_actions( >- { >- action => 'checkin', >- payload => { >- checkout=> $checkin >- } >+ Koha::Plugins->call('after_circ_action', { >+ action => 'checkin', >+ payload => { >+ checkout=> $checkin > } >- ) if C4::Context->config("enable_plugins"); >+ }); > > return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); > } >@@ -3136,14 +3132,12 @@ sub AddRenewal { > #Log the renewal > logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog"); > >- _after_circ_actions( >- { >- action => 'renewal', >- payload => { >- checkout => $issue->get_from_storage >- } >+ Koha::Plugins->call('after_circ_action', { >+ action => 'renewal', >+ payload => { >+ checkout => $issue->get_from_storage > } >- ) if C4::Context->config("enable_plugins"); >+ }); > }); > > return $datedue; >@@ -4354,30 +4348,6 @@ sub _item_denied_renewal { > return 0; > } > >-=head3 _after_circ_actions >- >-Internal method that calls the after_circ_action plugin hook on configured >-plugins. >- >-=cut >- >-sub _after_circ_actions { >- my ($params) = @_; >- >- my @plugins = Koha::Plugins->new->GetPlugins({ >- method => 'after_circ_action', >- }); >- >- foreach my $plugin ( @plugins ) { >- try { >- $plugin->after_circ_action( $params ); >- } >- catch { >- warn "$_"; >- }; >- } >-} >- > 1; > > __END__ >-- >2.27.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 26063
:
107366
|
107498
|
107561
|
107562
|
107595
|
107596