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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 292-298 if ($patron) { Link Here
292
    $template->param(
292
    $template->param(
293
        overduecount => $overdues->count,
293
        overduecount => $overdues->count,
294
        issuecount   => $issues->count,
294
        issuecount   => $issues->count,
295
        finetotal    => $balance,
295
        fines        => $balance,
296
    );
296
    );
297
297
298
    if ( $patron and $patron->is_debarred ) {
298
    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 88-93 if ( $op eq 'cud-renew' && $barcode ) { Link Here
88
                        $checkout,
93
                        $checkout,
89
                    );
94
                    );
90
                }
95
                }
96
97
                if ( $balance > $amountlimit ) {
98
                    $error     = "too_much_debt";
99
                    $can_renew = 0;
100
                    if ($override_debt) {
101
                        $can_renew = 1;
102
                        $error     = undef;
103
                    }
104
                }
105
91
                if ($can_renew) {
106
                if ($can_renew) {
92
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
107
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
93
                    my $date_due =
108
                    my $date_due =
Lines 122-127 if ( $op eq 'cud-renew' && $barcode ) { Link Here
122
        error               => $error,
137
        error               => $error,
123
        soonestrenewdate    => $soonest_renew_date,
138
        soonestrenewdate    => $soonest_renew_date,
124
        latestautorenewdate => $latest_auto_renew_date,
139
        latestautorenewdate => $latest_auto_renew_date,
140
        balance => $balance,
125
    );
141
    );
126
}
142
}
127
143
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+1 lines)
Lines 657-662 OPAC: Link Here
657
            - pref: OPACFineNoRenewals
657
            - pref: OPACFineNoRenewals
658
              class: currency
658
              class: currency
659
            - '[% local_currency %] in charges (leave blank to disable).'
659
            - '[% local_currency %] in charges (leave blank to disable).'
660
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
660
        -
661
        -
661
            - pref: OPACFineNoRenewalsIncludeCredits
662
            - pref: OPACFineNoRenewalsIncludeCredits
662
              choices:
663
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 1135-1140 Link Here
1135
1135
1136
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1136
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1137
1137
1138
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1139
        var fines = "[% fines | $Price %]";
1140
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1141
1138
        // On-site checkout
1142
        // On-site checkout
1139
        function toggle_onsite_checkout(){
1143
        function toggle_onsite_checkout(){
1140
            const duedatespec = document.querySelector("#duedatespec");
1144
            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 137-142 Link Here
137
                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> Override limit and renew</button>
138
                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> Override limit and renew</button>
138
                    </form>
139
                    </form>
139
                [% END %]
140
                [% END %]
141
            [% ELSIF error == "too_much_debt" %]
142
143
                <li>The patron has a debt of [% balance | $Price %].</li>
144
                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
145
                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
146
                    <input type="hidden" name="override_debt" value="1" />
147
                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
148
                </form>
140
            [% ELSIF error == "on_reserve" %]
149
            [% ELSIF error == "on_reserve" %]
141
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
150
                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio link = 1 %] ( [% item.barcode | html %] ): This item is on hold for another patron.</p>
142
151
Lines 163-168 Link Here
163
                <p>Item cannot be renewed because it's an onsite checkout</p>
172
                <p>Item cannot be renewed because it's an onsite checkout</p>
164
            [% ELSIF error == 'recalled' %]
173
            [% ELSIF error == 'recalled' %]
165
                <p>This item has been recalled.</p>
174
                <p>This item has been recalled.</p>
175
166
            [% ELSE %]
176
            [% ELSE %]
167
177
168
                [% error | html %]
178
                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 807-812 Link Here
807
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
807
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
808
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
808
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
809
809
810
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
811
        var fines = "[% fines | $Price %]";
812
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
813
810
        function uncheck_sibling(me){
814
        function uncheck_sibling(me){
811
            nodename=me.getAttribute("name");
815
            nodename=me.getAttribute("name");
812
            if (nodename =="barcodes[]"){
816
            if (nodename =="barcodes[]"){
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-1 / +15 lines)
Lines 754-759 if (AlwaysLoadCheckoutsTable) { Link Here
754
$(document).ready(function () {
754
$(document).ready(function () {
755
    var onHoldDueDateSet = false;
755
    var onHoldDueDateSet = false;
756
756
757
    var show_confirm = true;
758
757
    var onHoldChecked = function () {
759
    var onHoldChecked = function () {
758
        var isChecked = false;
760
        var isChecked = false;
759
        $("input[data-on-reserve]").each(function () {
761
        $("input[data-on-reserve]").each(function () {
Lines 943-948 $(document).ready(function () { Link Here
943
    $("#RenewChecked").on("click", function (e) {
945
    $("#RenewChecked").on("click", function (e) {
944
        e.preventDefault();
946
        e.preventDefault();
945
        let refresh_table = true;
947
        let refresh_table = true;
948
949
        if(show_confirm  && parseFloat(fines) > parseFloat(amountlimit) ) {
950
            var result = confirm(MSG_CONFIRM_RENEW);
951
            if(!result){
952
                return false;
953
            }
954
            // Prevent displaying confirm box again
955
            show_confirm  = false;
956
        }
957
946
        function renew(item_id) {
958
        function renew(item_id) {
947
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
959
            var override_limit = $("#override_limit").is(":checked") ? 1 : 0;
948
960
Lines 978-983 $(document).ready(function () { Link Here
978
                params.date_due = dueDate;
990
                params.date_due = dueDate;
979
            }
991
            }
980
992
993
994
            $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
995
981
            const client = APIClient.circulation;
996
            const client = APIClient.circulation;
982
            return client.checkouts.renew(params).then(
997
            return client.checkouts.renew(params).then(
983
                success => {
998
                success => {
984
- 

Return to bug 23415