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

(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 306-312 if ($patron) { Link Here
306
    $template->param(
306
    $template->param(
307
        overduecount => $overdues->count,
307
        overduecount => $overdues->count,
308
        issuecount   => $issues->count,
308
        issuecount   => $issues->count,
309
        finetotal    => $balance,
309
        fines    => $balance,
310
    );
310
    );
311
311
312
    if ( $patron and $patron->is_debarred ) {
312
    if ( $patron and $patron->is_debarred ) {
(-)a/circ/renew.pl (-2 / +18 lines)
Lines 28-33 use C4::Koha; Link Here
28
use Koha::DateUtils;
28
use Koha::DateUtils;
29
use Koha::Database;
29
use Koha::Database;
30
use Koha::BiblioFrameworks;
30
use Koha::BiblioFrameworks;
31
use Koha::Patrons;
31
32
32
my $cgi = new CGI;
33
my $cgi = new CGI;
33
34
Lines 48-57 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae Link Here
48
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
49
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
49
my $override_limit = $cgi->param('override_limit');
50
my $override_limit = $cgi->param('override_limit');
50
my $override_holds = $cgi->param('override_holds');
51
my $override_holds = $cgi->param('override_holds');
52
my $override_debt = $cgi->param('override_debt');
51
53
52
my ( $item, $issue, $borrower );
54
my ( $item, $issue, $borrower );
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 ($barcode) {
58
if ($barcode) {
57
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
59
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
Lines 64-70 if ($barcode) { Link Here
64
        if ($issue) {
66
        if ($issue) {
65
67
66
            $borrower = $issue->borrower();
68
            $borrower = $issue->borrower();
67
            
69
            my $patron = Koha::Patrons->find($borrower->borrowernumber);
70
            $balance = $patron->account->balance;
71
            my $amountlimit = C4::Context->preference("noissuescharge");
72
68
            if ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
73
            if ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
69
                my $can_renew;
74
                my $can_renew;
70
                ( $can_renew, $error ) =
75
                ( $can_renew, $error ) =
Lines 93-98 if ($barcode) { Link Here
93
                        $item->itemnumber(),
98
                        $item->itemnumber(),
94
                    );
99
                    );
95
                }
100
                }
101
102
                if ( $balance > $amountlimit ) {
103
                    $error = "too_much_debt";
104
                    $can_renew = 0;
105
                    if($override_debt){
106
                        $can_renew = 1;
107
                        $error = undef;
108
                    }
109
                }
110
96
                if ($can_renew) {
111
                if ($can_renew) {
97
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
112
                    my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
98
                    my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, dt_from_string( scalar $cgi->param('renewonholdduedate')) );
113
                    my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, dt_from_string( scalar $cgi->param('renewonholdduedate')) );
Lines 118-123 if ($barcode) { Link Here
118
        error    => $error,
133
        error    => $error,
119
        soonestrenewdate => $soonest_renew_date,
134
        soonestrenewdate => $soonest_renew_date,
120
        latestautorenewdate => $latest_auto_renew_date,
135
        latestautorenewdate => $latest_auto_renew_date,
136
        balance => $balance,
121
    );
137
    );
122
}
138
}
123
139
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+3 lines)
Lines 1044-1049 Link Here
1044
1044
1045
        [% UNLESS ( patron.borrowernumber ) %][% UNLESS ( borrowers ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
1045
        [% UNLESS ( patron.borrowernumber ) %][% UNLESS ( borrowers ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
1046
1046
1047
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
1048
        var fines = "[% fines %]";
1049
1047
        // On-site checkout
1050
        // On-site checkout
1048
        function toggle_onsite_checkout(){
1051
        function toggle_onsite_checkout(){
1049
            if ( $("#onsite_checkout").prop('checked') ) {
1052
            if ( $("#onsite_checkout").prop('checked') ) {
(-)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
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
8
Lines 135-142 Link Here
135
                                <p>Item is not allowed renewal.</p>
136
                                <p>Item is not allowed renewal.</p>
136
137
137
                            [% ELSIF error == "onsite_checkout" %]
138
                            [% ELSIF error == "onsite_checkout" %]
139
138
                                <p>Item cannot be renewed because it's an onsite checkout</p>
140
                                <p>Item cannot be renewed because it's an onsite checkout</p>
141
                            
142
                            [% ELSIF error == "too_much_debt" %]
139
143
144
                                <li>The patron has a debt of [% balance | $Price %].</li>
145
                                <form method="post" action="/cgi-bin/koha/circ/renew.pl">
146
                                    <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
147
                                    <input type="hidden" name="override_debt" value="1" />
148
                                    <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
149
                                </form>
140
                            [% ELSE %]
150
                            [% ELSE %]
141
151
142
                                [% error | html %]
152
                                [% error | html %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +4 lines)
Lines 870-876 Link Here
870
        var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone.");
870
        var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone.");
871
871
872
        columns_settings_issues_table = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
872
        columns_settings_issues_table = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
873
873
        
874
        var amountlimit = "[% Koha.Preference('noissuescharge') %]";
875
        var fines = "[% fines %]";
876
        
874
        $(document).ready(function() {
877
        $(document).ready(function() {
875
            if ( $('#clubs-tab').length ) {
878
            if ( $('#clubs-tab').length ) {
876
                $('#clubs-tab-link').on('click', function() {
879
                $('#clubs-tab-link').on('click', function() {
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-27 / +38 lines)
Lines 153-186 $(document).ready(function() { Link Here
153
                params.date_due = dueDate
153
                params.date_due = dueDate
154
            }
154
            }
155
155
156
            $.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
156
            if( parseFloat(fines) > parseFloat(amountlimit) ) {
157
                var id = "#renew_" + data.itemnumber;
157
                
158
158
                if(confirm("The patron has a debt of "+ fines +".\n Are you sure you want to renew checkout(s)?")){
159
                var content = "";
159
                    renew(params);
160
                if ( data.renew_okay ) {
161
                    content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
162
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
163
                } else {
164
                    content = CIRCULATION_RENEW_FAILED + " ";
165
                    if ( data.error == "no_checkout" ) {
166
                        content += NOT_CHECKED_OUT;
167
                    } else if ( data.error == "too_many" ) {
168
                        content += TOO_MANY_RENEWALS;
169
                    } else if ( data.error == "on_reserve" ) {
170
                        content += ON_RESERVE;
171
                    } else if ( data.error == "restriction" ) {
172
                        content += NOT_RENEWABLE_RESTRICTION;
173
                    } else if ( data.error == "overdue" ) {
174
                        content += NOT_RENEWABLE_OVERDUE;
175
                    } else if ( data.error ) {
176
                        content += data.error;
177
                    } else {
178
                        content += REASON_UNKNOWN;
179
                    }
180
                }
160
                }
181
161
182
                $(id).replaceWith( content );
162
            } else {
183
            }, "json")
163
                renew(params);
164
            }
184
        });
165
        });
185
166
186
        // Refocus on barcode field if it exists
167
        // Refocus on barcode field if it exists
Lines 192-197 $(document).ready(function() { Link Here
192
        return false;
173
        return false;
193
    });
174
    });
194
175
176
    function renew(params){
177
        $.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
178
            var id = "#renew_" + data.itemnumber;
179
180
            var content = "";
181
            if ( data.renew_okay ) {
182
                content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
183
                $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
184
            } else {
185
                content = CIRCULATION_RENEW_FAILED + " ";
186
                if ( data.error == "no_checkout" ) {
187
                    content += NOT_CHECKED_OUT;
188
                } else if ( data.error == "too_many" ) {
189
                    content += TOO_MANY_RENEWALS;
190
                } else if ( data.error == "on_reserve" ) {
191
                    content += ON_RESERVE;
192
                } else if ( data.error == "restriction" ) {
193
                    content += NOT_RENEWABLE_RESTRICTION;
194
                } else if ( data.error == "overdue" ) {
195
                    content += NOT_RENEWABLE_OVERDUE;
196
                } else if ( data.error ) {
197
                    content += data.error;
198
                } else {
199
                    content += REASON_UNKNOWN;
200
                }
201
            }
202
        
203
            $(id).replaceWith( content );
204
        }, "json")
205
    }
206
195
    $("#RenewAll").on("click",function(){
207
    $("#RenewAll").on("click",function(){
196
        $("#CheckAllRenewals").click();
208
        $("#CheckAllRenewals").click();
197
        $("#UncheckAllCheckins").click();
209
        $("#UncheckAllCheckins").click();
198
- 

Return to bug 23415