Bug 12001: Move GetMemberAccountRecords to the Koha namespace
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 5 Jan 2018 19:18:37 +0000 (16:18 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 23 Feb 2018 13:57:30 +0000 (10:57 -0300)
commit51aa6db46c604aa202a3d8f8e5028557480efbd5
tree739ebf063899b2fd9cd7aaaf8dffb9c6a2af315c
parent4609e95f9d9f8bd2a773522d67d7cd6126c9120a
Bug 12001: Move GetMemberAccountRecords to the Koha namespace

The GetMemberAccountRecords may be a perf killer, it retrieves all the
account lines of a patron and then the related item and biblio
information.
Most of the time we only want to know how much the patron owns to the
library (sum of amountoutstanding). We already have this information in
Koha::Patron->account->balance.

This patch replaces the occurrences of this subroutine by fetching only
the information we need, either the balance, the detail, or both.
It removes the formatting done in the module, to use the TT plugin
'Price' instead.
There is a very weird and error-prone behavior/feature in
GetMemberAccountBalance (FIXME): as the accountlines.accounttype is a
varchar(5), the value of the authorised value used for the
ManInvInNoissuesCharge pref (category MANUAL_INV) is truncated to the 5
first characters. That could lead to unexpected behaviors.

On the way, this patchset also replace the GetMemberAccountBalance
subroutine, which returns the balance, the non issues charges and the
other charges. We only need to have the balance and the non issues
charges to calcul the third one.

Test plan:
Add several fees for a patron and play with HoldsInNoissuesCharge,
RentalsInNoissuesCharge and ManInvInNoissuesCharge.
The information (biblio and item info, as well as the account line) must
be correctly displayed on the different screens: 'Fines' module, fine
slips, circulation module

Note that this patchset could introduce regression on price formatting,
but will be easy to fix using the TT plugin.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
22 files changed:
C4/Circulation.pm
C4/Members.pm
C4/SIP/ILS/Patron.pm
Koha/Account.pm
Koha/Account/Line.pm
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
members/boraccount.pl
members/moremember.pl
members/pay.pl
members/paycollect.pl
members/printfeercpt.pl
members/printinvoice.pl
members/summary-print.pl
opac/opac-account.pl
opac/opac-main.pl
opac/opac-reserve.pl
opac/opac-user.pl
reserve/request.pl
t/db_dependent/Koha/Patrons.t
t/db_dependent/Members.t