Koha/C4
Jonathan Druart 51aa6db46c 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>
2018-02-23 10:57:30 -03:00
..
AuthoritiesMarc Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Barcodes Bug 14752 - (QA followup) Remove annoying modal, use dialog box instead 2016-09-13 17:21:05 +00:00
ClassSortRoutine Bug 16011: $VERSION - Remove use vars qw(); 2016-03-24 17:20:39 +00:00
Creators Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields) 2017-04-28 08:39:41 -04:00
External Bug 17189: Replace occurrences of 'use Koha::Cache' 2016-09-08 10:24:47 +00:00
Form Bug 16259: Replace CGI->param with CGI->multi_param in list context - part 2 2016-05-16 17:28:06 +00:00
Heading Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
ILSDI Bug 13990: (follow-up) silence warnings on testing 2018-01-30 14:21:19 -03:00
Installer Bug 20061: koha-common is not pulling libsearch-elasticsearch-perl 2018-02-23 10:49:42 -03:00
Labels Bug 19040: Refactor GetMarcBiblio parameters 2017-08-25 10:23:42 -03:00
Linker Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Members Bug 17825: (followup) Remove unused function AttributeTypeExists 2017-03-31 14:37:21 +00:00
OAI Bug 18601: OAI/Sets.t mangles data due to truncate in ModOAISetsBiblios 2017-06-13 16:18:59 -03:00
Output Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Patroncards Bug 18550: [Follow-up] Add POD descriptions to subs 2017-10-06 12:09:55 -03:00
Reports Bug 19495: Automatic report conversion needs to do global replace on 'biblioitems' and 'marcxml' 2017-10-25 12:14:32 -03:00
Search Bug 17323: Column search_history.time cannot be null 2016-11-18 13:51:37 +00:00
Serials Bug 20144: [sql_modes] Add default value for subscription_numberpatterns.description in tests 2018-02-13 13:58:53 -03:00
SIP Bug 12001: Move GetMemberAccountRecords to the Koha namespace 2018-02-23 10:57:30 -03:00
Utils Bug 20145: Do not insert 0000-00-00 in patron tests (and more) 2018-02-18 14:48:05 -03:00
Accounts.pm Bug 10021: Drop columns notify_id and notify_level from accountlines 2017-12-11 11:34:18 -03:00
Acquisition.pm Bug 20144: [sql_modes] Fix GROUP BY clause in GetInvoices 2018-02-13 13:58:58 -03:00
Auth.pm Bug 20189: Fix style on the authentication page 2018-02-13 12:57:21 -03:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 13:16:36 +00:00
Auth_with_cas.pm Bug 19373: CAS logout - Redirect to the previous page (Intranet) 2017-10-16 09:38:41 -03:00
Auth_with_ldap.pm Bug 14625 - LDAP: skip extended patron attributes in 'borrowers' attribute update 2017-05-19 09:52:05 -04:00
Auth_with_shibboleth.pm Bug 12026: [QA Follow-up] Fix a POD line 2017-03-31 14:28:18 +00:00
AuthoritiesMarc.pm Bug 18458: Fix subfields ordering when Merging authority records 2017-12-22 13:15:36 -03:00
BackgroundJob.pm Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Barcodes.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Biblio.pm Bug 20126: (follow-up bug 10455) Restore MARC field length calculation in ModBiblioMarc 2018-02-02 12:08:42 -03:00
Bookseller.pm Bug 14535: Update the supplier filter too 2017-03-31 12:38:44 +00:00
Boolean.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Breeding.pm Bug 19096: Make Default authoritative in core modules 2017-12-07 14:44:15 -03:00
Budgets.pm Bug 18999: Modified SQL query in GetBudgetSpent() in C4/Budgets.pm 2017-09-29 13:03:38 -03:00
Calendar.pm Bug 14572 - insert_single_holiday() forces a value on an AUTO_INCREMENT column, during an INSERT 2017-07-06 14:29:04 -03:00
Charset.pm Bug 18910: Revert "Bug 18152 : fix unimarc label in SetMarcUnicodeFlag" 2017-07-26 14:01:51 -03:00
Circulation.pm Bug 12001: Move GetMemberAccountRecords to the Koha namespace 2018-02-23 10:57:30 -03:00
ClassSortRoutine.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ClassSource.pm Bug 17208: Checking if classification source or filing rule already exists before adding 2016-12-23 11:33:48 +00:00
Context.pm Bug 19788: Preserve case sensitivity when creating Local preferences 2017-12-22 13:15:37 -03:00
Contract.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
CourseReserves.pm Bug 18276: Remove GetBiblioFromItemNumber - Course reserves 2017-07-10 12:09:24 -03:00
Creators.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Debug.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Heading.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
HoldsQueue.pm Bug 19040: Refactor GetMarcBiblio parameters 2017-08-25 10:23:42 -03:00
HTML5Media.pm Bug 17501: Remove Koha::Upload::get from Koha::Upload 2017-01-20 14:20:05 +00:00
Images.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ImportBatch.pm Bug 20144: [sql_modes] Set import_records.marcxml_old to '' on INSERT 2018-02-13 13:58:54 -03:00
ImportExportFramework.pm Bug 17389: Clear logs 2016-10-11 16:18:10 +00:00
InstallAuth.pm Bug 19514: Add client-side check 2017-12-14 16:58:13 -03:00
Installer.pm Bug 14826: account_offset_types.sql is not in the mandatory subdir 2017-10-20 18:14:06 -03:00
ItemCirculationAlertPreference.pm Bug 15407: Koha::Patron::Categories - replace C4::Category->all 2016-09-08 13:29:03 +00:00
Items.pm Bug 17672: Add damaged_on to items and deleteditems tables 2018-02-18 16:48:43 -03:00
Koha.pm Bug 19096: Make Default authoritative in core modules 2017-12-07 14:44:15 -03:00
Labels.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-06-24 14:05:56 +00:00
Letters.pm Bug 20144: [sql_modes] Fix GROUP BY clause in GetLetters 2018-02-13 13:58:54 -03:00
Linker.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Log.pm Bug 19528: Fix a few typos like corrosponding 2017-10-27 14:09:04 -03:00
MarcModificationTemplates.pm Bug 20144: [sql_modes] Set default value for marc_modification_template_actions 2018-02-13 13:58:55 -03:00
Matcher.pm Bug 18131: Followup - Use data if biblionumber_tag < 10 2017-11-26 12:59:51 -03:00
Members.pm Bug 12001: Move GetMemberAccountRecords to the Koha namespace 2018-02-23 10:57:30 -03:00
Message.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
NewsChannels.pm Bug 19528: Fix a few typos like corrosponding 2017-10-27 14:09:04 -03:00
Output.pm Bug 18403: Fix POD for C4::Output::output_and_exit_if_error 2018-02-12 18:02:01 -03:00
Overdues.pm Bug 10021: Drop columns notify_id and notify_level from accountlines 2017-12-11 11:34:18 -03:00
Patroncards.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Print.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Record.pm Bug 19040: Refactor GetMarcBiblio parameters 2017-08-25 10:23:42 -03:00
Reports.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Reserves.pm Bug 19301: Remove C4::Reserves::OnShelfHoldsAllowed 2018-02-13 13:36:00 -03:00
Ris.pm Bug 10306: Core module changes for multiple mappings 2017-12-07 14:44:15 -03:00
RotatingCollections.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Scheduler.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Scrubber.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Search.pm Bug 19971: Typo in the comments of parseQuery routine 2018-01-19 15:50:31 -03:00
Serials.pm Bug 20144: [sql_modes] Set subscription.numberlength and weeklength to NULL if not passed 2018-02-13 13:59:01 -03:00
Service.pm Bug 7550: [QA Follow-up] Resolve param warning from sco-patron-image 2017-05-08 09:00:26 -04:00
ShelfBrowser.pm Bug 19040: Refactor GetMarcBiblio parameters 2017-08-25 10:23:42 -03:00
SMS.pm Bug 19134: C4::SMS falils on long driver name 2017-08-25 10:51:24 -03:00
SocialData.pm Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
Stats.pm Bug 20144: [sql_modes] Fix default value for statistics.itemnumber 2018-02-13 13:58:52 -03:00
Suggestions.pm Bug 17762: Send lang to GetPreparedLetter 2017-05-09 20:56:41 +00:00
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-10 18:05:10 +00:00
Templates.pm Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates 2017-11-01 13:10:17 -03:00
TmplToken.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
TmplTokenType.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
TTParser.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
UsageStats.pm Bug 19713: Remove 2 occurences of OpacShowLibrariesPullDownMobile 2017-12-20 13:34:09 -03:00
XISBN.pm Bug 19096: Make Default authoritative in core modules 2017-12-07 14:44:15 -03:00
XSLT.pm Bug 18921: Resolve a few warnings in C4/XSLT.pm 2017-09-07 14:34:42 -03:00