Bugzilla – Attachment 73541 Details for
Bug 14803
Rental and fine fees are not updating on circulation screen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 14803: KOHA.Checkouts js object
bug-14803-KOHACheckouts-js-object.patch (text/plain), 22.79 KB, created by
Srdjan Jankovic
on 2018-04-03 01:09:45 UTC
(
hide
)
Description:
bug 14803: KOHA.Checkouts js object
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2018-04-03 01:09:45 UTC
Size:
22.79 KB
patch
obsolete
>From bfdd4d770826f0fd2721ffbf4b6da92d3b80aba0 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Wed, 15 Jun 2016 15:40:03 +1200 >Subject: [PATCH] bug 14803: KOHA.Checkouts js object > >* Use javascript to: >- update fines/checkouts info >- show/hide checkouts form and messages >* Created svc/patron/fines >--- > circ/circulation.pl | 27 -------- > .../prog/en/includes/blocked-fines.inc | 14 ++-- > .../prog/en/includes/checkouts-table.inc | 7 +- > .../intranet-tmpl/prog/en/includes/checkouts.inc | 11 ++++ > .../prog/en/modules/circ/circulation.tt | 74 ++++++++-------------- > .../prog/en/modules/members/moremember.tt | 6 +- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 43 ++++++++++++- > members/moremember.pl | 2 - > svc/patron/fines | 45 +++++++++++++ > 9 files changed, 133 insertions(+), 96 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.inc > create mode 100755 svc/patron/fines > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 1617584..bd84e9e 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -273,18 +273,12 @@ if ($findborrower) { > } > > # get the borrower information..... >-my $balance = 0; > $patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber; > if ($patron) { > > $template->param( borrowernumber => $patron->borrowernumber ); > output_and_exit_if_error( $query, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > >- my $overdues = $patron->get_overdues; >- my $issues = $patron->checkouts; >- $balance = $patron->account->balance; >- >- > # if the expiry date is before today ie they have expired > if ( $patron->is_expired ) { > #borrowercard expired, no issues >@@ -303,11 +297,6 @@ if ($patron) { > $template->param("returnbeforeexpiry" => 1); > } > } >- $template->param( >- overduecount => $overdues->count, >- issuecount => $issues->count, >- finetotal => $balance, >- ); > > if ( $patron and $patron->is_debarred ) { > $template->param( >@@ -434,7 +423,6 @@ if (@$barcodes) { > ); > } > >- > # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue > $patron = Koha::Patrons->find( $borrowernumber ); > $template_params->{issuecount} = $patron->checkouts->count; >@@ -484,20 +472,6 @@ if ( $patron ) { > $template->param( dbarred=> 1 ); > $noissues = 1; > } >- my $account = $patron->account; >- if( ( my $owing = $account->non_issues_charges ) > 0 ) { >- my $noissuescharge = C4::Context->preference("noissuescharge") || 5; # FIXME If noissuescharge == 0 then 5, why?? >- $noissues = ( not C4::Context->preference("AllowFineOverride") and ( $owing > $noissuescharge ) ); >- $template->param( >- charges => 1, >- chargesamount => $owing, >- ) >- } elsif ( $balance < 0 ) { >- $template->param( >- credits => 1, >- creditsamount => -$balance, >- ); >- } > > my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); > $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); >@@ -617,7 +591,6 @@ $template->param( > duedatespec => $duedatespec, > restoreduedatespec => $restoreduedatespec, > message => $message, >- totaldue => sprintf('%.2f', $balance), # FIXME not used in template? > inprocess => $inprocess, > $view => 1, > batch_allowed => $batch_allowed, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc >index 1cbe84f..2470ae9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc >@@ -1,13 +1,11 @@ >-[% USE Price %] >-[% SET NoIssuesCharge = Koha.Preference('noissuescharge') %] >-[% IF fines and fines > 0 %] >- <li> >+ <li id="outstanding-fees" style="display: none;"> > <span class="circ-hlt">Fees & Charges:</span> >- Patron has outstanding fees & charges of [% fines | $Price %]. >- [% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge && fines > NoIssuesCharge %] >- <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span> >+ Patron has outstanding fees & charges of <span id="outstanding-fees-amount"></span> >+ </a>. >+ >+ [% IF !Koha.Preference('AllowFineOverride') %] >+ <span class="circ-hlt" id="outstanding-fees-over-limit" style="display: none;">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span> > [% END %] > <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Make payment</a> > <a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% borrowernumber %]" class="btn btn-default btn-xs" >Pay all fines</a></li> > </li> >-[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index b34089d..4feaa15 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -1,6 +1,6 @@ > [% USE Koha %] > <div id="checkouts"> >- [% IF ( issuecount ) %] >+ <div class="has-checkouts" style="display: none;"> > <div id="issues-table-loading-message"> > <p> > <a id="issues-table-load-now-button" href="#" class="btn btn-default"><i class="fa fa-book"></i> Show checkouts</a> >@@ -77,7 +77,6 @@ > [% END %] > </div> > </form> >- [% ELSE %] >- <p>Patron has nothing checked out.</p> >- [% END %] >+ </div> >+ <p class="no-checkouts" style="display: none;">Patron has nothing checked out.</p> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.inc >new file mode 100644 >index 0000000..a4f8f1c >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.inc >@@ -0,0 +1,11 @@ >+[% USE Koha %] >+<script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts_[% KOHA_VERSION %].js"></script> >+<script type="text/javascript"> >+$(document).ready(function() { >+ KOHA.Checkouts.BorrowerNumber = [% borrowernumber %]; >+ KOHA.Checkouts.NoIssuesCharge = [% Koha.Preference('noissuescharge') || "null" %]; >+ [% IF Koha.Preference('AllowFineOverride') %] KOHA.Checkouts.AllowFineOverride = true; [% END %] >+ [% IF noissues && !forceallow %] KOHA.Checkouts.DisallowIssue = true; [% END %] >+ [% IF Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') %] KOHA.Checkouts.ForceOnSiteCheckouts = true; [% END %] >+}); >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 198c47d..e6aaf32 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -16,6 +16,11 @@ > </title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> >+[% show_barcode_input = (Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce')) || !noissues || forceallow %] >+<style> >+.issue-allow, .issue-disallow {display: none;} >+[% IF !show_barcode_input %]#mainform {display: none;}[% END %] >+</style> > </head> > > <body id="circ_circulation" class="circ"> >@@ -288,9 +293,7 @@ > </form> > > [% IF ( RESERVED || ISSUED_TO_ANOTHER ) && (CAN_user_reserveforothers_place_holds ) %] >- [% UNLESS noissues %] > <button type="submit" onclick="window.location.href='/cgi-bin/koha/reserve/request.pl?biblionumber=[% itembiblionumber %]&borrowernumber=[% patron.borrowernumber %]'"><i class="fa fa-sticky-note-o"></i> Cancel checkout and place a hold for [% INCLUDE 'patron-title.inc' %]</button> >- [% END %] > [% END %] > </div></div> > [% END %] <!-- NEEDSCONFIRMATION --> >@@ -494,7 +497,6 @@ No patron matched <span class="ex">[% message | html %]</span> > <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> > [% END %] > >-[% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%] > <div class="yui-u first"> > > <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off"> >@@ -531,7 +533,6 @@ No patron matched <span class="ex">[% message | html %]</span> > > <div class="checkout-settings"> > >- [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %] > [% IF ( SpecifyDueDate ) %] > <div id="specify-due-date" class="checkout-setting"> > <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div> >@@ -549,10 +550,8 @@ No patron matched <span class="ex">[% message | html %]</span> > <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> > </div> > [% END %] >- [% END %] > >- [% UNLESS ( noissues ) %] >- <div id="set-automatic-renewal" class="checkout-setting"> >+ <div id="set-automatic-renewal" class="checkout-setting issue-allow"> > [% IF NEEDSCONFIRMATION %] > <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" /> > [% ELSE %] >@@ -579,19 +578,17 @@ No patron matched <span class="ex">[% message | html %]</span> > <label for="override_high_holds">Don't decrease checkout length based on holds</label> > </div> > [% END %] >- [% END %] > > [% IF Koha.Preference('OnSiteCheckouts') %] > <div id="onsite_checkout-select" class="checkout-setting"> >- [% IF noissues %] >- <div class="onsite-checkout-only"> >+ <div class="onsite-checkout-only issue-disallow"> > <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> > <input type="text" name="duedatespec" id="duedatespec" /> > <input type="hidden" name="onsite_checkout" checked="checked" value="1" /> > </div> >- [% ELSE %] >+ <div class="issue-allow"> > <input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting" /> <label for="onsite_checkout">On-site checkout</label> >- [% END %] >+ </div> > </div> > [% END %] > >@@ -612,35 +609,20 @@ No patron matched <span class="ex">[% message | html %]</span> > [% END %] > </form></div> > >-[% END %]<!-- /unless noissues --> >- >-[% IF ( noissues ) %] >- [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] >- <div class="yui-u"> >- [% ELSE %] >- <div> >- [% END %] >-[% ELSE %] > <div class="yui-u"> >-[% END %] >- >- [% IF ( noissues ) %] >- [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] >- <div id="circmessages" class="circmessage attention"> >- [% ELSE %] >+ <div id="circmessages" class="circmessage attention"> >+ <h3>Attention:</h3> >+ <div class="issue-disallow"> >+ [% IF !( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] > <h4>Checking out to [% INCLUDE 'patron-title.inc' %]</h4> >- <div id="circmessages" class="circmessage warning"> > [% END %] >- <h3> >- Cannot check out! >- [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] >- <span class="circ-hlt">Only on-site checkouts are allowed</span> >- [% END %] >- </h3> >- [% ELSE %] >- <div id="circmessages" class="circmessage attention"> >- <h3>Attention:</h3> >- [% END %] >+ <h3> >+ Cannot check out! >+ [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %] >+ <span class="circ-hlt">Only on-site checkouts are allowed</span> >+ [% END %] >+ </h3> >+ </div> > > <ul> > >@@ -699,8 +681,8 @@ No patron matched <span class="ex">[% message | html %]</span> > [% END %] > <br/> > <a class="btn btn-default btn-sm" href="#reldebarments" onclick="$('#debarments-tab-link').click()"><i class="fa fa-ban"></i> View restrictions</a> >- [% IF (noissues && patron && CAN_user_circulate_force_checkout) %] >- <span class="override_debarment"> >+ [% IF (borrowernumber && CAN_user_circulate_force_checkout) %] >+ <span class="override_debarment issue-disallow"> > <a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&borrowernumber=[% patron.borrowernumber %]" class="btn btn-default btn-sm">Override restriction temporarily</a> > </span> > [% END %] >@@ -710,9 +692,7 @@ No patron matched <span class="ex">[% message | html %]</span> > [% IF ( odues ) %]<li><span class="circ-hlt">Overdues: Patron has ITEMS OVERDUE.</span> <a href="#checkouts">See highlighted items below</a></li> > [% END %] > >- [% IF ( charges ) %] >- [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] >- [% END %] >+ [% INCLUDE 'blocked-fines.inc' %] > > [% IF ( charges_guarantees ) %] > <li> >@@ -798,11 +778,7 @@ No patron matched <span class="ex">[% message | html %]</span> > > <ul> > <li> >- [% IF ( issuecount ) %] >- <a href="#checkouts">[% issuecount %] Checkout(s)</a> >- [% ELSE %] >- <a href="#checkouts">0 Checkouts</a> >- [% END %] >+ <a href="#checkouts"><span id="issuecount">0</span> Checkout(s)</a> > </li> > > [% IF relatives_issues_count %] >@@ -980,7 +956,7 @@ No patron matched <span class="ex">[% message | html %]</span> > [% INCLUDE 'timepicker.inc' %] > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script> >- <script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts_[% KOHA_VERSION %].js"></script> >+ [% INCLUDE 'checkouts.inc' %] > <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/circ-patron-search-results_[% KOHA_VERSION %].js"></script> > <script type="text/javascript"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 44cdb94..f3ed3d6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -56,13 +56,11 @@ > > [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% patron.dateexpiry | $KohaDates %]</div>[% END %] > >- [% IF fines %] > <div id="circmessages" class="circmessage attention"> > <ul> > [% INCLUDE 'blocked-fines.inc' %] > </ul> > </div> >- [% END %] > <div id="messages" class="circmessage"> > <h4>Messages:</h4> > <ul> >@@ -403,7 +401,7 @@ > </div> > <div id="finesholdsissues" class="toptabs"> > <ul> >- <li><a href="#checkouts">[% issuecount %] Checkout(s)</a></li> >+ <li><a href="#checkouts"><span id="issuecount">0</span> Checkout(s)</a></li> > [% IF relatives_issues_count %] > <li><a href="#relatives-issues" id="relatives-issues-tab">Relatives' checkouts</a></li> > [% END %] >@@ -551,7 +549,7 @@ > [% INCLUDE 'timepicker.inc' %] > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping_[% KOHA_VERSION %].js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation_[% KOHA_VERSION %].js"></script> >- <script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts_[% KOHA_VERSION %].js"></script> >+ [% INCLUDE 'checkouts.inc' %] > <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds_[% KOHA_VERSION %].js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/messaging-preference-form_[% KOHA_VERSION %].js"></script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index a086ead..4f330ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -1,6 +1,43 @@ >+if ( KOHA === undefined ) var KOHA = {}; >+KOHA.Checkouts = { >+ BorrowerNumber: null, >+ NoIssuesCharge: null, >+ AllowFineOverride: false, >+ DisallowIssue: false, >+ ForceOnSiteCheckouts: false, >+ ToggleInput: function( allow_issue ) { >+ if (KOHA.Checkouts.AllowFineOverride) allow_issue = true; >+ if (KOHA.Checkouts.DisallowIssue) allow_issue = false; >+ >+ $(".issue-allow").toggle(allow_issue); >+ $(".issue-disallow").toggle(!allow_issue); >+ $("#mainform").toggle(allow_issue || KOHA.Checkouts.ForceOnSiteCheckouts); >+ >+ if (!allow_issue) { >+ $(".circmessage.attention").removeClass("attention").addClass("warning"); >+ } >+ }, >+ UpdateCheckoutsAndFees: function() { >+ $.get( "/cgi-bin/koha/svc/patron/fines", {borrowernumber: KOHA.Checkouts.BorrowerNumber}, function( data ) { >+ $("#issuecount").text(data.issuecount); >+ var has_checkouts = data.issuecount > 0; >+ $(".has-checkouts").toggle(has_checkouts); >+ $(".no-checkouts").toggle(!has_checkouts); >+ >+ var noissue = KOHA.Checkouts.NoIssuesCharge !== null && data.owing >= KOHA.Checkouts.NoIssuesCharge; >+ $("#outstanding-fees").toggle(data.owing > 0); >+ $("#outstanding-fees-amount").text(data.owing_formatted); >+ $("#outstanding-fees-over-limit").toggle(noissue); >+ KOHA.Checkouts.ToggleInput(!noissue); >+ } ); >+ } >+} >+ > $(document).ready(function() { > $.ajaxSetup ({ cache: false }); > >+ KOHA.Checkouts.UpdateCheckoutsAndFees(); >+ > var barcodefield = $("#barcode"); > var issuesTable; > >@@ -76,7 +113,7 @@ $(document).ready(function() { > content = ""; > if ( data.returned ) { > content = CIRCULATION_RETURNED; >- $(id).parent().parent().addClass('ok'); >+ $(id).parent().parent().addClass('ok').find('.renew-td').text(''); > $('#date_due_' + data.itemnumber).html(CIRCULATION_RETURNED); > if ( data.patronnote != null ) { > $('.patron_note_' + data.itemnumber).html("Patron note: " + data.patronnote); >@@ -110,6 +147,7 @@ $(document).ready(function() { > > var content = ""; > if ( data.renew_okay ) { >+ KOHA.Checkouts.UpdateCheckoutsAndFees(); > issuesTable.api().ajax.reload(); > content = CIRCULATION_RENEWED_DUE + " " + data.date_due; > $('#date_due_' + data.itemnumber).replaceWith( data.date_due ); >@@ -429,7 +467,8 @@ $(document).ready(function() { > content += "</span>"; > > return content; >- } >+ }, >+ "sClass": "renew-td" > }, > { > "bSortable": false, >diff --git a/members/moremember.pl b/members/moremember.pl >index 0f7eddd..5d2be6b 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -129,10 +129,8 @@ if ( $userenv and $userenv->{number} ) { # Allow DB user to create a superlibrar > } > > my $issues = $patron->checkouts; >-my $balance = $patron->account->balance; > $template->param( > issuecount => $issues->count, >- fines => $balance, > ); > > my $category_type = $patron->category->category_type; >diff --git a/svc/patron/fines b/svc/patron/fines >new file mode 100755 >index 0000000..0320b53 >--- /dev/null >+++ b/svc/patron/fines >@@ -0,0 +1,45 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 CatalystIT >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use C4::Service; >+use Koha::Patrons; >+use Koha::Number::Price; >+ >+my ( $query, $response ) = C4::Service->init( borrowers => '*' ); >+ >+my $borrowernumber = $query->param('borrowernumber') >+ or return C4::Service->return_error('input', "No 'borrowernumber'"); >+my $patron = Koha::Patrons->find( $borrowernumber ) >+ or return C4::Service->return_error('input', "Invalid 'borrowernumber'", borrowernumber => $borrowernumber); >+ >+my $od = $patron->get_overdues->count; >+my $issues = $patron->checkouts->count; >+my $owing = $patron->account->balance; >+ >+$response->param( >+ overduecount => $od, >+ issuecount => $issues, >+ owing => $owing || 0.00, >+ owing_formatted => Koha::Number::Price->new( $owing )->format, >+); >+ >+C4::Service->return_success( $response ); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14803
:
52208
|
52209
|
52210
|
52473
|
52474
|
53406
|
53482
|
60629
|
60630
|
60631
|
62294
|
62432
|
63047
|
63153
|
63230
|
65696
|
65697
|
65698
|
65783
|
65868
|
66261
|
73541
|
73542
|
98891
|
98892
|
115620
|
115621