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

(-)a/C4/Circulation.pm (-17 / +7 lines)
Lines 3098-3120 sub AddRenewal { Link Here
3098
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3098
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3099
        }
3099
        }
3100
3100
3101
        _after_circ_actions(
3102
            {
3103
                action  => 'renewal',
3104
                payload => {
3105
                    renewal_library_id =>
3106
                    $item_object->renewal_branchcode( { branch => $branch } ),
3107
                    charge            => $charge,
3108
                    item_id           => $itemnumber,
3109
                    item_type         => $itemtype,
3110
                    shelving_location => $item_object->location // q{},
3111
                    patron_id         => $borrowernumber,
3112
                    collection_code   => $item_object->ccode // q{},
3113
                    date_due          => $datedue
3114
                }
3115
            }
3116
        ) if C4::Context->config("enable_plugins");
3117
3118
        # Add the renewal to stats
3101
        # Add the renewal to stats
3119
        UpdateStats(
3102
        UpdateStats(
3120
            {
3103
            {
Lines 3131-3136 sub AddRenewal { Link Here
3131
3114
3132
        #Log the renewal
3115
        #Log the renewal
3133
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3116
        logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
3117
3118
        _after_circ_actions(
3119
            {
3120
                action => 'renewal',
3121
                issue  => $issue->get_from_storage
3122
            }
3123
        ) if C4::Context->config("enable_plugins");
3134
    });
3124
    });
3135
3125
3136
    return $datedue;
3126
    return $datedue;
(-)a/t/db_dependent/Koha/Plugins/Circulation_hooks.t (-3 / +3 lines)
Lines 42-48 my $builder = t::lib::TestBuilder->new; Link Here
42
42
43
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
43
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
44
44
45
subtest 'post_renewal_action() hook tests' => sub {
45
subtest 'after_circ_action() hook tests' => sub {
46
46
47
    plan tests => 1;
47
    plan tests => 1;
48
48
Lines 72-79 subtest 'post_renewal_action() hook tests' => sub { Link Here
72
    AddIssue( $patron->unblessed, $item->barcode );
72
    AddIssue( $patron->unblessed, $item->barcode );
73
73
74
    warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); }
74
    warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); }
75
            qr/after_circ_action called with action: renewal, ref: DateTime/,
75
            qr/after_circ_action called with action: renewal, ref: Koha::Checkout/,
76
            'AddRenewal calls the post_renewal_action hook';
76
            'AddRenewal calls the after_circ_action hook';
77
77
78
    $schema->storage->txn_rollback;
78
    $schema->storage->txn_rollback;
79
    Koha::Plugins::Methods->delete;
79
    Koha::Plugins::Methods->delete;
(-)a/t/lib/Koha/Plugin/Test.pm (-14 / +4 lines)
Lines 158-176 sub after_item_action { Link Here
158
sub after_circ_action {
158
sub after_circ_action {
159
    my ( $self, $params ) = @_;
159
    my ( $self, $params ) = @_;
160
160
161
    my $action  = $params->{action};
161
    my $action = $params->{action};
162
    my $payload = $params->{payload};
162
    my $issue  = $params->{issue};
163
163
164
    my $renewal_library_id = $payload->{renewal_library_id};
164
    Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($issue));
165
    my $charge             = $payload->{charge};
166
    my $item_id            = $payload->{item_id};
167
    my $item_type          = $payload->{item_type};
168
    my $shelving_location  = $payload->{shelving_location};
169
    my $patron_id          = $payload->{patron_id};
170
    my $collection_code    = $payload->{collection_code};
171
    my $date_due           = $payload->{date_due};
172
173
    Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($date_due));
174
}
165
}
175
166
176
sub api_routes {
167
sub api_routes {
177
- 

Return to bug 25855