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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 261-267 if ($patron) { Link Here
261
    $template->param(
261
    $template->param(
262
        overduecount => $overdues->count,
262
        overduecount => $overdues->count,
263
        issuecount   => $issues->count,
263
        issuecount   => $issues->count,
264
        finetotal    => $balance,
264
        fines    => $balance,
265
    );
265
    );
266
266
267
    if ( $patron and $patron->is_debarred ) {
267
    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-56 $barcode = barcodedecode($barcode) if $barcode; Link Here
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');
49
my $hard_due_date  = $cgi->param('hard_due_date');
50
my $hard_due_date  = $cgi->param('hard_due_date');
51
my $override_debt = $cgi->param('override_debt');
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 928-933 Link Here
928
928
929
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
929
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
930
930
931
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
932
        var fines = "[% fines %]";
933
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
934
931
        // On-site checkout
935
        // On-site checkout
932
        function toggle_onsite_checkout(){
936
        function toggle_onsite_checkout(){
933
            if ( $("#onsite_checkout").prop('checked') ) {
937
            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 168-173 Link Here
168
                            [% ELSIF error == 'recalled' %]
169
                            [% ELSIF error == 'recalled' %]
169
                                <p>This item has been recalled.</p>
170
                                <p>This item has been recalled.</p>
170
171
172
                            [% ELSIF error == "too_much_debt" %]
173
174
                                <li>The patron has a debt of [% balance | $Price %].</li>
175
                                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
176
                                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
177
                                    <input type="hidden" name="override_debt" value="1" />
178
                                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
179
                                </form>
171
                            [% ELSE %]
180
                            [% ELSE %]
172
181
173
                                [% error | html %]
182
                                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 727-732 Link Here
727
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
727
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
728
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
728
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
729
729
730
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
731
        var fines = "[% fines %]";
732
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
733
730
        $(document).ready(function() {
734
        $(document).ready(function() {
731
            $("#info_digests").tooltip();
735
            $("#info_digests").tooltip();
732
736
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-2 / +54 lines)
Lines 155-161 $(document).ready(function() { Link Here
155
155
156
            var itemnumber = $(this).val();
156
            var itemnumber = $(this).val();
157
157
158
            $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
158
            var can_renew = true;
159
160
            if( parseFloat(fines) > parseFloat(amountlimit) ) {
161
                var result = confirm(MSG_CONFRIM_RENEW);
162
                if(result){
163
                    can_renew = true;
164
                }else{
165
                    can_renew = false;
166
                }
167
            }
159
168
160
            var params = {
169
            var params = {
161
                itemnumber:      itemnumber,
170
                itemnumber:      itemnumber,
Lines 218-223 $(document).ready(function() { Link Here
218
            dataType: "json",
227
            dataType: "json",
219
            async: false,
228
            async: false,
220
            });
229
            });
230
231
            if(can_renew) {
232
                $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
233
                renew(params);
234
            }
221
        });
235
        });
222
236
223
        // Refocus on barcode field if it exists
237
        // Refocus on barcode field if it exists
Lines 233-238 $(document).ready(function() { Link Here
233
        return false;
247
        return false;
234
    });
248
    });
235
249
250
    function renew(params){
251
        $.post({
252
            url: "/cgi-bin/koha/svc/renew",
253
            data: params,
254
            success: function( data ) {
255
                var id = "#renew_" + data.itemnumber;
256
257
                var content = "";
258
                if ( data.renew_okay ) {
259
                    content = __("Renewed, due:") + " " + data.date_due;
260
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
261
                } else {
262
                    content = __("Renew failed:") + " ";
263
                    if ( data.error == "no_checkout" ) {
264
                        content += __("not checked out");
265
                    } else if ( data.error == "too_many" ) {
266
                        content += __("too many renewals");
267
                    } else if ( data.error == "too_unseen" ) {
268
                        content += __("too many consecutive renewals without being seen by the library");
269
                    } else if ( data.error == "on_reserve" ) {
270
                        content += __("on hold");
271
                    } else if ( data.error == "restriction" ) {
272
                        content += __("Not allowed: patron restricted");
273
                    } else if ( data.error == "overdue" ) {
274
                        content += __("Not allowed: overdue");
275
                    } else if ( data.error ) {
276
                        content += data.error;
277
                    } else {
278
                        content += __("reason unknown");
279
                    }
280
                }
281
282
                $(id).replaceWith( content );
283
        },
284
        dataType: "json",
285
        async: false,
286
        });
287
    }
288
236
    $("#RenewAll").on("click",function(){
289
    $("#RenewAll").on("click",function(){
237
        $("#CheckAllRenewals").click();
290
        $("#CheckAllRenewals").click();
238
        $("#UncheckAllCheckins").click();
291
        $("#UncheckAllCheckins").click();
239
- 

Return to bug 23415