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

(-)a/Koha/Account.pm (-2 / +2 lines)
Lines 128-134 sub pay { Link Here
128
128
129
        # Attempt to renew the item associated with this debit if
129
        # Attempt to renew the item associated with this debit if
130
        # appropriate
130
        # appropriate
131
        if ($fine->renewable) {
131
        if ($fine->is_renewable) {
132
            # We're ignoring the definition of $interface above, by all
132
            # We're ignoring the definition of $interface above, by all
133
            # accounts we can't rely on C4::Context::interface, so here
133
            # accounts we can't rely on C4::Context::interface, so here
134
            # we're only using what we've been explicitly passed
134
            # we're only using what we've been explicitly passed
Lines 203-209 sub pay { Link Here
203
        # If we need to make a note of the item associated with this line,
203
        # If we need to make a note of the item associated with this line,
204
        # in order that we can potentially renew it, do so.
204
        # in order that we can potentially renew it, do so.
205
        my $amt = $old_amountoutstanding - $amount_to_pay;
205
        my $amt = $old_amountoutstanding - $amount_to_pay;
206
        if ( $fine->renewable ) {
206
        if ( $fine->is_renewable ) {
207
            my $outcome = $fine->renew_item({ interface => $interface });
207
            my $outcome = $fine->renew_item({ interface => $interface });
208
            push @{$renew_outcomes}, $outcome if $outcome;
208
            push @{$renew_outcomes}, $outcome if $outcome;
209
        }
209
        }
(-)a/Koha/Account/Line.pm (-5 / +5 lines)
Lines 596-602 sub apply { Link Here
596
596
597
            # Attempt to renew the item associated with this debit if
597
            # Attempt to renew the item associated with this debit if
598
            # appropriate
598
            # appropriate
599
            if ( $self->credit_type_code ne 'FORGIVEN' && $debit->renewable ) {
599
            if ( $self->credit_type_code ne 'FORGIVEN' && $debit->is_renewable ) {
600
                $debit->renew_item( { interface => $params->{interface} } );
600
                $debit->renew_item( { interface => $params->{interface} } );
601
            }
601
            }
602
602
Lines 887-899 sub to_api_mapping { Link Here
887
887
888
}
888
}
889
889
890
=head3 renewable
890
=head3 is_renewable
891
891
892
    my $bool = $line->renewable;
892
    my $bool = $line->is_renewable;
893
893
894
=cut
894
=cut
895
895
896
sub renewable {
896
sub is_renewable {
897
    my ($self) = @_;
897
    my ($self) = @_;
898
898
899
    return (
899
    return (
Lines 913-919 sub renewable { Link Here
913
913
914
Conditionally attempt to renew an item and return the outcome. This is
914
Conditionally attempt to renew an item and return the outcome. This is
915
as a consequence of the fine on an item being fully paid off.
915
as a consequence of the fine on an item being fully paid off.
916
Caller must call renewable before.
916
Caller must call is_renewable before.
917
917
918
=cut
918
=cut
919
919
(-)a/t/db_dependent/Koha/Account/Line.t (-5 / +4 lines)
Lines 441-455 subtest 'Renewal related tests' => sub { Link Here
441
        interface         => 'commandline',
441
        interface         => 'commandline',
442
    })->store;
442
    })->store;
443
443
444
    is( $line->renewable, 1, "Item is returned as renewable when it meets the conditions" );
444
    is( $line->is_renewable, 1, "Item is returned as renewable when it meets the conditions" );
445
    $line->amountoutstanding(5);
445
    $line->amountoutstanding(5);
446
    is( $line->renewable, 0, "Item is returned as unrenewable when it has outstanding fine" );
446
    is( $line->is_renewable, 0, "Item is returned as unrenewable when it has outstanding fine" );
447
    $line->amountoutstanding(0);
447
    $line->amountoutstanding(0);
448
    $line->debit_type_code("VOID");
448
    $line->debit_type_code("VOID");
449
    is( $line->renewable, 0, "Item is returned as unrenewable when it has the wrong account type" );
449
    is( $line->is_renewable, 0, "Item is returned as unrenewable when it has the wrong account type" );
450
    $line->debit_type_code("OVERDUE");
450
    $line->debit_type_code("OVERDUE");
451
    $line->status("RETURNED");
451
    $line->status("RETURNED");
452
    is( $line->renewable, 0, "Item is returned as unrenewable when it has the wrong account status" );
452
    is( $line->is_renewable, 0, "Item is returned as unrenewable when it has the wrong account status" );
453
453
454
454
455
    t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 );
455
    t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 );
456
- 

Return to bug 28156