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 2212-2225 sub AddReturn { Link Here
2212
2210
2213
    my $checkin = Koha::Old::Checkouts->find($issue->id);
2211
    my $checkin = Koha::Old::Checkouts->find($issue->id);
2214
2212
2215
    _after_circ_actions(
2213
    Koha::Plugins->call('after_circ_action', {
2216
        {
2214
        action  => 'checkin',
2217
            action  => 'checkin',
2215
        payload => {
2218
            payload => {
2216
            checkout=> $checkin
2219
                checkout=> $checkin
2220
            }
2221
        }
2217
        }
2222
    ) if C4::Context->config("enable_plugins");
2218
    });
2223
2219
2224
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2220
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2225
}
2221
}
Lines 3136-3149 sub AddRenewal { Link Here
3136
        #Log the renewal
3132
        #Log the renewal
3137
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3133
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3138
3134
3139
        _after_circ_actions(
3135
        Koha::Plugins->call('after_circ_action', {
3140
            {
3136
            action  => 'renewal',
3141
                action  => 'renewal',
3137
            payload => {
3142
                payload => {
3138
                checkout  => $issue->get_from_storage
3143
                    checkout  => $issue->get_from_storage
3144
                }
3145
            }
3139
            }
3146
        ) if C4::Context->config("enable_plugins");
3140
        });
3147
    });
3141
    });
3148
3142
3149
    return $datedue;
3143
    return $datedue;
Lines 4354-4383 sub _item_denied_renewal { Link Here
4354
    return 0;
4348
    return 0;
4355
}
4349
}
4356
4350
4357
=head3 _after_circ_actions
4358
4359
Internal method that calls the after_circ_action plugin hook on configured
4360
plugins.
4361
4362
=cut
4363
4364
sub _after_circ_actions {
4365
    my ($params) = @_;
4366
4367
    my @plugins = Koha::Plugins->new->GetPlugins({
4368
        method => 'after_circ_action',
4369
    });
4370
4371
    foreach my $plugin ( @plugins ) {
4372
        try {
4373
            $plugin->after_circ_action( $params );
4374
        }
4375
        catch {
4376
            warn "$_";
4377
        };
4378
    }
4379
}
4380
4381
1;
4351
1;
4382
4352
4383
__END__
4353
__END__
4384
- 

Return to bug 26063