Bugzilla – Attachment 26463 Details for
Bug 6273
SIP2 Fee Paid and Fee Paid Response support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[passed-qa] Bug 6273 - SIP2 Fee Paid and Fee Paid Response support
Bug-6273---SIP2-Fee-Paid-and-Fee-Paid-Response-sup.patch (text/plain), 6.62 KB, created by
Brendan Gallagher
on 2014-03-19 17:43:33 UTC
(
hide
)
Description:
[passed-qa] Bug 6273 - SIP2 Fee Paid and Fee Paid Response support
Filename:
MIME Type:
Creator:
Brendan Gallagher
Created:
2014-03-19 17:43:33 UTC
Size:
6.62 KB
patch
obsolete
>From 28a3a40bf3c2e158e3eab418b3d8617d708087b6 Mon Sep 17 00:00:00 2001 >From: Ian Walls <ian.walls@bywatersolutions.com> >Date: Fri, 2 Dec 2011 10:49:07 -0500 >Subject: [PATCH] Bug 6273 - SIP2 Fee Paid and Fee Paid Response support > >Adds support for recording in Koha accountlines a different accounttype >depending on how the fee was paid at the SIP2 station (cash, credit, etc) > >Adds a new param to recordpayment(), $sip_paytype, which is appended to the >'Pay' type if present. The payment descriptin is also appended with " (via SIP2)" >if this is present. > >In order for other scripts to keep working as expected, "eq 'Pay'" needed to >be replaced with a regex comparison "=~ /^Pay/", so that 'Pay' and 'Pay-##' would continue >to group together. > >To test: >1. Make a payment over a SIP2 connection >2. Check the patron record in the staff client; you should see the modified description >3. Attempt to print a invoice or a reciept for the borrower; the payment should show up > where expected > >http://bugs.koha-community.org/show_bug.cgi?id=6273 > >Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> >--- > C4/Accounts.pm | 20 ++++++++++++++------ > C4/SIP/ILS.pm | 2 +- > C4/SIP/ILS/Transaction/FeePayment.pm | 3 ++- > members/boraccount.pl | 2 +- > members/printfeercpt.pl | 2 +- > members/printinvoice.pl | 2 +- > 6 files changed, 20 insertions(+), 11 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 3fbb2ad..fa1ef77 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -70,11 +70,13 @@ patron. > > =head2 recordpayment > >- &recordpayment($borrowernumber, $payment); >+ &recordpayment($borrowernumber, $payment, $sip_paytype); > > Record payment by a patron. C<$borrowernumber> is the patron's > borrower number. C<$payment> is a floating-point number, giving the >-amount that was paid. >+amount that was paid. C<$sip_paytype> is an optional flag to indicate this >+payment was made over a SIP2 interface, rather than the staff client. The >+value passed is the SIP2 payment type value (message 37, characters 21-22) > > Amounts owed are paid off oldest first. That is, if the patron has a > $1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment >@@ -87,7 +89,7 @@ will be credited to the next one. > sub recordpayment { > > #here we update the account lines >- my ( $borrowernumber, $data ) = @_; >+ my ( $borrowernumber, $data, $sip_paytype ) = @_; > my $dbh = C4::Context->dbh; > my $newamtos = 0; > my $accdata = ""; >@@ -145,9 +147,15 @@ sub recordpayment { > my $usth = $dbh->prepare( > "INSERT INTO accountlines > (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) >- VALUES (?,?,now(),?,'','Pay',?,?)" >+ VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" > ); >- $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); >+ >+ my $payment_description = "Payment, thanks"; >+ $payment_description .= " (via SIP2)" if defined $sip_paytype; >+ my $paytype = "Pay"; >+ $paytype .= "-$sip_paytype" if defined $sip_paytype; >+ $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft, $manager_id ); >+ $usth->finish; > > UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); > >@@ -485,7 +493,7 @@ sub getcredits { > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( > "SELECT * FROM accountlines,borrowers >- WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber >+ WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber > AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" > ); > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index 703bb96..e2089e8 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -229,7 +229,7 @@ sub pay_fee { > $trans->screen_msg('Invalid patron barcode.'); > return $trans; > } >- $trans->pay($patron->{borrowernumber},$fee_amt); >+ $trans->pay($patron->{borrowernumber},$fee_amt, $pay_type); > $trans->ok(1); > > return $trans; >diff --git a/C4/SIP/ILS/Transaction/FeePayment.pm b/C4/SIP/ILS/Transaction/FeePayment.pm >index 52619f4..ac6a3bc 100644 >--- a/C4/SIP/ILS/Transaction/FeePayment.pm >+++ b/C4/SIP/ILS/Transaction/FeePayment.pm >@@ -46,8 +46,9 @@ sub pay { > my $self = shift; > my $borrowernumber = shift; > my $amt = shift; >+ my $type = shift; > warn("RECORD:$borrowernumber::$amt"); >- recordpayment( $borrowernumber, $amt ); >+ recordpayment( $borrowernumber, $amt,$type ); > } > > #sub DESTROY { >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 255b1ff..4ade843 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -84,7 +84,7 @@ foreach my $accountline ( @{$accts}) { > $accountline->{date} = format_date($accountline->{date}); > $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; > $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; >- if ($accountline->{accounttype} eq 'Pay') { >+ if ($accountline->{accounttype} =~ /^Pay/) { > $accountline->{payment} = 1; > $reverse_col = 1; > } >diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl >index 6a86bc3..eff3200 100755 >--- a/members/printfeercpt.pl >+++ b/members/printfeercpt.pl >@@ -99,7 +99,7 @@ for (my $i=0;$i<$numaccts;$i++){ > 'amount' => sprintf("%.2f",$accts->[$i]{'amount'}), > 'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}), > 'accountno' => $accts->[$i]{'accountno'}, >- 'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ), >+ 'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ), > > ); > >diff --git a/members/printinvoice.pl b/members/printinvoice.pl >index 10ae114..42e1182 100755 >--- a/members/printinvoice.pl >+++ b/members/printinvoice.pl >@@ -99,7 +99,7 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) { > 'amount' => sprintf( "%.2f", $accts->[$i]{'amount'} ), > 'amountoutstanding' => sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} ), > 'accountno' => $accts->[$i]{'accountno'}, >- 'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ), >+ 'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ), > ); > > if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) { >-- >1.7.10.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 6273
:
6539
|
11476
|
22834
|
24889
|
24890
|
24935
|
25167
| 26463