Lines 60-70
patron.
Link Here
|
60 |
|
60 |
|
61 |
=head2 recordpayment |
61 |
=head2 recordpayment |
62 |
|
62 |
|
63 |
&recordpayment($borrowernumber, $payment); |
63 |
&recordpayment($borrowernumber, $payment, $sip_paytype); |
64 |
|
64 |
|
65 |
Record payment by a patron. C<$borrowernumber> is the patron's |
65 |
Record payment by a patron. C<$borrowernumber> is the patron's |
66 |
borrower number. C<$payment> is a floating-point number, giving the |
66 |
borrower number. C<$payment> is a floating-point number, giving the |
67 |
amount that was paid. |
67 |
amount that was paid. C<$sip_paytype> is an optional flag to indicate this |
|
|
68 |
payment was made over a SIP2 interface, rather than the staff client. The |
69 |
value passed is the SIP2 payment type value (message 37, characters 21-22) |
68 |
|
70 |
|
69 |
Amounts owed are paid off oldest first. That is, if the patron has a |
71 |
Amounts owed are paid off oldest first. That is, if the patron has a |
70 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
72 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
Lines 77-83
will be credited to the next one.
Link Here
|
77 |
sub recordpayment { |
79 |
sub recordpayment { |
78 |
|
80 |
|
79 |
#here we update the account lines |
81 |
#here we update the account lines |
80 |
my ( $borrowernumber, $data ) = @_; |
82 |
my ( $borrowernumber, $data, $sip_paytype ) = @_; |
81 |
my $dbh = C4::Context->dbh; |
83 |
my $dbh = C4::Context->dbh; |
82 |
my $newamtos = 0; |
84 |
my $newamtos = 0; |
83 |
my $accdata = ""; |
85 |
my $accdata = ""; |
Lines 126-134
sub recordpayment {
Link Here
|
126 |
my $usth = $dbh->prepare( |
128 |
my $usth = $dbh->prepare( |
127 |
"INSERT INTO accountlines |
129 |
"INSERT INTO accountlines |
128 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding) |
130 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding) |
129 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?)" |
131 |
VALUES (?,?,now(),?,?,?,?)" |
130 |
); |
132 |
); |
131 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft ); |
133 |
my $payment_description = "Payment, thanks"; |
|
|
134 |
$payment_description .= " (via SIP2)" if defined $sip_paytype; |
135 |
my $paytype = "Pay"; |
136 |
$paytype .= "-$sip_paytype" if defined $sip_paytype; |
137 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft ); |
132 |
$usth->finish; |
138 |
$usth->finish; |
133 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
139 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
134 |
$sth->finish; |
140 |
$sth->finish; |
Lines 602-608
sub getcredits {
Link Here
|
602 |
my $dbh = C4::Context->dbh; |
608 |
my $dbh = C4::Context->dbh; |
603 |
my $sth = $dbh->prepare( |
609 |
my $sth = $dbh->prepare( |
604 |
"SELECT * FROM accountlines,borrowers |
610 |
"SELECT * FROM accountlines,borrowers |
605 |
WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber |
611 |
WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber |
606 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
612 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
607 |
); |
613 |
); |
608 |
|
614 |
|