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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 282-288 if ($patron) { Link Here
282
    $template->param(
282
    $template->param(
283
        overduecount => $overdues->count,
283
        overduecount => $overdues->count,
284
        issuecount   => $issues->count,
284
        issuecount   => $issues->count,
285
        finetotal    => $balance,
285
        fines        => $balance,
286
    );
286
    );
287
287
288
    if ( $patron and $patron->is_debarred ) {
288
    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 46-56 my $unseen = $cgi->param('unseen') || 0; Link Here
46
$barcode = barcodedecode($barcode) if $barcode;
47
$barcode = barcodedecode($barcode) if $barcode;
47
my $override_limit = $cgi->param('override_limit');
48
my $override_limit = $cgi->param('override_limit');
48
my $override_holds = $cgi->param('override_holds');
49
my $override_holds = $cgi->param('override_holds');
50
my $override_debt  = $cgi->param('override_debt');
49
my $hard_due_date  = $cgi->param('hard_due_date');
51
my $hard_due_date  = $cgi->param('hard_due_date');
50
52
51
my ( $item, $checkout, $patron );
53
my ( $item, $checkout, $patron );
52
my $error = q{};
54
my $error = q{};
53
my ( $soonest_renew_date, $latest_auto_renew_date );
55
my ( $soonest_renew_date, $latest_auto_renew_date, $balance );
54
56
55
if ($barcode) {
57
if ($barcode) {
56
    $barcode = barcodedecode($barcode) if $barcode;
58
    $barcode = barcodedecode($barcode) if $barcode;
Lines 64-69 if ($barcode) { Link Here
64
66
65
            $patron = $checkout->patron;
67
            $patron = $checkout->patron;
66
68
69
            $balance = $patron->account->balance;
70
            my $amountlimit = C4::Context->preference("noissuescharge");
71
67
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
72
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
68
                my $can_renew;
73
                my $can_renew;
69
                my $info;
74
                my $info;
Lines 89-94 if ($barcode) { Link Here
89
                        $checkout,
94
                        $checkout,
90
                    );
95
                    );
91
                }
96
                }
97
98
                if ( $balance > $amountlimit ) {
99
                    $error = "too_much_debt";
100
                    $can_renew = 0;
101
                    if($override_debt){
102
                        $can_renew = 1;
103
                        $error = undef;
104
                    }
105
                }
106
92
                if ($can_renew) {
107
                if ($can_renew) {
93
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
108
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
94
                    my $date_due =
109
                    my $date_due =
Lines 127-132 if ($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/circ/circulation.tt (+4 lines)
Lines 1006-1011 Link Here
1006
1006
1007
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1007
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1008
1008
1009
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
1010
        var fines = "[% fines %]";
1011
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1012
1009
        // On-site checkout
1013
        // On-site checkout
1010
        function toggle_onsite_checkout(){
1014
        function toggle_onsite_checkout(){
1011
            if ( $("#onsite_checkout").prop('checked') ) {
1015
            if ( $("#onsite_checkout").prop('checked') ) {
(-)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 169-174 Link Here
169
                            [% ELSIF error == 'recalled' %]
170
                            [% ELSIF error == 'recalled' %]
170
                                <p>This item has been recalled.</p>
171
                                <p>This item has been recalled.</p>
171
172
173
                            [% ELSIF error == "too_much_debt" %]
174
175
                                <li>The patron has a debt of [% balance | $Price %].</li>
176
                                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
177
                                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
178
                                    <input type="hidden" name="override_debt" value="1" />
179
                                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
180
                                </form>
172
                            [% ELSE %]
181
                            [% ELSE %]
173
182
174
                                [% error | html %]
183
                                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 730-735 Link Here
730
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
730
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
731
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
731
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
732
732
733
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
734
        var fines = "[% fines %]";
735
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
736
733
        $(document).ready(function() {
737
        $(document).ready(function() {
734
            $("#info_digests").tooltip();
738
            $("#info_digests").tooltip();
735
739
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-2 / +54 lines)
Lines 641-647 $(document).ready(function() { Link Here
641
641
642
            var itemnumber = $(this).val();
642
            var itemnumber = $(this).val();
643
643
644
            $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
644
            var can_renew = true;
645
646
            if( parseFloat(fines) > parseFloat(amountlimit) ) {
647
                var result = confirm(MSG_CONFRIM_RENEW);
648
                if(result){
649
                    can_renew = true;
650
                }else{
651
                    can_renew = false;
652
                }
653
            }
645
654
646
            var params = {
655
            var params = {
647
                itemnumber:      itemnumber,
656
                itemnumber:      itemnumber,
Lines 704-709 $(document).ready(function() { Link Here
704
            dataType: "json",
713
            dataType: "json",
705
            async: false,
714
            async: false,
706
            });
715
            });
716
717
            if(can_renew) {
718
                $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
719
                renew(params);
720
            }
707
        });
721
        });
708
722
709
        // Refocus on barcode field if it exists
723
        // Refocus on barcode field if it exists
Lines 718-723 $(document).ready(function() { Link Here
718
        return false;
732
        return false;
719
    });
733
    });
720
734
735
    function renew(params){
736
        $.post({
737
            url: "/cgi-bin/koha/svc/renew",
738
            data: params,
739
            success: function( data ) {
740
                var id = "#renew_" + data.itemnumber;
741
742
                var content = "";
743
                if ( data.renew_okay ) {
744
                    content = __("Renewed, due:") + " " + data.date_due;
745
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
746
                } else {
747
                    content = __("Renew failed:") + " ";
748
                    if ( data.error == "no_checkout" ) {
749
                        content += __("not checked out");
750
                    } else if ( data.error == "too_many" ) {
751
                        content += __("too many renewals");
752
                    } else if ( data.error == "too_unseen" ) {
753
                        content += __("too many consecutive renewals without being seen by the library");
754
                    } else if ( data.error == "on_reserve" ) {
755
                        content += __("on hold");
756
                    } else if ( data.error == "restriction" ) {
757
                        content += __("Not allowed: patron restricted");
758
                    } else if ( data.error == "overdue" ) {
759
                        content += __("Not allowed: overdue");
760
                    } else if ( data.error ) {
761
                        content += data.error;
762
                    } else {
763
                        content += __("reason unknown");
764
                    }
765
                }
766
767
                $(id).replaceWith( content );
768
        },
769
        dataType: "json",
770
        async: false,
771
        });
772
    }
773
721
    $("#RenewAll").on("click",function(){
774
    $("#RenewAll").on("click",function(){
722
        $("#CheckAllRenewals").click();
775
        $("#CheckAllRenewals").click();
723
        $("#UncheckAllCheckins").click();
776
        $("#UncheckAllCheckins").click();
724
- 

Return to bug 23415