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

(-)a/circ/renew.pl (-3 / +1 lines)
Lines 53-59 my $hard_due_date = $cgi->param('hard_due_date'); Link Here
53
53
54
my ( $item, $checkout, $patron );
54
my ( $item, $checkout, $patron );
55
my $error = q{};
55
my $error = q{};
56
my ( $soonest_renew_date, $latest_auto_renew_date, $balance );
56
my ( $soonest_renew_date, $latest_auto_renew_date );
57
57
58
if ( $op eq 'cud-renew' && $barcode ) {
58
if ( $op eq 'cud-renew' && $barcode ) {
59
    $barcode = barcodedecode($barcode) if $barcode;
59
    $barcode = barcodedecode($barcode) if $barcode;
Lines 100-107 if ( $op eq 'cud-renew' && $barcode ) { Link Here
100
                        $can_renew = 1;
100
                        $can_renew = 1;
101
                        $error     = undef;
101
                        $error     = undef;
102
                    } else {
102
                    } else {
103
                        $balance = $patron->account->balance;
104
                        $template->param( balance => $balance );
105
                        $can_renew = 0;
103
                        $can_renew = 0;
106
                    }
104
                    }
107
                }
105
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (+10 lines)
Lines 64-69 Link Here
64
                        <label for="override_limit">Override renewal restrictions:</label>
64
                        <label for="override_limit">Override renewal restrictions:</label>
65
                        <input type="checkbox" name="override_limit" id="override_limit" value="1" />
65
                        <input type="checkbox" name="override_limit" id="override_limit" value="1" />
66
                    [% END %]
66
                    [% END %]
67
                    [% IF Koha.Preference( 'AllowFineOverrideRenewing' ) %]
68
                        <label for="override_debt">Override fine restrictions:</label>
69
                        <input type="checkbox" name="override_debt" id="override_debt" value="1" />
70
                    [% END %]
67
                [% END %]
71
                [% END %]
68
                [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
72
                [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
69
                    [% IF Koha.Preference( 'UnseenRenewals' ) %]
73
                    [% IF Koha.Preference( 'UnseenRenewals' ) %]
Lines 75-80 Link Here
75
                    <button class="btn btn-default" id="RenewAll"><i class="fa fa-book"></i> Renew all</button>
79
                    <button class="btn btn-default" id="RenewAll"><i class="fa fa-book"></i> Renew all</button>
76
                [% END %]
80
                [% END %]
77
            </fieldset>
81
            </fieldset>
82
            [% IF patron.account.non_issues_charges >= Koha.Preference('FineNoRenewals') %]
83
                <p
84
                    ><strong>Note: </strong> Patron has <strong><span id="patron-non-issues-charges">[% patron.account.non_issues_charges | $Price %]</span></strong> of non-issuing charges outstanding, renewals are restricted at
85
                    <strong><span id="fine-no-renewals-limit">[% Koha.Preference('FineNoRenewals') | $Price %]</span></strong></p
86
                >
87
            [% END %]
78
88
79
            [% IF Koha.Preference('ExportCircHistory') %]
89
            [% IF Koha.Preference('ExportCircHistory') %]
80
                <fieldset>
90
                <fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 1096-1101 Link Here
1096
        var exports_enabled = [% Koha.Preference('ExportCircHistory') ? 1 : 0 | html %];
1096
        var exports_enabled = [% Koha.Preference('ExportCircHistory') ? 1 : 0 | html %];
1097
        var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %];
1097
        var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %];
1098
        var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %];
1098
        var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %];
1099
        var AllowFineOverrideRenewing = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowFineOverrideRenewing') )? 1: 0 | html %];
1099
        var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %];
1100
        var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %];
1100
        var script = "circulation";
1101
        var script = "circulation";
1101
        var relatives_borrowernumbers = new Array();
1102
        var relatives_borrowernumbers = new Array();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (-6 / +14 lines)
Lines 129-139 Link Here
129
            [% ELSIF error == "auto_renew" or error == "auto_too_much_owing" %]
129
            [% ELSIF error == "auto_renew" or error == "auto_too_much_owing" %]
130
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ) has been scheduled for automatic renewal. </p>
130
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ) has been scheduled for automatic renewal. </p>
131
                [% IF error == "auto_too_much_owing" %]
131
                [% IF error == "auto_too_much_owing" %]
132
                    [% IF balance %]
132
                    [% SET patron_account = borrower.account %]
133
                        <ul>
133
                    [% SET total_balance = patron_account.balance %]
134
                            <li>The patron has a debt of [% balance | $Price %] and renewals are restricted at [% Koha.Preference('FineNoRenewals') | $Price %].</li>
134
                    [% SET non_issues_charges = patron_account.non_issues_charges %]
135
                        </ul>
135
                    [% SET fine_no_renewals = Koha.Preference('FineNoRenewals') %]
136
                    [% END %]
136
                    <ul>
137
                        <li>The patron has a total debt of [% total_balance | $Price %], of which [% non_issues_charges | $Price %] are non-issuing charges.</li>
138
                        <li>Renewals are blocked when non-issuing charges exceed [% fine_no_renewals | $Price %].</li>
139
                    </ul>
137
                    [% IF Koha.Preference('AllowFineOverrideRenewing') %]
140
                    [% IF Koha.Preference('AllowFineOverrideRenewing') %]
138
                        <form method="post" action="/cgi-bin/koha/circ/renew.pl">
141
                        <form method="post" action="/cgi-bin/koha/circ/renew.pl">
139
                            [% INCLUDE 'csrf-token.inc' %]
142
                            [% INCLUDE 'csrf-token.inc' %]
Lines 156-163 Link Here
156
                    [% END %]
159
                    [% END %]
157
                [% END %]
160
                [% END %]
158
            [% ELSIF error == "too_much_owing" %]
161
            [% ELSIF error == "too_much_owing" %]
162
                [% SET patron_account = borrower.account %]
163
                [% SET total_balance = patron_account.balance %]
164
                [% SET non_issues_charges = patron_account.non_issues_charges %]
165
                [% SET fine_no_renewals = Koha.Preference('FineNoRenewals') %]
159
                <ul>
166
                <ul>
160
                    <li>The patron has a debt of [% balance | $Price %] and renewals are restricted at [% Koha.Preference('FineNoRenewals') | $Price %].</li>
167
                    <li>The patron has a total debt of [% total_balance | $Price %], of which [% non_issues_charges | $Price %] are non-issuing charges.</li>
168
                    <li>Renewals are blocked when non-issuing charges exceed [% fine_no_renewals | $Price %].</li>
161
                </ul>
169
                </ul>
162
                [% IF Koha.Preference('AllowFineOverrideRenewing') %]
170
                [% IF Koha.Preference('AllowFineOverrideRenewing') %]
163
                    <form method="post" action="/cgi-bin/koha/circ/renew.pl">
171
                    <form method="post" action="/cgi-bin/koha/circ/renew.pl">
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-9 / +22 lines)
Lines 393-399 function LoadIssuesTable() { Link Here
393
                                "</span>";
393
                                "</span>";
394
394
395
                            span_style = "display: none";
395
                            span_style = "display: none";
396
                            span_class = "renewals-allowed";
396
                            span_class = "renewals-allowed-too_many";
397
                        } else if (oObj.can_renew_error == "too_unseen") {
397
                        } else if (oObj.can_renew_error == "too_unseen") {
398
                            msg +=
398
                            msg +=
399
                                "<span>" +
399
                                "<span>" +
Lines 447-453 function LoadIssuesTable() { Link Here
447
                                "</span>";
447
                                "</span>";
448
448
449
                            span_style = "display: none";
449
                            span_style = "display: none";
450
                            span_class = "renewals-allowed";
450
                            span_class = "renewals-allowed-auto_too_much_owing";
451
                        } else if (
451
                        } else if (
452
                            oObj.can_renew_error == "auto_account_expired"
452
                            oObj.can_renew_error == "auto_account_expired"
453
                        ) {
453
                        ) {
Lines 476-488 function LoadIssuesTable() { Link Here
476
                            msg +=
476
                            msg +=
477
                                "<span class='renewals-disabled'>" +
477
                                "<span class='renewals-disabled'>" +
478
                                __(
478
                                __(
479
                                    "Cannot renew, the patron has a debt of " +
479
                                    "Cannot renew - patron has debts blocking renewal"
480
                                        parseFloat(oObj.fine).format_price()
481
                                ) +
480
                                ) +
482
                                "</span>";
481
                                "</span>";
483
482
484
                            span_style = "display: none";
483
                            span_style = "display: none";
485
                            span_class = "renewals-allowed";
484
                            span_class = "renewals-allowed-too_much_owing";
486
                        } else {
485
                        } else {
487
                            msg +=
486
                            msg +=
488
                                "<span class='renewals-disabled'>" +
487
                                "<span class='renewals-disabled'>" +
Lines 968-973 $(document).ready(function () { Link Here
968
967
969
        function renew(item_id) {
968
        function renew(item_id) {
970
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
969
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
970
            var override_debt = $("#override_debt").is(":checked") ? 1 : 0;
971
971
972
            $(this)
972
            $(this)
973
                .parent()
973
                .parent()
Lines 987-992 $(document).ready(function () { Link Here
987
                patron_id: borrowernumber,
987
                patron_id: borrowernumber,
988
                library_id: branchcode,
988
                library_id: branchcode,
989
                override_limit: override_limit,
989
                override_limit: override_limit,
990
                override_debt: override_debt,
990
            };
991
            };
991
992
992
            if (UnseenRenewals) {
993
            if (UnseenRenewals) {
Lines 1379-1394 $(document).ready(function () { Link Here
1379
            .click(function () {
1380
            .click(function () {
1380
                if (this.checked) {
1381
                if (this.checked) {
1381
                    if (AllowRenewalLimitOverride) {
1382
                    if (AllowRenewalLimitOverride) {
1382
                        $(".renewals-allowed").show();
1383
                        $(".renewals-allowed-too_many").show();
1383
                        $(".renewals-disabled").hide();
1384
                    }
1384
                    }
1385
                    if (AllowRenewalOnHoldOverride) {
1385
                    if (AllowRenewalOnHoldOverride) {
1386
                        $(".renewals-allowed-on_reserve").show();
1386
                        $(".renewals-allowed-on_reserve").show();
1387
                    }
1387
                    }
1388
                } else {
1388
                } else {
1389
                    $(".renewals-allowed").hide();
1389
                    $(".renewals-allowed-too_many").hide();
1390
                    $(".renewals-allowed-on_reserve").hide();
1390
                    $(".renewals-allowed-on_reserve").hide();
1391
                    $(".renewals-disabled").show();
1391
                }
1392
            })
1393
            .prop("checked", false);
1394
    }
1395
1396
    if (AllowFineOverrideRenewing) {
1397
        $("#override_debt")
1398
            .click(function () {
1399
                if (this.checked) {
1400
                    $(".renewals-allowed-too_much_owing").show();
1401
                    $(".renewals-allowed-auto_too_much_owing").show();
1402
                } else {
1403
                    $(".renewals-allowed-too_much_owing").hide();
1404
                    $(".renewals-allowed-auto_too_much_owing").hide();
1392
                }
1405
                }
1393
            })
1406
            })
1394
            .prop("checked", false);
1407
            .prop("checked", false);
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/circulation-api-client.js (-2 / +3 lines)
Lines 31-41 export class CirculationAPIClient { Link Here
31
                this.httpClient.post({
31
                this.httpClient.post({
32
                    endpoint: "renew",
32
                    endpoint: "renew",
33
                    body:
33
                    body:
34
                        "itemnumber=%s&borrowernumber=%s&branchcode=%s&override_limit=%s".format(
34
                        "itemnumber=%s&borrowernumber=%s&branchcode=%s&override_limit=%s&override_debt=%s".format(
35
                            checkout.item_id,
35
                            checkout.item_id,
36
                            checkout.patron_id,
36
                            checkout.patron_id,
37
                            checkout.library_id,
37
                            checkout.library_id,
38
                            checkout.override_limit
38
                            checkout.override_limit,
39
                            checkout.override_debt || 0
39
                        ) +
40
                        ) +
40
                        (checkout.seen !== undefined
41
                        (checkout.seen !== undefined
41
                            ? "&seen=%s".format(checkout.seen)
42
                            ? "&seen=%s".format(checkout.seen)
(-)a/svc/renew (+9 lines)
Lines 46-55 print $input->header( -type => 'application/json', -charset => 'UTF-8' ); Link Here
46
my $itemnumber     = $input->param('itemnumber');
46
my $itemnumber     = $input->param('itemnumber');
47
my $borrowernumber = $input->param('borrowernumber');
47
my $borrowernumber = $input->param('borrowernumber');
48
my $override_limit = $input->param('override_limit');
48
my $override_limit = $input->param('override_limit');
49
my $override_debt  = $input->param('override_debt');
49
my $branchcode     = $input->param('branchcode')
50
my $branchcode     = $input->param('branchcode')
50
    || C4::Context->userenv->{'branch'};
51
    || C4::Context->userenv->{'branch'};
51
my $seen = $input->param('seen');
52
my $seen = $input->param('seen');
52
my $date_due;
53
my $date_due;
54
53
if ( $input->param('date_due') ) {
55
if ( $input->param('date_due') ) {
54
    $date_due = dt_from_string( scalar $input->param('date_due') );
56
    $date_due = dt_from_string( scalar $input->param('date_due') );
55
}
57
}
Lines 79-84 if ( $data->{error} && $data->{error} eq 'too_many' && C4::Context->preference(' Link Here
79
    push @{$confirmations}, 'RENEWAL_LIMIT' if $override_limit;
81
    push @{$confirmations}, 'RENEWAL_LIMIT' if $override_limit;
80
}
82
}
81
83
84
if ( $data->{error} && ( $data->{error} eq 'too_much_owing' or $data->{error} eq 'auto_too_much_owing' ) ) {
85
    if ( $override_debt && C4::Context->preference('AllowFineOverrideRenewing') ) {
86
        $data->{renew_okay} = 1;
87
        $data->{error}      = undef;
88
    }
89
}
90
82
if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen' ) ) {
91
if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen' ) ) {
83
    try {
92
    try {
84
        $date_due = AddRenewal(
93
        $date_due = AddRenewal(
(-)a/t/cypress/integration/Circulation/FineNoRenewals_spec.ts (-10 / +10 lines)
Lines 59-67 describe("Circulation - FineNoRenewals and AllowFineOverrideRenewing", () => { Link Here
59
59
60
            // Should see error message about patron debt
60
            // Should see error message about patron debt
61
            cy.get(".dialog.alert").should("be.visible");
61
            cy.get(".dialog.alert").should("be.visible");
62
            cy.get(".dialog.alert li").should(
62
            cy.get(".dialog.alert").should("contain", "total debt of");
63
            cy.get(".dialog.alert").should("contain", "non-issuing charges");
64
            cy.get(".dialog.alert").should(
63
                "contain",
65
                "contain",
64
                `The patron has a debt of`
66
                "Renewals are blocked when non-issuing charges exceed"
65
            );
67
            );
66
        });
68
        });
67
69
Lines 80-90 describe("Circulation - FineNoRenewals and AllowFineOverrideRenewing", () => { Link Here
80
82
81
            // Should see error message about patron debt
83
            // Should see error message about patron debt
82
            cy.get(".dialog.alert").should("be.visible");
84
            cy.get(".dialog.alert").should("be.visible");
83
85
            cy.get(".dialog.alert").should("contain", "total debt of");
84
            cy.get(".dialog.alert li").should(
86
            cy.get(".dialog.alert").should("contain", "non-issuing charges");
85
                "contain",
86
                `The patron has a debt of`
87
            );
88
87
89
            // Should see override button
88
            // Should see override button
90
            cy.get('.dialog.alert form button[type="submit"].approve').should(
89
            cy.get('.dialog.alert form button[type="submit"].approve').should(
Lines 111-119 describe("Circulation - FineNoRenewals and AllowFineOverrideRenewing", () => { Link Here
111
110
112
            // Should see error message about patron debt
111
            // Should see error message about patron debt
113
            cy.get(".dialog.alert").should("be.visible");
112
            cy.get(".dialog.alert").should("be.visible");
114
            cy.get(".dialog.alert li").should(
113
            cy.get(".dialog.alert").should("contain", "total debt of");
114
            cy.get(".dialog.alert").should("contain", "non-issuing charges");
115
            cy.get(".dialog.alert").should(
115
                "contain",
116
                "contain",
116
                `The patron has a debt of`
117
                "Renewals are blocked when non-issuing charges exceed"
117
            );
118
            );
118
119
119
            // Should NOT see override button
120
            // Should NOT see override button
120
- 

Return to bug 23415