Bugzilla – Attachment 83130 Details for
Bug 21747
Update C4::Overdues::UpdateFine to use Koha::Account->add_debit and Koha::Account::Line->adjust
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21747: Use Koha::Account:: routines in UpdateFine
Bug-21747-Use-KohaAccount-routines-in-UpdateFine.patch (text/plain), 3.62 KB, created by
Josef Moravec
on 2018-12-12 15:21:47 UTC
(
hide
)
Description:
Bug 21747: Use Koha::Account:: routines in UpdateFine
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-12-12 15:21:47 UTC
Size:
3.62 KB
patch
obsolete
>From 45b145c0819ca6ecfedd2989e3d6361d81f3422b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 1 Nov 2018 14:55:15 +0000 >Subject: [PATCH] Bug 21747: Use Koha::Account:: routines in UpdateFine > >Set to use Koha::Account->add_debit and Koha::Account::Line->adjust > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Overdues.pm | 64 +++++++++++----------------------------------------------- > 1 file changed, 12 insertions(+), 52 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 98e7bbffd4..7f0394f720 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -578,28 +578,7 @@ sub UpdateFine { > # (i.e. , of accounttype 'FU'). Doing so will break accrual. > if ( $data->{'amount'} != $amount ) { > my $accountline = Koha::Account::Lines->find( $data->{accountlines_id} ); >- my $diff = $amount - $data->{'amount'}; >- >- #3341: diff could be positive or negative! >- my $out = $data->{'amountoutstanding'} + $diff; >- >- $accountline->set( >- { >- date => dt_from_string(), >- amount => $amount, >- amountoutstanding => $out, >- lastincrement => $diff, >- accounttype => 'FU', >- } >- )->store(); >- >- Koha::Account::Offset->new( >- { >- debit_id => $accountline->id, >- type => 'Fine Update', >- amount => $diff, >- } >- )->store(); >+ $accountline->adjust({ amount => $amount, type => 'fine_increment' }); > } > } else { > if ( $amount ) { # Don't add new fines with an amount of 0 >@@ -608,42 +587,23 @@ sub UpdateFine { > ); > $sth4->execute($itemnum); > my $title = $sth4->fetchrow; >- >- my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); >- > my $desc = "$title $due"; > >- my $accountline = Koha::Account::Line->new( >- { >- borrowernumber => $borrowernumber, >- itemnumber => $itemnum, >- date => dt_from_string(), >- amount => $amount, >- description => $desc, >- accounttype => 'FU', >- amountoutstanding => $amount, >- lastincrement => $amount, >- accountno => $nextaccntno, >- issue_id => $issue_id, >- } >- )->store(); >- >- Koha::Account::Offset->new( >+ my $account = Koha::Account->new({ patron_id => $borrowernumber }); >+ my $accountline = $account->add_debit( > { >- debit_id => $accountline->id, >- type => 'Fine', >- amount => $amount, >+ amount => $amount, >+ description => $desc, >+ note => undef, >+ user_id => undef, >+ library_id => undef, >+ type => 'fine', >+ item_id => $itemnum, >+ issue_id => $issue_id, > } >- )->store(); >+ ); > } > } >- # logging action >- &logaction( >- "FINES", >- undef, >- $borrowernumber, >- "due=".$due." amount=".$amount." itemnumber=".$itemnum >- ) if C4::Context->preference("FinesLog"); > } > > =head2 BorType >-- >2.11.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 21747
:
81890
|
83130
|
83234
|
83252
|
84725
|
84726
|
84807
|
84808
|
84810
|
84811
|
84816
|
84817
|
85179
|
85180
|
85795