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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 287-293 if ($patron) { Link Here
287
    $template->param(
287
    $template->param(
288
        overduecount => $overdues->count,
288
        overduecount => $overdues->count,
289
        issuecount   => $issues->count,
289
        issuecount   => $issues->count,
290
        finetotal    => $balance,
290
        fines        => $balance,
291
    );
291
    );
292
292
293
    if ( $patron and $patron->is_debarred ) {
293
    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 65-70 if ($op eq 'cud-renew' && $barcode) { Link Here
65
67
66
            $patron = $checkout->patron;
68
            $patron = $checkout->patron;
67
69
70
            $balance = $patron->account->balance;
71
            my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
72
68
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
73
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
69
                my $can_renew;
74
                my $can_renew;
70
                my $info;
75
                my $info;
Lines 90-95 if ($op eq 'cud-renew' && $barcode) { Link Here
90
                        $checkout,
95
                        $checkout,
91
                    );
96
                    );
92
                }
97
                }
98
99
                if ( $balance > $amountlimit ) {
100
                    $error     = "too_much_debt";
101
                    $can_renew = 0;
102
                    if ($override_debt) {
103
                        $can_renew = 1;
104
                        $error     = undef;
105
                    }
106
                }
107
93
                if ($can_renew) {
108
                if ($can_renew) {
94
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
109
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
95
                    my $date_due =
110
                    my $date_due =
Lines 128-133 if ($op eq 'cud-renew' && $barcode) { Link Here
128
        error    => $error,
143
        error    => $error,
129
        soonestrenewdate => $soonest_renew_date,
144
        soonestrenewdate => $soonest_renew_date,
130
        latestautorenewdate => $latest_auto_renew_date,
145
        latestautorenewdate => $latest_auto_renew_date,
146
        balance => $balance,
131
    );
147
    );
132
}
148
}
133
149
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+1 lines)
Lines 617-622 OPAC: Link Here
617
            - pref: OPACFineNoRenewals
617
            - pref: OPACFineNoRenewals
618
              class: currency
618
              class: currency
619
            - '[% local_currency %] in charges (leave blank to disable).'
619
            - '[% local_currency %] in charges (leave blank to disable).'
620
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
620
        -
621
        -
621
            - pref: OPACFineNoRenewalsIncludeCredits
622
            - pref: OPACFineNoRenewalsIncludeCredits
622
              choices:
623
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 1045-1050 Link Here
1045
1045
1046
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1046
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1047
1047
1048
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1049
        var fines = "[% fines | $Price %]";
1050
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1051
1048
        // On-site checkout
1052
        // On-site checkout
1049
        function toggle_onsite_checkout(){
1053
        function toggle_onsite_checkout(){
1050
            const duedatespec = document.querySelector("#duedatespec");
1054
            const duedatespec = document.querySelector("#duedatespec");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (+9 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 186-191 Link Here
186
                            [% ELSIF error == 'recalled' %]
187
                            [% ELSIF error == 'recalled' %]
187
                                <p>This item has been recalled.</p>
188
                                <p>This item has been recalled.</p>
188
189
190
                            [% ELSIF error == "too_much_debt" %]
191
192
                                <li>The patron has a debt of [% balance | $Price %].</li>
193
                                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
194
                                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
195
                                    <input type="hidden" name="override_debt" value="1" />
196
                                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
197
                                </form>
189
                            [% ELSE %]
198
                            [% ELSE %]
190
199
191
                                [% error | html %]
200
                                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 782-787 Link Here
782
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
782
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
783
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
783
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
784
784
785
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
786
        var fines = "[% fines | $Price %]";
787
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
788
785
        function uncheck_sibling(me){
789
        function uncheck_sibling(me){
786
            nodename=me.getAttribute("name");
790
            nodename=me.getAttribute("name");
787
            if (nodename =="barcodes[]"){
791
            if (nodename =="barcodes[]"){
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-4 / +16 lines)
Lines 482-487 $(document).ready(function() { Link Here
482
482
483
    var onHoldDueDateSet = false;
483
    var onHoldDueDateSet = false;
484
484
485
    var show_confirm = true;
486
485
    var onHoldChecked = function() {
487
    var onHoldChecked = function() {
486
        var isChecked = false;
488
        var isChecked = false;
487
        $('input[data-on-reserve]').each(function() {
489
        $('input[data-on-reserve]').each(function() {
Lines 655-665 $(document).ready(function() { Link Here
655
    $("#RenewChecked").on("click",function(e){
657
    $("#RenewChecked").on("click",function(e){
656
        e.preventDefault();
658
        e.preventDefault();
657
        let refresh_table = true;
659
        let refresh_table = true;
660
661
        if(show_confirm  && parseFloat(fines) > parseFloat(amountlimit) ) {
662
            var result = confirm(MSG_CONFIRM_RENEW);
663
            if(!result){
664
                return false;
665
            }
666
            // Prevent displaying confirm box again
667
            show_confirm  = false;
668
        }
669
658
        function renew(item_id){
670
        function renew(item_id){
659
            var override_limit = $("#override_limit").is(':checked') ? 1 : 0;
671
            var override_limit = $("#override_limit").is(':checked') ? 1 : 0;
660
672
661
            $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
662
663
            var params = {
673
            var params = {
664
                item_id,
674
                item_id,
665
                patron_id:      borrowernumber,
675
                patron_id:      borrowernumber,
Lines 679-684 $(document).ready(function() { Link Here
679
                params.date_due = dueDate
689
                params.date_due = dueDate
680
            }
690
            }
681
691
692
693
            $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
694
682
            const client = APIClient.circulation;
695
            const client = APIClient.circulation;
683
            return client.checkouts.renew(params).then(
696
            return client.checkouts.renew(params).then(
684
                success => {
697
                success => {
Lines 715-721 $(document).ready(function() { Link Here
715
                    $(id).replaceWith( content );
728
                    $(id).replaceWith( content );
716
                },
729
                },
717
                error => {
730
                error => {
718
                     console.warn("Something wrong happened: %s".format(error));
731
                    console.warn("Something wrong happened: %s".format(error));
719
                }
732
                }
720
            );
733
            );
721
        }
734
        }
722
- 

Return to bug 23415