View | Details | Raw Unified | Return to bug 26063
Collapse All | Expand All

(-)a/C4/Circulation.pm (-47 / +16 lines)
Lines 1548-1562 sub AddIssue { Link Here
1548
                $item_object->itemnumber,
1548
                $item_object->itemnumber,
1549
            ) if C4::Context->preference("IssueLog");
1549
            ) if C4::Context->preference("IssueLog");
1550
1550
1551
            _after_circ_actions(
1551
            Koha::Plugins->call('after_circ_action', {
1552
                {
1552
                action  => 'checkout',
1553
                    action  => 'checkout',
1553
                payload => {
1554
                    payload => {
1554
                    type     => ( $onsite_checkout ? 'onsite_checkout' : 'issue' ),
1555
                        type     => ( $onsite_checkout ? 'onsite_checkout' : 'issue' ),
1555
                    checkout => $issue->get_from_storage
1556
                        checkout => $issue->get_from_storage
1557
                    }
1558
                }
1556
                }
1559
            ) if C4::Context->config("enable_plugins");
1557
            });
1560
        }
1558
        }
1561
    }
1559
    }
1562
    return $issue;
1560
    return $issue;
Lines 2210-2223 sub AddReturn { Link Here
2210
2208
2211
    my $checkin = Koha::Old::Checkouts->find($issue->id);
2209
    my $checkin = Koha::Old::Checkouts->find($issue->id);
2212
2210
2213
    _after_circ_actions(
2211
    Koha::Plugins->call('after_circ_action', {
2214
        {
2212
        action  => 'checkin',
2215
            action  => 'checkin',
2213
        payload => {
2216
            payload => {
2214
            checkout=> $checkin
2217
                checkout=> $checkin
2218
            }
2219
        }
2215
        }
2220
    ) if C4::Context->config("enable_plugins");
2216
    });
2221
2217
2222
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2218
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2223
}
2219
}
Lines 3134-3147 sub AddRenewal { Link Here
3134
        #Log the renewal
3130
        #Log the renewal
3135
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3131
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3136
3132
3137
        _after_circ_actions(
3133
        Koha::Plugins->call('after_circ_action', {
3138
            {
3134
            action  => 'renewal',
3139
                action  => 'renewal',
3135
            payload => {
3140
                payload => {
3136
                checkout  => $issue->get_from_storage
3141
                    checkout  => $issue->get_from_storage
3142
                }
3143
            }
3137
            }
3144
        ) if C4::Context->config("enable_plugins");
3138
        });
3145
    });
3139
    });
3146
3140
3147
    return $datedue;
3141
    return $datedue;
Lines 4352-4381 sub _item_denied_renewal { Link Here
4352
    return 0;
4346
    return 0;
4353
}
4347
}
4354
4348
4355
=head3 _after_circ_actions
4356
4357
Internal method that calls the after_circ_action plugin hook on configured
4358
plugins.
4359
4360
=cut
4361
4362
sub _after_circ_actions {
4363
    my ($params) = @_;
4364
4365
    my @plugins = Koha::Plugins->new->GetPlugins({
4366
        method => 'after_circ_action',
4367
    });
4368
4369
    foreach my $plugin ( @plugins ) {
4370
        try {
4371
            $plugin->after_circ_action( $params );
4372
        }
4373
        catch {
4374
            warn "$_";
4375
        };
4376
    }
4377
}
4378
4379
1;
4349
1;
4380
4350
4381
__END__
4351
__END__
4382
- 

Return to bug 26063