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

(-)a/C4/Circulation.pm (-8 / +7 lines)
Lines 3238-3250 sub CanBookBeRenewed { Link Here
3238
        $final_unseen_renewal = ( C4::Context->preference('UnseenRenewals')
3238
        $final_unseen_renewal = ( C4::Context->preference('UnseenRenewals')
3239
                && $issuing_rule->{unseen_renewals_allowed} == ( $issue->unseen_renewals + 1 ) ) ? 1 : 0;
3239
                && $issuing_rule->{unseen_renewals_allowed} == ( $issue->unseen_renewals + 1 ) ) ? 1 : 0;
3240
3240
3241
        my $overduesblockrenewing     = C4::Context->preference('OverduesBlockRenewing');
3241
        my $overduesblockrenewing    = C4::Context->preference('OverduesBlockRenewing');
3242
        my $finesblockrenewing        = C4::Context->preference("FineNoRenewals");
3242
        my $finesblockrenewing       = C4::Context->preference("FineNoRenewals");
3243
        my $restrictionblockrenewing  = C4::Context->preference('RestrictionBlockRenewing');
3243
        my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
3244
        my $allowfineoverriderenewing = C4::Context->preference("AllowFineOverrideRenewing");
3244
        my $restricted               = $patron->is_debarred;
3245
        my $restricted                = $patron->is_debarred;
3245
        my $hasoverdues              = $patron->has_overdues;
3246
        my $hasoverdues               = $patron->has_overdues;
3246
        my $balance                  = $patron->account->balance;
3247
        my $balance                   = $patron->account->balance;
3248
3247
3249
        if ( $restricted and $restrictionblockrenewing ) {
3248
        if ( $restricted and $restrictionblockrenewing ) {
3250
            return ( 0, 'restriction' );
3249
            return ( 0, 'restriction' );
Lines 3252-3258 sub CanBookBeRenewed { Link Here
3252
            || ( $issue->is_overdue and $overduesblockrenewing eq 'blockitem' ) )
3251
            || ( $issue->is_overdue and $overduesblockrenewing eq 'blockitem' ) )
3253
        {
3252
        {
3254
            return ( 0, 'overdue' );
3253
            return ( 0, 'overdue' );
3255
        } elsif ( $finesblockrenewing && $balance > $finesblockrenewing && !$allowfineoverriderenewing ) {
3254
        } elsif ( $finesblockrenewing && $balance > $finesblockrenewing ) {
3256
            return ( 0, 'too_much_oweing' );
3255
            return ( 0, 'too_much_oweing' );
3257
        }
3256
        }
3258
3257
(-)a/circ/renew.pl (-1 / +1 lines)
Lines 96-102 if ( $op eq 'cud-renew' && $barcode ) { Link Here
96
                }
96
                }
97
97
98
                if ( $error && ( $error eq 'too_much_oweing' or $error eq 'auto_too_much_oweing' ) ) {
98
                if ( $error && ( $error eq 'too_much_oweing' or $error eq 'auto_too_much_oweing' ) ) {
99
                    if ($override_debt) {
99
                    if ( $override_debt && C4::Context->preference("AllowFineOverrideRenewing") ) {
100
                        $can_renew = 1;
100
                        $can_renew = 1;
101
                        $error     = undef;
101
                        $error     = undef;
102
                    } else {
102
                    } else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (-7 / +9 lines)
Lines 141-153 Link Here
141
                [% END %]
141
                [% END %]
142
            [% ELSIF error == "too_much_oweing" %]
142
            [% ELSIF error == "too_much_oweing" %]
143
                <li>The patron has a debt of [% balance | $Price %].</li>
143
                <li>The patron has a debt of [% balance | $Price %].</li>
144
                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
144
                [% IF Koha.Preference('AllowFineOverrideRenewing') %]
145
                    [% INCLUDE 'csrf-token.inc' %]
145
                    <form method="post" action="/cgi-bin/koha/circ/renew.pl">
146
                    <input type="hidden" name="barcode" value="[% item.barcode | html %]" />
146
                        [% INCLUDE 'csrf-token.inc' %]
147
                    <input type="hidden" name="override_debt" value="1" />
147
                        <input type="hidden" name="barcode" value="[% item.barcode | html %]" />
148
                    <input type="hidden" name="op" value="cud-renew" />
148
                        <input type="hidden" name="override_debt" value="1" />
149
                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
149
                        <input type="hidden" name="op" value="cud-renew" />
150
                </form>
150
                        <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
151
                    </form>
152
                [% END %]
151
            [% ELSIF error == "on_reserve" %]
153
            [% ELSIF error == "on_reserve" %]
152
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
154
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
153
155
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-1 / +1 lines)
Lines 476-482 function LoadIssuesTable() { Link Here
476
                            msg +=
476
                            msg +=
477
                                "<span class='renewals-disabled'>" +
477
                                "<span class='renewals-disabled'>" +
478
                                __(
478
                                __(
479
                                    "Cannot renew, he patron has a debt of " +
479
                                    "Cannot renew, the patron has a debt of " +
480
                                        parseFloat(oObj.fine).format_price()
480
                                        parseFloat(oObj.fine).format_price()
481
                                ) +
481
                                ) +
482
                                "</span>";
482
                                "</span>";
(-)a/t/db_dependent/Circulation.t (-3 / +15 lines)
Lines 498-504 subtest "GetIssuingCharges tests" => sub { Link Here
498
498
499
my ( $reused_itemnumber_1, $reused_itemnumber_2 );
499
my ( $reused_itemnumber_1, $reused_itemnumber_2 );
500
subtest "CanBookBeRenewed tests" => sub {
500
subtest "CanBookBeRenewed tests" => sub {
501
    plan tests => 116;
501
    plan tests => 120;
502
502
503
    C4::Context->set_preference( 'ItemsDeniedRenewal', '' );
503
    C4::Context->set_preference( 'ItemsDeniedRenewal', '' );
504
504
Lines 1354-1360 subtest "CanBookBeRenewed tests" => sub { Link Here
1354
        );
1354
        );
1355
        C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
1355
        C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
1356
        C4::Context->set_preference( 'FineNoRenewals',                   '10' );
1356
        C4::Context->set_preference( 'FineNoRenewals',                   '10' );
1357
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredit',  '1' );
1357
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' );
1358
        my $fines_amount = 5;
1358
        my $fines_amount = 5;
1359
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1359
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1360
        $account->add_debit(
1360
        $account->add_debit(
Lines 1905-1910 subtest "CanBookBeRenewed tests" => sub { Link Here
1905
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 );
1905
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 );
1906
    is( $renewokay, 0,                 'Cannot renew, too much debt and FineNoRenewals=1' );
1906
    is( $renewokay, 0,                 'Cannot renew, too much debt and FineNoRenewals=1' );
1907
    is( $error,     'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' );
1907
    is( $error,     'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' );
1908
1909
    # AllowFineOverrideRenewing should not affect CanBookBeRenewed behavior
1910
    # The preference only controls whether staff can override in the UI
1911
    t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 1 );
1912
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 );
1913
    is( $renewokay, 0,                 'Cannot renew, too much debt even with AllowFineOverrideRenewing enabled' );
1914
    is( $error,     'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing enabled' );
1915
1916
    t::lib::Mocks::mock_preference( 'AllowFineOverrideRenewing', 0 );
1917
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 );
1918
    is( $renewokay, 0,                 'Cannot renew, too much debt with AllowFineOverrideRenewing disabled' );
1919
    is( $error,     'too_much_oweing', 'Error code still too_much_oweing with AllowFineOverrideRenewing disabled' );
1920
1908
    C4::Context->dbh->do("DELETE FROM accountlines");
1921
    C4::Context->dbh->do("DELETE FROM accountlines");
1909
};
1922
};
1910
1923
1911
- 

Return to bug 23415