From 04684583c11c008af8bc27db2d2c14ba45363717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Thu, 11 Sep 2014 16:59:37 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 12865 - 'Pay amount toward all fines' does not record payment note Content-Type: text/plain; charset="utf-8" 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 --- 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 8cd9100..caa1fe0 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 01536b0..ca47862 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 -- 1.7.9.5