From a7a757ba85fc787070704ca2d0d1545c70015439 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Thu, 11 Sep 2014 16:59:37 +0200 Subject: [PATCH] Bug 12865 - 'Pay amount toward all fines' does not record payment note Without patch: ------------- Make payment for patron who has fines Select the Pay Amount button and add a note in the note box. Select confirm Result: The note does not display in list With patch: ---------- Result: The note displays in list Bonus testing: The note is included in system logs as well (Home:Tools:Logs) Signed-off-by: Owen Leonard Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Accounts.pm | 13 ++++++++----- members/paycollect.pl | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index ce5671d09a..c98013a3af 100644 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -70,7 +70,7 @@ patron. =head2 recordpayment - &recordpayment($borrowernumber, $payment, $sip_paytype); + &recordpayment($borrowernumber, $payment, $sip_paytype, $note); Record payment by a patron. C<$borrowernumber> is the patron's borrower number. C<$payment> is a floating-point number, giving the @@ -89,7 +89,7 @@ will be credited to the next one. sub recordpayment { #here we update the account lines - my ( $borrowernumber, $data, $sip_paytype ) = @_; + my ( $borrowernumber, $data, $sip_paytype, $payment_note ) = @_; my $dbh = C4::Context->dbh; my $newamtos = 0; my $accdata = ""; @@ -98,6 +98,8 @@ sub recordpayment { my $manager_id = 0; $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; + $payment_note //= ""; + # begin transaction my $nextaccntno = getnextacctno($borrowernumber); @@ -138,6 +140,7 @@ sub recordpayment { accountlines_id => $accdata->{'accountlines_id'}, accountno => $accdata->{'accountno'}, manager_id => $manager_id, + note => $payment_note, })); push( @ids, $accdata->{'accountlines_id'} ); } @@ -146,13 +149,13 @@ sub recordpayment { # create new line my $usth = $dbh->prepare( "INSERT INTO accountlines - (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) - VALUES (?,?,now(),?,'',?,?,?)" + (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id, note) + VALUES (?,?,now(),?,'',?,?,?,?)" ); my $paytype = "Pay"; $paytype .= $sip_paytype if defined $sip_paytype; - $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id ); + $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $payment_note ); $usth->finish; UpdateStats({ diff --git a/members/paycollect.pl b/members/paycollect.pl index 01536b07c5..ca47862214 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -126,7 +126,8 @@ if ( $total_paid and $total_paid ne '0.00' ) { my $note = $input->param('selected_accts_notes'); recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note ); } else { - recordpayment( $borrowernumber, $total_paid ); + my $note = $input->param('selected_accts_notes'); + recordpayment( $borrowernumber, $total_paid, '', $note ); } # recordpayment does not return success or failure so lets redisplay the boraccount -- 2.39.5