Bug 25855: (QA follow-up) Generalize hook and simplify tests
[koha.git] / C4 / Circulation.pm
index efda14c..303dca0 100644 (file)
@@ -3096,17 +3096,20 @@ sub AddRenewal {
             DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
         }
 
-        _post_renewal_actions(
+        _after_circ_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
+                action  => 'renewal',
+                payload => {
+                    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");
 
@@ -4336,23 +4339,23 @@ sub _item_denied_renewal {
     return 0;
 }
 
-=head3 _post_renewal_actions
+=head3 _after_circ_actions
 
-Internal method that calls the post_renewal_action plugin hook on configured
+Internal method that calls the after_circ_action plugin hook on configured
 plugins.
 
 =cut
 
-sub _post_renewal_actions {
+sub _after_circ_actions {
     my ($params) = @_;
 
     my @plugins = Koha::Plugins->new->GetPlugins({
-        method => 'post_renewal_action',
+        method => 'after_circ_action',
     });
 
     foreach my $plugin ( @plugins ) {
         try {
-            $plugin->post_renewal_action( $params );
+            $plugin->after_circ_action( $params );
         }
         catch {
             warn "$_";