Bugzilla – Attachment 58093 Details for
Bug 15898
Use Koha::Account::pay internally for makepartialpayment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15898 - Use Koha::Account::pay internally for makepartialpayment
Bug-15898---Use-KohaAccountpay-internally-for-make.patch (text/plain), 3.89 KB, created by
Josef Moravec
on 2016-12-10 09:56:27 UTC
(
hide
)
Description:
Bug 15898 - Use Koha::Account::pay internally for makepartialpayment
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-12-10 09:56:27 UTC
Size:
3.89 KB
patch
obsolete
>From 928f6b816b9b13c082e48aca89f1b8286a278910 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 24 Feb 2016 14:01:23 +0000 >Subject: [PATCH] Bug 15898 - Use Koha::Account::pay internally for > makepartialpayment > >This is the fourth patch in a series to unify all payment functions into >a single mathod > >Test Plan: >1) Apply this patch >2) prove t/db_dependent/Accounts.t >3) Test fine payment via the "Pay" button, > but make the payment for less then the full amount >--- > C4/Accounts.pm | 73 +++++++++++----------------------------------------------- > 1 file changed, 14 insertions(+), 59 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 1d0654e..682e59b 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -415,7 +415,7 @@ sub recordpayment_selectaccts { > { > amount => $amount, > lines => \@lines, >- note => $note >+ note => $note, > } > ); > } >@@ -424,67 +424,22 @@ sub recordpayment_selectaccts { > # fills in > sub makepartialpayment { > my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; >- my $manager_id = 0; >- $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; >- if (!$amount || $amount < 0) { >- return; >- } >- $payment_note //= ""; >- my $dbh = C4::Context->dbh; >- >- my $nextaccntno = getnextacctno($borrowernumber); >- my $newamtos = 0; >- >- my $data = $dbh->selectrow_hashref( >- 'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); >- my $new_outstanding = $data->{amountoutstanding} - $amount; >- >- my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; >- $dbh->do( $update, undef, $new_outstanding, $accountlines_id); >- >- if ( C4::Context->preference("FinesLog") ) { >- logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ >- action => 'fee_payment', >- borrowernumber => $borrowernumber, >- old_amountoutstanding => $data->{'amountoutstanding'}, >- new_amountoutstanding => $new_outstanding, >- amount_paid => $data->{'amountoutstanding'} - $new_outstanding, >- accountlines_id => $data->{'accountlines_id'}, >- accountno => $data->{'accountno'}, >- manager_id => $manager_id, >- })); >- } >- >- # create new line >- my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' >- . 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' >- . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; >- >- $dbh->do( $insert, undef, $borrowernumber, $nextaccntno, -$amount, >- '', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); > >- UpdateStats({ >- branch => $branch, >- type => 'payment', >- amount => $amount, >- borrowernumber => $borrowernumber, >- accountno => $accountno >- }); >+ my $line = Koha::Account::Lines->find( $accountlines_id ); > >- if ( C4::Context->preference("FinesLog") ) { >- logaction("FINES", 'CREATE',$borrowernumber,Dumper({ >- action => 'create_payment', >- borrowernumber => $user, >- accountno => $nextaccntno, >- amount => 0 - $amount, >- accounttype => 'Pay', >- itemnumber => $data->{'itemnumber'}, >- accountlines_paid => [ $data->{'accountlines_id'} ], >- manager_id => $manager_id, >- })); >- } >+ return Koha::Account->new( >+ { >+ patron_id => $borrowernumber, >+ } >+ )->pay( >+ { >+ amount => $amount, >+ lines => [ $line ], >+ note => $payment_note, >+ library_id => $branch, >+ } >+ ); > >- return; > } > > =head2 WriteOffFee >-- >2.1.4
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 15898
:
48334
|
52141
|
58093
|
58095
|
58765