Lines 70-80
patron.
Link Here
|
70 |
|
70 |
|
71 |
=head2 recordpayment |
71 |
=head2 recordpayment |
72 |
|
72 |
|
73 |
&recordpayment($borrowernumber, $payment); |
73 |
&recordpayment($borrowernumber, $payment, $sip_paytype); |
74 |
|
74 |
|
75 |
Record payment by a patron. C<$borrowernumber> is the patron's |
75 |
Record payment by a patron. C<$borrowernumber> is the patron's |
76 |
borrower number. C<$payment> is a floating-point number, giving the |
76 |
borrower number. C<$payment> is a floating-point number, giving the |
77 |
amount that was paid. |
77 |
amount that was paid. C<$sip_paytype> is an optional flag to indicate this |
|
|
78 |
payment was made over a SIP2 interface, rather than the staff client. The |
79 |
value passed is the SIP2 payment type value (message 37, characters 21-22) |
78 |
|
80 |
|
79 |
Amounts owed are paid off oldest first. That is, if the patron has a |
81 |
Amounts owed are paid off oldest first. That is, if the patron has a |
80 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
82 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
Lines 87-93
will be credited to the next one.
Link Here
|
87 |
sub recordpayment { |
89 |
sub recordpayment { |
88 |
|
90 |
|
89 |
#here we update the account lines |
91 |
#here we update the account lines |
90 |
my ( $borrowernumber, $data ) = @_; |
92 |
my ( $borrowernumber, $data, $sip_paytype ) = @_; |
91 |
my $dbh = C4::Context->dbh; |
93 |
my $dbh = C4::Context->dbh; |
92 |
my $newamtos = 0; |
94 |
my $newamtos = 0; |
93 |
my $accdata = ""; |
95 |
my $accdata = ""; |
Lines 145-153
sub recordpayment {
Link Here
|
145 |
my $usth = $dbh->prepare( |
147 |
my $usth = $dbh->prepare( |
146 |
"INSERT INTO accountlines |
148 |
"INSERT INTO accountlines |
147 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
149 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
148 |
VALUES (?,?,now(),?,'','Pay',?,?)" |
150 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
149 |
); |
151 |
); |
150 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
152 |
|
|
|
153 |
my $payment_description = "Payment, thanks"; |
154 |
$payment_description .= " (via SIP2)" if defined $sip_paytype; |
155 |
my $paytype = "Pay"; |
156 |
$paytype .= "-$sip_paytype" if defined $sip_paytype; |
157 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft, $manager_id ); |
158 |
$usth->finish; |
151 |
|
159 |
|
152 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
160 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
153 |
|
161 |
|
Lines 485-491
sub getcredits {
Link Here
|
485 |
my $dbh = C4::Context->dbh; |
493 |
my $dbh = C4::Context->dbh; |
486 |
my $sth = $dbh->prepare( |
494 |
my $sth = $dbh->prepare( |
487 |
"SELECT * FROM accountlines,borrowers |
495 |
"SELECT * FROM accountlines,borrowers |
488 |
WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber |
496 |
WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber |
489 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
497 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
490 |
); |
498 |
); |
491 |
|
499 |
|