DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
}
- _after_circ_actions(
- {
- 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");
-
# Add the renewal to stats
UpdateStats(
{
#Log the renewal
logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
+
+ _after_circ_actions(
+ {
+ action => 'renewal',
+ payload => {
+ checkout => $issue->get_from_storage
+ }
+ }
+ ) if C4::Context->config("enable_plugins");
});
return $datedue;
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
-subtest 'post_renewal_action() hook tests' => sub {
+subtest 'after_circ_action() hook tests' => sub {
plan tests => 1;
AddIssue( $patron->unblessed, $item->barcode );
warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); }
- qr/after_circ_action called with action: renewal, ref: DateTime/,
- 'AddRenewal calls the post_renewal_action hook';
+ qr/after_circ_action called with action: renewal, ref: Koha::Checkout/,
+ 'AddRenewal calls the after_circ_action hook';
$schema->storage->txn_rollback;
Koha::Plugins::Methods->delete;
sub after_circ_action {
my ( $self, $params ) = @_;
- my $action = $params->{action};
- my $payload = $params->{payload};
-
- my $renewal_library_id = $payload->{renewal_library_id};
- my $charge = $payload->{charge};
- my $item_id = $payload->{item_id};
- my $item_type = $payload->{item_type};
- my $shelving_location = $payload->{shelving_location};
- my $patron_id = $payload->{patron_id};
- my $collection_code = $payload->{collection_code};
- my $date_due = $payload->{date_due};
-
- Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($date_due));
+ my $action = $params->{action};
+ my $checkout = $params->{payload}->{checkout};
+
+ Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout));
}
sub api_routes {