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

(-)a/circ/circulation.pl (-14 lines)
Lines 262-271 my $patron; Link Here
262
if ($borrowernumber) {
262
if ($borrowernumber) {
263
    $patron = Koha::Patrons->find( $borrowernumber );
263
    $patron = Koha::Patrons->find( $borrowernumber );
264
    $borrower = GetMember( borrowernumber => $borrowernumber );
264
    $borrower = GetMember( borrowernumber => $borrowernumber );
265
    my $overdues = $patron->get_overdues;
266
    my $issues = $patron->checkouts;
267
    my $balance = $patron->account->balance;
268
269
265
270
    # if the expiry date is before today ie they have expired
266
    # if the expiry date is before today ie they have expired
271
    if ( $patron->is_expired ) {
267
    if ( $patron->is_expired ) {
Lines 285-295 if ($borrowernumber) { Link Here
285
            $template->param("returnbeforeexpiry" => 1);
281
            $template->param("returnbeforeexpiry" => 1);
286
        }
282
        }
287
    }
283
    }
288
    $template->param(
289
        overduecount => $overdues->count,
290
        issuecount   => $issues->count,
291
        finetotal    => $balance,
292
    );
293
284
294
    if ( $patron and $patron->is_debarred ) {
285
    if ( $patron and $patron->is_debarred ) {
295
        $template->param(
286
        $template->param(
Lines 416-426 if (@$barcodes) { Link Here
416
        itembiblionumber => $getmessageiteminfo->{'biblionumber'}
407
        itembiblionumber => $getmessageiteminfo->{'biblionumber'}
417
    );
408
    );
418
409
419
420
    # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue
421
    $patron = Koha::Patrons->find( $borrowernumber );
422
    $template_params->{issuecount} = $patron->checkouts->count;
423
424
    if ( $iteminfo ) {
410
    if ( $iteminfo ) {
425
        $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber}));
411
        $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber}));
426
        $template_params->{item} = $iteminfo;
412
        $template_params->{item} = $iteminfo;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc (-8 / +11 lines)
Lines 1-13 Link Here
1
[% USE Price %]
1
<script type="text/javascript">
2
[% SET NoIssuesCharge = Koha.Preference('noissuescharge') %]
2
KOHA.Checkouts.BorrowerNumber = [% borrowernumber %];
3
[% IF fines > 0 %]
3
KOHA.Checkouts.NoIssuesCharge = [% Koha.Preference('noissuescharge') || "null" %];
4
    <li>
4
[% IF Koha.Preference('AllowFineOverride') %] KOHA.Checkouts.AllowFineOverride = true; [% END %]
5
</script>
6
    <li id="outstanding-fees" style="display: none;">
5
        <span class="circ-hlt">Fees &amp; Charges:</span>
7
        <span class="circ-hlt">Fees &amp; Charges:</span>
6
        Patron has outstanding fees &amp; charges of [% fines | $Price %].
8
        Patron has outstanding fees &amp; charges of <span id="outstanding-fees-amount"></span>
7
        [% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge && fines > NoIssuesCharge %]
9
        </a>.
8
           <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
10
11
        [% IF !Koha.Preference('AllowFineOverride') %]
12
            <span class="circ-hlt" id="outstanding-fees-over-limit" style="display: none;">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
9
        [% END %]
13
        [% END %]
10
        <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Make payment</a>
14
        <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Make payment</a>
11
        <a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Pay all fines</a></li>
15
        <a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Pay all fines</a></li>
12
    </li>
16
    </li>
13
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (-4 / +3 lines)
Lines 1-6 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
<div id="checkouts">
2
<div id="checkouts">
3
    [% IF ( issuecount ) %]
3
    <div class="has-checkouts" style="display: none;">
4
        <div id="issues-table-loading-message">
4
        <div id="issues-table-loading-message">
5
            <p>
5
            <p>
6
                <a id="issues-table-load-now-button" href="#" class="btn btn-default"><i class="fa fa-book"></i> Show checkouts</a>
6
                <a id="issues-table-load-now-button" href="#" class="btn btn-default"><i class="fa fa-book"></i> Show checkouts</a>
Lines 77-83 Link Here
77
                [% END %]
77
                [% END %]
78
            </div>
78
            </div>
79
        </form>
79
        </form>
80
    [% ELSE %]
80
    </div>
81
        <p>Patron has nothing checked out.</p>
81
    <p class="no-checkouts" style="display: none;">Patron has nothing checked out.</p>
82
    [% END %]
83
</div>
82
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-46 / +25 lines)
Lines 20-25 Link Here
20
[% INCLUDE 'strings.inc' %]
20
[% INCLUDE 'strings.inc' %]
21
[% INCLUDE 'datatables.inc' %]
21
[% INCLUDE 'datatables.inc' %]
22
[% INCLUDE 'columns_settings.inc' %]
22
[% INCLUDE 'columns_settings.inc' %]
23
<style>
24
.issue-allow, .issue-disallow, #mainform {display: none;}
25
</style>
23
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
26
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
24
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script>
27
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script>
25
[% INCLUDE 'timepicker.inc' %]
28
[% INCLUDE 'timepicker.inc' %]
Lines 84-89 function toggle_onsite_checkout(){ Link Here
84
function Dopop(link) {
87
function Dopop(link) {
85
    var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
88
    var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
86
}
89
}
90
91
[% IF noissues && !forceallow %] KOHA.Checkouts.DisallowIssue = true; [% END %]
92
[% IF Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') %] KOHA.Checkouts.ForceOnSiteCheckouts = true; [% END %]
87
$(document).ready(function() {
93
$(document).ready(function() {
88
    $('#mainform').on('submit',function() {
94
    $('#mainform').on('submit',function() {
89
        if ($("#barcode") && $("#barcode").val()) {
95
        if ($("#barcode") && $("#barcode").val()) {
Lines 405-413 $(document).ready(function() { Link Here
405
</form>
411
</form>
406
412
407
[% IF ( RESERVED || ISSUED_TO_ANOTHER ) && (CAN_user_reserveforothers_place_holds ) %]
413
[% IF ( RESERVED || ISSUED_TO_ANOTHER ) && (CAN_user_reserveforothers_place_holds ) %]
408
    [% UNLESS noissues %]
414
        <button class="issue-allow" type="submit" onclick="window.location.href='/cgi-bin/koha/reserve/request.pl?biblionumber=[% itembiblionumber %]&borrowernumber=[% borrowernumber %]'"><i class="fa fa-sticky-note-o"></i> Cancel checkout and place a hold for [% INCLUDE 'patron-title.inc' %]</button>
409
        <button type="submit" onclick="window.location.href='/cgi-bin/koha/reserve/request.pl?biblionumber=[% itembiblionumber %]&borrowernumber=[% borrowernumber %]'"><i class="fa fa-sticky-note-o"></i> Cancel checkout and place a hold for [% INCLUDE 'patron-title.inc' %]</button>
410
    [% END %]
411
[% END %]
415
[% END %]
412
</div></div>
416
</div></div>
413
[% END %] <!-- NEEDSCONFIRMATION -->
417
[% END %] <!-- NEEDSCONFIRMATION -->
Lines 574-580 No patron matched <span class="ex">[% message | html %]</span> Link Here
574
    <div class="dialog alert"><strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.</div>
578
    <div class="dialog alert"><strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.</div>
575
[% END %]
579
[% END %]
576
580
577
[% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%]
578
<div class="yui-u first">
581
<div class="yui-u first">
579
582
580
<form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
583
<form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
Lines 611-617 No patron matched <span class="ex">[% message | html %]</span> Link Here
611
614
612
    <div class="checkout-settings">
615
    <div class="checkout-settings">
613
616
614
        [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %]
615
            [% IF ( SpecifyDueDate ) %]
617
            [% IF ( SpecifyDueDate ) %]
616
                <div id="specify-due-date" class="checkout-setting">
618
                <div id="specify-due-date" class="checkout-setting">
617
                    <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
619
                    <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
Lines 629-638 No patron matched <span class="ex">[% message | html %]</span> Link Here
629
                    <button class="btn btn-default btn-sm action" id="cleardate" name="cleardate" onclick="this.checked = false; this.form.duedatespec.value = ''; this.form.stickyduedate.checked = false; this.form.barcode.focus(); return false;" >Clear</button>
631
                    <button class="btn btn-default btn-sm action" id="cleardate" name="cleardate" onclick="this.checked = false; this.form.duedatespec.value = ''; this.form.stickyduedate.checked = false; this.form.barcode.focus(); return false;" >Clear</button>
630
                </div>
632
                </div>
631
            [% END %]
633
            [% END %]
632
        [% END %]
633
634
634
        [% UNLESS ( noissues ) %]
635
            <div id="set-automatic-renewal" class="checkout-setting issue-allow">
635
            <div id="set-automatic-renewal" class="checkout-setting">
636
                [% IF NEEDSCONFIRMATION %]
636
                [% IF NEEDSCONFIRMATION %]
637
                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
637
                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
638
                [% ELSE %]
638
                [% ELSE %]
Lines 659-677 No patron matched <span class="ex">[% message | html %]</span> Link Here
659
                    <label for="override_high_holds">Don't decrease checkout length based on holds</label>
659
                    <label for="override_high_holds">Don't decrease checkout length based on holds</label>
660
                </div>
660
                </div>
661
            [% END %]
661
            [% END %]
662
        [% END %]
663
662
664
        [% IF Koha.Preference('OnSiteCheckouts') %]
663
        [% IF Koha.Preference('OnSiteCheckouts') %]
665
            <div id="onsite_checkout-select" class="checkout-setting">
664
            <div id="onsite_checkout-select" class="checkout-setting">
666
                [% IF noissues %]
665
                    <div class="onsite-checkout-only issue-disallow">
667
                    <div class="onsite-checkout-only">
668
                        <input type="checkbox" id="onsite_checkout" name="onsite_checkout_forced" checked="checked" disabled="disabled" /> <label for="onsite_checkout">On-site checkouts only. Automatic due date: </label>
666
                        <input type="checkbox" id="onsite_checkout" name="onsite_checkout_forced" checked="checked" disabled="disabled" /> <label for="onsite_checkout">On-site checkouts only. Automatic due date: </label>
669
                        <input type="text" name="duedatespec" id="duedatespec" />
667
                        <input type="text" name="duedatespec" id="duedatespec" />
670
                        <input type="hidden" name="onsite_checkout" checked="checked" value="1" />
668
                        <input type="hidden" name="onsite_checkout" checked="checked" value="1" />
671
                    </div>
669
                    </div>
672
                [% ELSE %]
670
                    <div class="issue-allow">
673
                    <input type="checkbox" id="onsite_checkout" name="onsite_checkout" /> <label for="onsite_checkout">On-site checkout</label>
671
                    <input type="checkbox" id="onsite_checkout" name="onsite_checkout" /> <label for="onsite_checkout">On-site checkout</label>
674
                [% END %]
672
                    </div>
675
            </div>
673
            </div>
676
        [% END %]
674
        [% END %]
677
675
Lines 693-727 No patron matched <span class="ex">[% message | html %]</span> Link Here
693
[% END %]
691
[% END %]
694
</form></div>
692
</form></div>
695
693
696
[% END %]<!-- /unless noissues -->
697
698
[% IF ( noissues ) %]
699
    [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
700
        <div class="yui-u">
701
    [% ELSE %]
702
        <div>
703
    [% END %]
704
[% ELSE %]
705
    <div class="yui-u">
694
    <div class="yui-u">
706
[% END %]
695
        <div id="circmessages" class="circmessage attention">
707
696
            <h3>Attention:</h3>
708
        [% IF ( noissues ) %]
697
            <div class="issue-disallow">
709
            [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
698
            [% IF !( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
710
                <div id="circmessages" class="circmessage attention">
711
            [% ELSE %]
712
                <h4>Checking out to [% INCLUDE 'patron-title.inc' %]</h4>
699
                <h4>Checking out to [% INCLUDE 'patron-title.inc' %]</h4>
713
                <div id="circmessages" class="circmessage warning">
714
            [% END %]
700
            [% END %]
715
            <h3>
701
                <h3>
716
                Cannot check out!
702
                    Cannot check out!
717
                [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
703
                    [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
718
                    <span class="circ-hlt">Only on-site checkouts are allowed</span>
704
                        <span class="circ-hlt">Only on-site checkouts are allowed</span>
719
                [% END %]
705
                    [% END %]
720
            </h3>
706
                </h3>
721
        [% ELSE %]
707
            </div>
722
            <div id="circmessages" class="circmessage attention">
723
                <h3>Attention:</h3>
724
        [% END %]
725
708
726
		<ul>
709
		<ul>
727
710
Lines 780-787 No patron matched <span class="ex">[% message | html %]</span> Link Here
780
                   [% END %]
763
                   [% END %]
781
                   <br/>
764
                   <br/>
782
                   <a class="btn btn-default btn-sm" href="#reldebarments" onclick="$('#debarments-tab-link').click()"><i class="fa fa-ban"></i> View restrictions</a>
765
                   <a class="btn btn-default btn-sm" href="#reldebarments" onclick="$('#debarments-tab-link').click()"><i class="fa fa-ban"></i> View restrictions</a>
783
                    [% IF (noissues && borrowernumber && CAN_user_circulate_force_checkout) %]
766
                    [% IF (borrowernumber && CAN_user_circulate_force_checkout) %]
784
                        <span class="override_debarment">
767
                        <span class="override_debarment issue-disallow">
785
                            <a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&amp;borrowernumber=[% borrowernumber %]" class="btn btn-default btn-sm">Override restriction temporarily</a>
768
                            <a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&amp;borrowernumber=[% borrowernumber %]" class="btn btn-default btn-sm">Override restriction temporarily</a>
786
                        </span>
769
                        </span>
787
                    [% END %]
770
                    [% END %]
Lines 881-891 No patron matched <span class="ex">[% message | html %]</span> Link Here
881
864
882
<ul>
865
<ul>
883
    <li>
866
    <li>
884
        [% IF ( issuecount ) %]
867
            <a href="#checkouts"><span id="issuecount">0</span> Checkout(s)</a>
885
            <a href="#checkouts">[% issuecount %] Checkout(s)</a>
886
        [% ELSE %]
887
            <a href="#checkouts">0 Checkouts</a>
888
        [% END %]
889
    </li>
868
    </li>
890
869
891
    [% IF relatives_issues_count %]
870
    [% IF relatives_issues_count %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-3 / +1 lines)
Lines 176-188 function validate1(date) { Link Here
176
[% ELSE %]
176
[% ELSE %]
177
    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %]
177
    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %]
178
178
179
    [% IF fines %]
180
    <div id="circmessages" class="circmessage attention">
179
    <div id="circmessages" class="circmessage attention">
181
      <ul>
180
      <ul>
182
        [% INCLUDE 'blocked-fines.inc' %]
181
        [% INCLUDE 'blocked-fines.inc' %]
183
      </ul>
182
      </ul>
184
    </div>
183
    </div>
185
    [% END %]
186
184
187
    [% IF ( flagged ) %]
185
    [% IF ( flagged ) %]
188
    <div id="circmessages" class="circmessage attention">
186
    <div id="circmessages" class="circmessage attention">
Lines 498-504 function validate1(date) { Link Here
498
496
499
<div id="finesholdsissues" class="toptabs">
497
<div id="finesholdsissues" class="toptabs">
500
    <ul>
498
    <ul>
501
        <li><a href="#checkouts">[% issuecount %] Checkout(s)</a></li>
499
        <li><a href="#checkouts"><span id="issuecount">0</span> Checkout(s)</a></li>
502
        [% IF relatives_issues_count %]
500
        [% IF relatives_issues_count %]
503
            <li><a href="#relatives-issues" id="relatives-issues-tab">Relatives' checkouts</a></li>
501
            <li><a href="#relatives-issues" id="relatives-issues-tab">Relatives' checkouts</a></li>
504
        [% END %]
502
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (+40 lines)
Lines 1-6 Link Here
1
if ( KOHA === undefined ) var KOHA = {};
2
KOHA.Checkouts = {
3
    BorrowerNumber: null,
4
    NoIssuesCharge: null,
5
    AllowFineOverride: false,
6
    DisallowIssue: false,
7
    ForceOnSiteCheckouts: false,
8
    ToggleInput: function( allow_issue ) {
9
        if (KOHA.Checkouts.AllowFineOverride) allow_issue = true;
10
        if (KOHA.Checkouts.DisallowIssue) allow_issue = false;
11
12
        $(".issue-allow").toggle(allow_issue);
13
        $(".issue-disallow").toggle(!allow_issue);
14
        $("#mainform").toggle(allow_issue || KOHA.Checkouts.ForceOnSiteCheckouts);
15
16
        if (!allow_issue) {
17
            $(".circmessage.attention").removeClass("attention").addClass("warning");
18
        }
19
    },
20
    UpdateCheckoutsAndFees: function(checkouts_only=false) {
21
        $.get( "/cgi-bin/koha/svc/patron/fines", {borrowernumber: KOHA.Checkouts.BorrowerNumber}, function( data ) {
22
            $("#issuecount").text(data.issuecount);
23
            var has_checkouts = data.issuecount > 0;
24
            $(".has-checkouts").toggle(has_checkouts);
25
            $(".no-checkouts").toggle(!has_checkouts);
26
            if (checkouts_only) return;
27
28
            var noissue = KOHA.Checkouts.NoIssuesCharge !== null && data.owing >= KOHA.Checkouts.NoIssuesCharge;
29
            $("#outstanding-fees").toggle(data.owing > 0);
30
            $("#outstanding-fees-amount").text(data.owing_formatted);
31
            $("#outstanding-fees-over-limit").toggle(noissue);
32
            KOHA.Checkouts.ToggleInput(!noissue);
33
        } );
34
    }
35
}
36
1
$(document).ready(function() {
37
$(document).ready(function() {
2
    $.ajaxSetup ({ cache: false });
38
    $.ajaxSetup ({ cache: false });
3
39
40
    KOHA.Checkouts.UpdateCheckoutsAndFees();
41
4
    var barcodefield = $("#barcode");
42
    var barcodefield = $("#barcode");
5
    var issuesTable;
43
    var issuesTable;
6
44
Lines 75-80 $(document).ready(function() { Link Here
75
113
76
                content = "";
114
                content = "";
77
                if ( data.returned ) {
115
                if ( data.returned ) {
116
                    KOHA.Checkouts.UpdateCheckoutsAndFees(true);
78
                    content = CIRCULATION_RETURNED;
117
                    content = CIRCULATION_RETURNED;
79
                    $(id).parent().parent().addClass('ok');
118
                    $(id).parent().parent().addClass('ok');
80
                    $('#date_due_' + data.itemnumber).html(CIRCULATION_RETURNED);
119
                    $('#date_due_' + data.itemnumber).html(CIRCULATION_RETURNED);
Lines 107-112 $(document).ready(function() { Link Here
107
146
108
                var content = "";
147
                var content = "";
109
                if ( data.renew_okay ) {
148
                if ( data.renew_okay ) {
149
                    KOHA.Checkouts.UpdateCheckoutsAndFees();
110
                    issuesTable.api().ajax.reload();
150
                    issuesTable.api().ajax.reload();
111
                    content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
151
                    content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
112
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
152
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
(-)a/members/moremember.pl (-8 lines)
Lines 119-132 my $error = $input->param('error'); Link Here
119
$template->param( error => $error ) if ( $error );
119
$template->param( error => $error ) if ( $error );
120
120
121
my $patron        = Koha::Patrons->find($borrowernumber);
121
my $patron        = Koha::Patrons->find($borrowernumber);
122
my $issues        = $patron->checkouts;
123
my $balance       = $patron->account->balance;
124
$template->param(
125
    issuecount => $issues->count,
126
    fines      => $balance,
127
);
128
129
130
my $data = GetMember( 'borrowernumber' => $borrowernumber );
122
my $data = GetMember( 'borrowernumber' => $borrowernumber );
131
123
132
if ( not defined $data ) {
124
if ( not defined $data ) {
(-)a/svc/patron/fines (-1 / +45 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2016 CatalystIT
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use C4::Service;
24
use Koha::Patrons;
25
use Koha::Number::Price;
26
27
my ( $query, $response ) = C4::Service->init( borrowers => '*' );
28
29
my $borrowernumber = $query->param('borrowernumber')
30
  or return C4::Service->return_error('input', "No 'borrowernumber'");
31
my $patron = Koha::Patrons->find( $borrowernumber )
32
  or return C4::Service->return_error('input', "Invalid 'borrowernumber'", borrowernumber => $borrowernumber);
33
34
my $od     = $patron->get_overdues->count;
35
my $issues = $patron->checkouts->count;
36
my $owing  = $patron->account->balance;
37
38
$response->param(
39
    overduecount    => $od,
40
    issuecount      => $issues,
41
    owing           => $owing || 0.00,
42
    owing_formatted => Koha::Number::Price->new( $owing )->format,
43
);
44
45
C4::Service->return_success( $response );

Return to bug 14803