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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 260-266 if ($patron) { Link Here
260
    $template->param(
260
    $template->param(
261
        overduecount => $overdues->count,
261
        overduecount => $overdues->count,
262
        issuecount   => $issues->count,
262
        issuecount   => $issues->count,
263
        finetotal    => $balance,
263
        fines    => $balance,
264
    );
264
    );
265
265
266
    if ( $patron and $patron->is_debarred ) {
266
    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 917-922 Link Here
917
917
918
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
918
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
919
919
920
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
921
        var fines = "[% fines %]";
922
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
923
920
        // On-site checkout
924
        // On-site checkout
921
        function toggle_onsite_checkout(){
925
        function toggle_onsite_checkout(){
922
            if ( $("#onsite_checkout").prop('checked') ) {
926
            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
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
8
Lines 163-168 Link Here
163
                            [% ELSIF error == 'recalled' %]
164
                            [% ELSIF error == 'recalled' %]
164
                                <p>This item has been recalled.</p>
165
                                <p>This item has been recalled.</p>
165
166
167
                            [% ELSIF error == "too_much_debt" %]
168
169
                                <li>The patron has a debt of [% balance | $Price %].</li>
170
                                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
171
                                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
172
                                    <input type="hidden" name="override_debt" value="1" />
173
                                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
174
                                </form>
166
                            [% ELSE %]
175
                            [% ELSE %]
167
176
168
                                [% error | html %]
177
                                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 710-715 Link Here
710
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
710
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
711
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
711
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
712
712
713
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
714
        var fines = "[% fines %]";
715
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
716
713
        $(document).ready(function() {
717
        $(document).ready(function() {
714
            $("#info_digests").tooltip();
718
            $("#info_digests").tooltip();
715
719
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-38 / +53 lines)
Lines 152-158 $(document).ready(function() { Link Here
152
152
153
            var itemnumber = $(this).val();
153
            var itemnumber = $(this).val();
154
154
155
            $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
155
            var can_renew = true;
156
157
            if( parseFloat(fines) > parseFloat(amountlimit) ) {
158
                var result = confirm(MSG_CONFRIM_RENEW);
159
                if(result){
160
                    can_renew = true;
161
                }else{
162
                    can_renew = false;
163
                }
164
            }
156
165
157
            var params = {
166
            var params = {
158
                itemnumber:      itemnumber,
167
                itemnumber:      itemnumber,
Lines 176-217 $(document).ready(function() { Link Here
176
                params.date_due = dueDate
185
                params.date_due = dueDate
177
            }
186
            }
178
187
179
            $.post({
188
            if(can_renew) {
180
                url: "/cgi-bin/koha/svc/renew",
189
                $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
181
                data: params,
190
                renew(params);
182
                success: function( data ) {
191
            }
183
                    var id = "#renew_" + data.itemnumber;
184
185
                    var content = "";
186
                    if ( data.renew_okay ) {
187
                        content = __("Renewed, due:") + " " + data.date_due;
188
                        $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
189
                    } else {
190
                        content = __("Renew failed:") + " ";
191
                        if ( data.error == "no_checkout" ) {
192
                            content += __("not checked out");
193
                        } else if ( data.error == "too_many" ) {
194
                            content += __("too many renewals");
195
                        } else if ( data.error == "too_unseen" ) {
196
                            content += __("too many consecutive renewals without being seen by the library");
197
                        } else if ( data.error == "on_reserve" ) {
198
                            content += __("on hold");
199
                        } else if ( data.error == "restriction" ) {
200
                            content += __("Not allowed: patron restricted");
201
                        } else if ( data.error == "overdue" ) {
202
                            content += __("Not allowed: overdue");
203
                        } else if ( data.error ) {
204
                            content += data.error;
205
                        } else {
206
                            content += __("reason unknown");
207
                        }
208
                    }
209
210
                    $(id).replaceWith( content );
211
            },
212
            dataType: "json",
213
            async: false,
214
            });
215
        });
192
        });
216
193
217
        // Refocus on barcode field if it exists
194
        // Refocus on barcode field if it exists
Lines 223-228 $(document).ready(function() { Link Here
223
        return false;
200
        return false;
224
    });
201
    });
225
202
203
    function renew(params){
204
        $.post({
205
            url: "/cgi-bin/koha/svc/renew",
206
            data: params,
207
            success: function( data ) {
208
                var id = "#renew_" + data.itemnumber;
209
210
                var content = "";
211
                if ( data.renew_okay ) {
212
                    content = __("Renewed, due:") + " " + data.date_due;
213
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
214
                } else {
215
                    content = __("Renew failed:") + " ";
216
                    if ( data.error == "no_checkout" ) {
217
                        content += __("not checked out");
218
                    } else if ( data.error == "too_many" ) {
219
                        content += __("too many renewals");
220
                    } else if ( data.error == "too_unseen" ) {
221
                        content += __("too many consecutive renewals without being seen by the library");
222
                    } else if ( data.error == "on_reserve" ) {
223
                        content += __("on hold");
224
                    } else if ( data.error == "restriction" ) {
225
                        content += __("Not allowed: patron restricted");
226
                    } else if ( data.error == "overdue" ) {
227
                        content += __("Not allowed: overdue");
228
                    } else if ( data.error ) {
229
                        content += data.error;
230
                    } else {
231
                        content += __("reason unknown");
232
                    }
233
                }
234
235
                $(id).replaceWith( content );
236
        },
237
        dataType: "json",
238
        async: false,
239
        });
240
    }
241
226
    $("#RenewAll").on("click",function(){
242
    $("#RenewAll").on("click",function(){
227
        $("#CheckAllRenewals").click();
243
        $("#CheckAllRenewals").click();
228
        $("#UncheckAllCheckins").click();
244
        $("#UncheckAllCheckins").click();
229
- 

Return to bug 23415