Bugzilla – Attachment 106569 Details for
Bug 25855
Add hook to AddRenewal using a new _after_circ_actions method in circulation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25855: Add a post_renewal_action plugin hook
Bug-25855-Add-a-postrenewalaction-plugin-hook.patch (text/plain), 2.73 KB, created by
Martin Renvoize (ashimema)
on 2020-07-06 07:35:24 UTC
(
hide
)
Description:
Bug 25855: Add a post_renewal_action plugin hook
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-06 07:35:24 UTC
Size:
2.73 KB
patch
obsolete
>From 992963dbb174fe701e3e7a82d4280f896bf731c0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 23 Jun 2020 16:23:06 -0300 >Subject: [PATCH] Bug 25855: Add a post_renewal_action plugin hook > >This patch adds a new hook to notify plugins about renewal actions. To >test it: > >1. Apply the unit tests >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t >=> FAIL: The tests expect some warnings to show, and they don't (i.e. > the sample plugin hook is not being called). >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! The hook is being called on renewal! >5. Sign off :-D > >Sponsored-by: ByWater Solutions >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 67a986b417..76d91a5b09 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -62,6 +62,7 @@ use Koha::Checkouts::ReturnClaims; > use Carp; > use List::MoreUtils qw( uniq any ); > use Scalar::Util qw( looks_like_number ); >+use Try::Tiny; > use Date::Calc qw( > Today > Today_and_Now >@@ -3066,6 +3067,20 @@ sub AddRenewal { > DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); > } > >+ _post_renewal_actions( >+ { >+ renewal_library_id => >+ $item_object->renewal_branchcode( { branch => $branch } ), >+ charge => $charge, >+ item_id => $itemnumber, >+ item_type => $itemtype, >+ shelving_location => $item_object->location // q{}, >+ patron_id => $borrowernumber, >+ collection_code => $item_object->ccode // q{}, >+ date_due => $datedue >+ } >+ ) if C4::Context->config("enable_plugins"); >+ > # Add the renewal to stats > UpdateStats( > { >@@ -4212,6 +4227,10 @@ sub GetTopIssues { > return @$rows; > } > >+=head2 Internal methods >+ >+=cut >+ > sub _CalculateAndUpdateFine { > my ($params) = @_; > >@@ -4288,6 +4307,29 @@ sub _item_denied_renewal { > return 0; > } > >+=head3 _post_renewal_actions >+ >+Internal method that calls the post_renewal_action plugin hook on configured >+plugins. >+ >+=cut >+ >+sub _post_renewal_actions { >+ my ($params) = @_; >+ >+ my @plugins = Koha::Plugins->new->GetPlugins({ >+ method => 'post_renewal_action', >+ }); >+ >+ foreach my $plugin ( @plugins ) { >+ try { >+ $plugin->post_renewal_action( $params ); >+ } >+ catch { >+ warn "$_"; >+ }; >+ } >+} > > 1; > >-- >2.20.1
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 25855
:
106215
|
106216
|
106248
|
106249
|
106513
|
106568
| 106569 |
106570
|
107251
|
107257