}
my $borrower = $sth->fetchrow_hashref;
return unless $borrower;
- my ($amount) = GetMemberAccountRecords($borrower->{borrowernumber});
- $borrower->{'amountoutstanding'} = $amount;
- # FIXME - patronflags calls GetMemberAccountRecords... just have patronflags return $amount
+
my $flags = patronflags( $borrower);
$borrower->{'flags'} = $flags;
[% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
[% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
[% IF ( OPACFinesTab ) %]
- [% IF ( BORROWER_INFO.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INFO.amountoutstanding | $Price %])</a></li>[% END %]
- [% IF ( BORROWER_INFO.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INFO.amountoutstanding | $Price %])</a></li>[% END %]
- [% IF ( BORROWER_INFO.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% BORROWER_INFO.amountoutstanding | $Price %])</a></li>[% END %]
+ [% IF ( BORROWER_INFO.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+ [% IF ( BORROWER_INFO.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+ [% IF ( BORROWER_INFO.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %]
[% END %]
[% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count %])</a></li>[% END %]
[% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% borrower.article_requests_current.count %])</a></li>[% END %]
<tbody>
<tr>
<td>You currently owe fines and charges amounting to:</td>
- <td><a href="/cgi-bin/koha/opac-account.pl">[% BORROWER_INFO.amountoutstanding | $Price %]</a></td>
+ <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
</tr>
</tbody>
</table>
<tbody>
<tr>
<td>You currently owe fines and charges amounting to:</td>
- <td><a href="/cgi-bin/koha/opac-account.pl">[% BORROWER_INFO.amountoutstanding %]</a></td>
+ <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding %]</a></td>
</tr>
</tbody>
</table>
<thead><tr><th colspan="2">Amount</th></tr></thead>
<tbody>
<tr>
- <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% BORROWER_INFO.amountoutstanding %]</a></td>
+ <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding %]</a></td>
</tr>
</tbody>
</table>
my $noreserves = 0;
my $maxoutstanding = C4::Context->preference("maxoutstanding");
$template->param( noreserve => 1 ) unless $maxoutstanding;
-if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstanding) ) {
- my $amount = sprintf "%.02f", $borr->{'amountoutstanding'};
+my $amountoutstanding = GetMemberAccountRecords($borrowernumber);
+if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
+ my $amount = sprintf "%.02f", $amountoutstanding;
$template->param( message => 1 );
$noreserves = 1;
$template->param( too_much_oweing => $amount );
$canrenew = 0;
}
-if ( $borr->{'amountoutstanding'} > 5 ) {
+my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber);
+if ( $amountoutstanding > 5 ) {
$borr->{'amountoverfive'} = 1;
}
-if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
+if ( 5 >= $amountoutstanding && $amountoutstanding > 0 ) {
$borr->{'amountoverzero'} = 1;
}
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
if ( C4::Context->preference('OpacRenewalAllowed')
&& defined($no_renewal_amt)
- && $borr->{amountoutstanding} > $no_renewal_amt )
+ && $amountoutstanding > $no_renewal_amt )
{
$borr->{'flagged'} = 1;
$canrenew = 0;
$template->param(
renewal_blocked_fines => $no_renewal_amt,
- renewal_blocked_fines_amountoutstanding => $borr->{amountoutstanding},
+ renewal_blocked_fines_amountoutstanding => $amountoutstanding,
);
}
-if ( $borr->{'amountoutstanding'} < 0 ) {
+if ( $amountoutstanding < 0 ) {
$borr->{'amountlessthanzero'} = 1;
- $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} );
+ $amountoutstanding = -1 * ( $amountoutstanding );
}
# Warningdate is the date that the warning starts appearing
my $renew_error = $query->param('renew_error');
$template->param( BORROWER_INFO => $borr,
+ amountoutstanding => $amountoutstanding,
borrowernumber => $borrowernumber,
patron_flagged => $borr->{flagged},
OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
subtest 'GetMemberAccountBalance' => sub {
- plan tests => 10;
+ plan tests => 6;
my $members_mock = new Test::MockModule('C4::Members');
$members_mock->mock( 'GetMemberAccountRecords', sub {
}
});
- my $person = GetMemberDetails(undef,undef);
- ok( !$person , 'Expected no member details from undef,undef' );
- $person = GetMemberDetails(undef,'987654321');
- is( $person->{amountoutstanding}, 15,
- 'Expected 15 outstanding for cardnumber.');
- $borrowernumber = $person->{borrowernumber};
- $person = GetMemberDetails($borrowernumber,undef);
- is( $person->{amountoutstanding}, 15,
- 'Expected 15 outstanding for borrowernumber.');
- $person = GetMemberDetails($borrowernumber,'987654321');
- is( $person->{amountoutstanding}, 15,
- 'Expected 15 outstanding for both borrowernumber and cardnumber.');
-
# do not count holds charges
t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', '1' );
t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', '0' );