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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 293-299 if ($patron) { Link Here
293
    $template->param(
293
    $template->param(
294
        overduecount => $overdues->count,
294
        overduecount => $overdues->count,
295
        issuecount   => $issues->count,
295
        issuecount   => $issues->count,
296
        finetotal    => $balance,
296
        fines        => $balance,
297
    );
297
    );
298
298
299
    if ( $patron and $patron->is_debarred ) {
299
    if ( $patron and $patron->is_debarred ) {
(-)a/circ/renew.pl (-1 / +17 lines)
Lines 27-32 use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate Ad Link Here
27
use Koha::DateUtils qw( dt_from_string );
27
use Koha::DateUtils qw( dt_from_string );
28
use Koha::Database;
28
use Koha::Database;
29
use Koha::BiblioFrameworks;
29
use Koha::BiblioFrameworks;
30
use Koha::Patrons;
30
31
31
my $cgi = CGI->new;
32
my $cgi = CGI->new;
32
33
Lines 47-57 my $unseen = $cgi->param('unseen') || 0; Link Here
47
$barcode = barcodedecode($barcode) if $barcode;
48
$barcode = barcodedecode($barcode) if $barcode;
48
my $override_limit = $cgi->param('override_limit');
49
my $override_limit = $cgi->param('override_limit');
49
my $override_holds = $cgi->param('override_holds');
50
my $override_holds = $cgi->param('override_holds');
51
my $override_debt  = $cgi->param('override_debt');
50
my $hard_due_date  = $cgi->param('hard_due_date');
52
my $hard_due_date  = $cgi->param('hard_due_date');
51
53
52
my ( $item, $checkout, $patron );
54
my ( $item, $checkout, $patron );
53
my $error = q{};
55
my $error = q{};
54
my ( $soonest_renew_date, $latest_auto_renew_date );
56
my ( $soonest_renew_date, $latest_auto_renew_date, $balance );
55
57
56
if ( $op eq 'cud-renew' && $barcode ) {
58
if ( $op eq 'cud-renew' && $barcode ) {
57
    $barcode = barcodedecode($barcode) if $barcode;
59
    $barcode = barcodedecode($barcode) if $barcode;
Lines 66-71 if ( $op eq 'cud-renew' && $barcode ) { Link Here
66
            $patron = $checkout->patron;
68
            $patron = $checkout->patron;
67
            my $borrowernumber = $patron->borrowernumber;
69
            my $borrowernumber = $patron->borrowernumber;
68
70
71
            $balance = $patron->account->balance;
72
            my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
73
69
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
74
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
70
                my $confirmations;
75
                my $confirmations;
71
                my $can_renew;
76
                my $can_renew;
Lines 92-97 if ( $op eq 'cud-renew' && $barcode ) { Link Here
92
                        $checkout,
97
                        $checkout,
93
                    );
98
                    );
94
                }
99
                }
100
101
                if ( $balance > $amountlimit ) {
102
                    $error     = "too_much_debt";
103
                    $can_renew = 0;
104
                    if ($override_debt) {
105
                        $can_renew = 1;
106
                        $error     = undef;
107
                    }
108
                }
109
95
                if ($can_renew) {
110
                if ($can_renew) {
96
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
111
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
97
                    my $date_due =
112
                    my $date_due =
Lines 127-132 if ( $op eq 'cud-renew' && $barcode ) { Link Here
127
        error               => $error,
142
        error               => $error,
128
        soonestrenewdate    => $soonest_renew_date,
143
        soonestrenewdate    => $soonest_renew_date,
129
        latestautorenewdate => $latest_auto_renew_date,
144
        latestautorenewdate => $latest_auto_renew_date,
145
        balance => $balance,
130
    );
146
    );
131
}
147
}
132
148
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+1 lines)
Lines 650-655 OPAC: Link Here
650
            - pref: OPACFineNoRenewals
650
            - pref: OPACFineNoRenewals
651
              class: currency
651
              class: currency
652
            - '[% local_currency %] in charges (leave blank to disable).'
652
            - '[% local_currency %] in charges (leave blank to disable).'
653
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
653
        -
654
        -
654
            - pref: OPACFineNoRenewalsIncludeCredits
655
            - pref: OPACFineNoRenewalsIncludeCredits
655
              choices:
656
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 1133-1138 Link Here
1133
1133
1134
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1134
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1135
1135
1136
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1137
        var fines = "[% fines | $Price %]";
1138
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1139
1136
        // On-site checkout
1140
        // On-site checkout
1137
        function toggle_onsite_checkout(){
1141
        function toggle_onsite_checkout(){
1138
            const duedatespec = document.querySelector("#duedatespec");
1142
            const duedatespec = document.querySelector("#duedatespec");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (+10 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE Price %]
5
[% PROCESS 'i18n.inc' %]
6
[% PROCESS 'i18n.inc' %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
Lines 138-143 Link Here
138
                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> Override limit and renew</button>
139
                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> Override limit and renew</button>
139
                    </form>
140
                    </form>
140
                [% END %]
141
                [% END %]
142
            [% ELSIF error == "too_much_debt" %]
143
144
                <li>The patron has a debt of [% balance | $Price %].</li>
145
                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
146
                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
147
                    <input type="hidden" name="override_debt" value="1" />
148
                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
149
                </form>
141
            [% ELSIF error == "on_reserve" %]
150
            [% ELSIF error == "on_reserve" %]
142
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
151
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
143
152
Lines 164-169 Link Here
164
                <p>Item cannot be renewed because it's an onsite checkout</p>
173
                <p>Item cannot be renewed because it's an onsite checkout</p>
165
            [% ELSIF error == 'recalled' %]
174
            [% ELSIF error == 'recalled' %]
166
                <p>This item has been recalled.</p>
175
                <p>This item has been recalled.</p>
176
167
            [% ELSE %]
177
            [% ELSE %]
168
178
169
                [% error | html %]
179
                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 814-819 Link Here
814
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
814
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
815
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
815
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
816
816
817
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
818
        var fines = "[% fines | $Price %]";
819
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
820
817
        function uncheck_sibling(me){
821
        function uncheck_sibling(me){
818
            nodename=me.getAttribute("name");
822
            nodename=me.getAttribute("name");
819
            if (nodename =="barcodes[]"){
823
            if (nodename =="barcodes[]"){
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-1 / +15 lines)
Lines 776-781 if (AlwaysLoadCheckoutsTable) { Link Here
776
$(document).ready(function () {
776
$(document).ready(function () {
777
    var onHoldDueDateSet = false;
777
    var onHoldDueDateSet = false;
778
778
779
    var show_confirm = true;
780
779
    var onHoldChecked = function () {
781
    var onHoldChecked = function () {
780
        var isChecked = false;
782
        var isChecked = false;
781
        $("input[data-on-reserve]").each(function () {
783
        $("input[data-on-reserve]").each(function () {
Lines 965-970 $(document).ready(function () { Link Here
965
    $("#RenewChecked").on("click", function (e) {
967
    $("#RenewChecked").on("click", function (e) {
966
        e.preventDefault();
968
        e.preventDefault();
967
        let refresh_table = true;
969
        let refresh_table = true;
970
971
        if(show_confirm  && parseFloat(fines) > parseFloat(amountlimit) ) {
972
            var result = confirm(MSG_CONFIRM_RENEW);
973
            if(!result){
974
                return false;
975
            }
976
            // Prevent displaying confirm box again
977
            show_confirm  = false;
978
        }
979
968
        function renew(item_id) {
980
        function renew(item_id) {
969
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
981
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
970
982
Lines 1000-1005 $(document).ready(function () { Link Here
1000
                params.date_due = dueDate;
1012
                params.date_due = dueDate;
1001
            }
1013
            }
1002
1014
1015
1016
            $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
1017
1003
            const client = APIClient.circulation;
1018
            const client = APIClient.circulation;
1004
            return client.checkouts.renew(params).then(
1019
            return client.checkouts.renew(params).then(
1005
                success => {
1020
                success => {
1006
- 

Return to bug 23415