Main Koha release repository https://koha-community.org
Find a file
Kyle M Hall 27a21083d9 Bug 20325: C4::Accounts::purge_zero_balance_fees does not check account_offsets
purge_zero_balance_fees is used in cleanup_database.pl to determine which fees can be cleaned up.

It uses a simple SQL query to determine which rows in accountlines need to be removed:

463     my $sth = $dbh->prepare(
464         q{
465             DELETE FROM accountlines
466             WHERE date < date_sub(curdate(), INTERVAL ? DAY)
467               AND ( amountoutstanding = 0 or amountoutstanding IS NULL );
468         }

The function comes with the following warning:

451 B<Warning:> Because fines and payments are not linked in accountlines, it is
452 possible for a fine to be deleted without the accompanying payment,
453 or vise versa. This won't affect the account balance, but might be
454 confusing to staff.

This was a reasonable solution prior to the addition of account_offsets in 17.11. The problem now is that rows in accountlines which are linked as credits in accountlines will *always* have amountoutstanding marked as 0. These are linked to debits via account_offsets. purge_zero_balance_fees will delete credits and leave rows in account_offsets which link to deleted credits.

Sites using the --fees option cleanup_database.pl which upgrade to 17.11 may have all of their credits removed without warning.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-05 12:48:15 -03:00
acqui Bug 19812: Fix confusing holds count values in "Already received" table 2018-04-04 16:06:57 -03:00
admin Bug 4078: Add the checkbox to the UI 2018-03-23 11:45:38 -03:00
api/v1 Bug 19784: Adapt /v1/patrons to new naming guidelines 2018-03-29 11:42:08 -03:00
authorities Bug 19583: Remove use of C4::AuthoritiesMarc 2018-03-27 17:54:19 -03:00
basket Bug 19040: Refactor GetMarcBiblio parameters 2017-08-25 10:23:42 -03:00
C4 Bug 20325: C4::Accounts::purge_zero_balance_fees does not check account_offsets 2018-04-05 12:48:15 -03:00
catalogue Bug 20083: Information disclosure when (mis)using the MARC Preview feature 2018-04-04 15:40:07 -03:00
cataloguing Bug 20494: Remove unused code in neworderempty.pl and addbiblio.pl 2018-04-02 18:07:45 -03:00
circ Bug 20067: Fix other checks for linked authorised value categories 2018-03-26 17:01:10 -03:00
clubs Bug 18632: Remove 'CGI::param called in list context' warnings 2017-05-28 22:25:22 -04:00
course_reserves Bug 19230: Preventing warn when deleting course 2018-01-30 14:18:21 -03:00
debian Bug 17468: Remove koha-*-zebra scripts and its traces 2018-03-26 17:31:27 -03:00
docs Bug 7143: Update about page for new dev - Roch D'Amour 2018-04-03 11:43:06 -03:00
errors Bug 19998: use Modern::Perl in error perl scripts 2018-02-05 09:45:48 -03:00
etc Bug 19739: Add default ES configuration to koha-conf.xml 2018-03-27 17:35:05 -03:00
ill Bug 7317: Display all the libraries, not only one 2017-11-09 13:31:10 -03:00
installer Bug 20291: DBRev 17.12.00.025 2018-04-02 18:08:07 -03:00
Koha Bug 19578: Remove MARC punctuation in notices (TT syntax) 2018-04-04 15:45:43 -03:00
koha-tmpl Bug 19953: Record page: acquisition details: add column for invoice 2018-04-04 16:06:57 -03:00
labels Bug 12020: Allow translating label-edit-batch hardcoded strings 2018-03-26 17:31:15 -03:00
members Bug 20008: Fix restrictions added from memberentry.pl if TimeFormat is 12hr 2018-04-04 15:45:44 -03:00
misc Bug 19955: Add ability to process only one 'type' of message ( sms, email, etc ) for a given run of process_message_queue.pl 2018-03-26 17:31:16 -03:00
offline_circ Bug 20018: use Modern::Perl in offline_circ scripts 2018-02-05 09:46:45 -03:00
opac Bug 20083: (follow-up) use same logic in opac-showmarc 2018-04-04 15:45:34 -03:00
OpenILS
patron_lists Bug 19837: Add error feedback for duplicated or unfound cardnumbers 2018-02-18 16:48:46 -03:00
patroncards Bug 20010: use Modern::Perl in Patroncards perl scripts 2018-02-05 09:46:44 -03:00
plugins Bug 20011: use Modern::Perl in plugins perl scripts 2018-02-05 09:46:44 -03:00
reports Bug 19957: Allow continued editing of report after saving 2018-03-26 17:31:17 -03:00
reserve Bug 18474: Restore multiple holds when patron is searched for 2018-04-02 18:07:34 -03:00
reviews Bug 18789: Send Koha::Patron object to the templates 2018-02-16 13:03:58 -03:00
rotating_collections Bug 15758: Koha::Libraries - Remove GetBranches 2016-09-08 14:36:03 +00:00
serials Bug 20461: Serials: fix ignored params in subscription creation form 2018-03-26 17:31:07 -03:00
services Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
skel
suggestion Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
svc Bug 18403: Update permissions - borrowers => 1|* becomes borrowers => 'edit_borrowers' 2018-02-12 15:41:37 -03:00
t Bug 20325: C4::Accounts::purge_zero_balance_fees does not check account_offsets 2018-04-05 12:48:15 -03:00
tags Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
test Bug 9819 - 'stopwords'-related code removed 2015-12-30 15:49:35 +00:00
tmp/modified_authorities
tools Bug 20462: Ensure batch item deletion will not delete the same item twice 2018-04-02 18:07:44 -03:00
virtualshelves Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
xt Bug 18979: Speed up 'valid-templates.t' tests 2018-04-02 18:07:45 -03:00
.editorconfig
.gitignore Bug 20267: Add basic .gitignore 2018-03-26 17:31:16 -03:00
.htaccess
.mailmap Update mailmap - Jonathan Druart 2017-06-21 12:42:19 -03:00
about.pl Bug 15492: Make existing code aware of new self_check* permissions 2018-03-26 17:31:18 -03:00
changelanguage.pl Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
edithelp.pl Bug 18403: Update permissions - borrowers => 1|* becomes borrowers => 'edit_borrowers' 2018-02-12 15:41:37 -03:00
fix-perl-path.PL
help.pl Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
INSTALL Bug 17626: Remove existing install instructions and link to the wiki pages instead 2016-11-22 11:29:07 +00:00
install-CPAN.pl
Koha.pm Bug 20291: DBRev 17.12.00.025 2018-04-02 18:08:07 -03:00
koha_perl_deps.pl Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
kohaversion.pl Bug 13758: Move the Koha version from kohaversion.pl 2015-05-07 11:39:04 -03:00
LICENSE
mainpage.pl Bug 18403: Article requests 2018-02-12 15:41:41 -03:00
Makefile.PL Bug 17951: (follow-up) Make Makefile.PL handle template_cache_dir config 2017-12-22 13:15:39 -03:00
MANIFEST.SKIP
README
README.md Bug 15465: Fix typo in bugs.k-c.org 2017-05-26 11:45:31 -03:00
README.robots
rewrite-config.PL Bug 17951: (follow-up) Make Makefile.PL handle template_cache_dir config 2017-12-22 13:15:39 -03:00

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: This is a synced mirror of the official Koha repo.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

http://koha-community.org/

Koha Logo