Bugzilla – Attachment 76730 Details for
Bug 20980
Manual credit offsets are stored as debits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20980: (follow-up) Only use UpdateStats for 'payment' and 'writeoff'
Bug-20980-follow-up-Only-use-UpdateStats-for-payme.patch (text/plain), 2.42 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-07-06 12:22:54 UTC
(
hide
)
Description:
Bug 20980: (follow-up) Only use UpdateStats for 'payment' and 'writeoff'
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-07-06 12:22:54 UTC
Size:
2.42 KB
patch
obsolete
>From d1867904110eea6661745300834d776419214e66 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 22 Jun 2018 12:24:33 -0300 >Subject: [PATCH] Bug 20980: (follow-up) Only use UpdateStats for 'payment' and > 'writeoff' > >This patch makes Koha::Account::add_credit record statistics logs >(through C4::Stats::UpdateStats) only for the 'payment' and 'writeoff' >credit types. > >Both credit types are whitelisted in UpdateStats, so we keep the current >behaviour. Another option would've been to add new account types to the >white list, but with the account offsets it seems that using the >statistics table for account changes won't be useful for too long, as >offsets contain the same (and more) information. > >To test: >- Apply the patch >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Account.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account.pm | 2 +- > t/db_dependent/Koha/Account.t | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 99d5a60c64..1541998d68 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -351,7 +351,7 @@ sub add_credit { > borrowernumber => $self->{patron_id}, > accountno => $accountno, > } >- ); >+ ) if grep { $type eq $_ } ('payment', 'writeoff') ; > > if ( C4::Context->preference("FinesLog") ) { > logaction( >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 5d5a081589..d51ef9ff6a 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -178,5 +178,17 @@ subtest 'add_credit() tests' => sub { > is( $offset_2->credit_id, $line_2->id, 'No debit_id is set for credits' ); > is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); > >+ my $line_3 = $account->add_credit( >+ { amount => 20, >+ description => 'Manual credit applied', >+ library_id => $patron->branchcode, >+ user_id => $patron->id, >+ type => 'forgiven' >+ } >+ ); >+ >+ is( $schema->resultset('ActionLog')->count(), 2, 'Log was added' ); >+ is( $schema->resultset('Statistic')->count(), 2, 'No action added to statistics, because of credit type' ); >+ > $schema->storage->txn_rollback; > }; >-- >2.18.0
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 20980
:
76299
|
76300
|
76301
|
76322
|
76323
|
76324
|
76325
|
76401
|
76402
|
76403
|
76404
|
76442
|
76443
|
76444
|
76445
|
76728
|
76729
| 76730 |
76731
|
76732
|
76734