Lines 165-171
sub makepayment {
Link Here
|
165 |
#here we update both the accountoffsets and the account lines |
165 |
#here we update both the accountoffsets and the account lines |
166 |
#updated to check, if they are paying off a lost item, we return the item |
166 |
#updated to check, if they are paying off a lost item, we return the item |
167 |
# from their card, and put a note on the item record |
167 |
# from their card, and put a note on the item record |
168 |
my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; |
168 |
my ( $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
169 |
my $dbh = C4::Context->dbh; |
169 |
my $dbh = C4::Context->dbh; |
170 |
my $manager_id = 0; |
170 |
my $manager_id = 0; |
171 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
171 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 205-218
sub makepayment {
Link Here
|
205 |
|
205 |
|
206 |
# create new line |
206 |
# create new line |
207 |
my $payment = 0 - $amount; |
207 |
my $payment = 0 - $amount; |
|
|
208 |
$payment_note //= ""; |
208 |
|
209 |
|
209 |
my $ins = |
210 |
my $ins = |
210 |
$dbh->prepare( |
211 |
$dbh->prepare( |
211 |
"INSERT |
212 |
"INSERT |
212 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id) |
213 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
213 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?)" |
214 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)" |
214 |
); |
215 |
); |
215 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id); |
216 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
216 |
$ins->finish; |
217 |
$ins->finish; |
217 |
} |
218 |
} |
218 |
|
219 |
|
Lines 732-743
sub recordpayment_selectaccts {
Link Here
|
732 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
733 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
733 |
# fills in |
734 |
# fills in |
734 |
sub makepartialpayment { |
735 |
sub makepartialpayment { |
735 |
my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; |
736 |
my ( $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
736 |
my $manager_id = 0; |
737 |
my $manager_id = 0; |
737 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
738 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
738 |
if (!$amount || $amount < 0) { |
739 |
if (!$amount || $amount < 0) { |
739 |
return; |
740 |
return; |
740 |
} |
741 |
} |
|
|
742 |
$payment_note //= ""; |
741 |
my $dbh = C4::Context->dbh; |
743 |
my $dbh = C4::Context->dbh; |
742 |
|
744 |
|
743 |
my $nextaccntno = getnextacctno($borrowernumber); |
745 |
my $nextaccntno = getnextacctno($borrowernumber); |
Lines 753-772
sub makepartialpayment {
Link Here
|
753 |
|
755 |
|
754 |
# create new line |
756 |
# create new line |
755 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
757 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
756 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' |
758 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
757 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?)'; |
759 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
758 |
|
760 |
|
759 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
761 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
760 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id); |
762 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
761 |
|
763 |
|
762 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
764 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
763 |
|
765 |
|
764 |
return; |
766 |
return; |
765 |
} |
767 |
} |
766 |
|
768 |
|
767 |
=head2 WriteOff |
769 |
=head2 WriteOffFee |
768 |
|
770 |
|
769 |
WriteOff( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch ); |
771 |
WriteOffFee( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch, $payment_note ); |
770 |
|
772 |
|
771 |
Write off a fine for a patron. |
773 |
Write off a fine for a patron. |
772 |
C<$borrowernumber> is the patron's borrower number. |
774 |
C<$borrowernumber> is the patron's borrower number. |
Lines 775-785
C<$itemnum> is the itemnumber of of item whose fine is being written off.
Link Here
|
775 |
C<$accounttype> is the account type of the fine being written off. |
777 |
C<$accounttype> is the account type of the fine being written off. |
776 |
C<$amount> is a floating-point number, giving the amount that is being written off. |
778 |
C<$amount> is a floating-point number, giving the amount that is being written off. |
777 |
C<$branch> is the branchcode of the library where the writeoff occurred. |
779 |
C<$branch> is the branchcode of the library where the writeoff occurred. |
|
|
780 |
C<$payment_note> is the note to attach to this payment |
778 |
|
781 |
|
779 |
=cut |
782 |
=cut |
780 |
|
783 |
|
781 |
sub WriteOffFee { |
784 |
sub WriteOffFee { |
782 |
my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch ) = @_; |
785 |
my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch, $payment_note ) = @_; |
|
|
786 |
$payment_note //= ""; |
783 |
$branch ||= C4::Context->userenv->{branch}; |
787 |
$branch ||= C4::Context->userenv->{branch}; |
784 |
my $manager_id = 0; |
788 |
my $manager_id = 0; |
785 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
789 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 799-810
sub WriteOffFee {
Link Here
|
799 |
|
803 |
|
800 |
$query =" |
804 |
$query =" |
801 |
INSERT INTO accountlines |
805 |
INSERT INTO accountlines |
802 |
( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id ) |
806 |
( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id, note ) |
803 |
VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ? ) |
807 |
VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ?, ? ) |
804 |
"; |
808 |
"; |
805 |
$sth = $dbh->prepare( $query ); |
809 |
$sth = $dbh->prepare( $query ); |
806 |
my $acct = getnextacctno($borrowernumber); |
810 |
my $acct = getnextacctno($borrowernumber); |
807 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); |
811 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id, $payment_note ); |
808 |
|
812 |
|
809 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
813 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
810 |
|
814 |
|