Lines 24-29
use C4::Context;
Link Here
|
24 |
use C4::Stats; |
24 |
use C4::Stats; |
25 |
use C4::Members; |
25 |
use C4::Members; |
26 |
use C4::Circulation qw(ReturnLostItem); |
26 |
use C4::Circulation qw(ReturnLostItem); |
|
|
27 |
use C4::Log qw(logaction); |
28 |
|
29 |
use Data::Dumper qw(Dumper); |
27 |
|
30 |
|
28 |
use vars qw($VERSION @ISA @EXPORT); |
31 |
use vars qw($VERSION @ISA @EXPORT); |
29 |
|
32 |
|
Lines 100-111
sub recordpayment {
Link Here
|
100 |
# get lines with outstanding amounts to offset |
103 |
# get lines with outstanding amounts to offset |
101 |
my $sth = $dbh->prepare( |
104 |
my $sth = $dbh->prepare( |
102 |
"SELECT * FROM accountlines |
105 |
"SELECT * FROM accountlines |
103 |
WHERE (borrowernumber = ?) AND (amountoutstanding<>0) |
106 |
WHERE (borrowernumber = ?) AND (amountoutstanding<>0) |
104 |
ORDER BY date" |
107 |
ORDER BY date" |
105 |
); |
108 |
); |
106 |
$sth->execute($borrowernumber); |
109 |
$sth->execute($borrowernumber); |
107 |
|
110 |
|
108 |
# offset transactions |
111 |
# offset transactions |
|
|
112 |
my @ids; |
109 |
while ( ( $accdata = $sth->fetchrow_hashref ) and ( $amountleft > 0 ) ) { |
113 |
while ( ( $accdata = $sth->fetchrow_hashref ) and ( $amountleft > 0 ) ) { |
110 |
if ( $accdata->{'amountoutstanding'} < $amountleft ) { |
114 |
if ( $accdata->{'amountoutstanding'} < $amountleft ) { |
111 |
$newamtos = 0; |
115 |
$newamtos = 0; |
Lines 118-147
sub recordpayment {
Link Here
|
118 |
my $thisacct = $accdata->{accountlines_id}; |
122 |
my $thisacct = $accdata->{accountlines_id}; |
119 |
my $usth = $dbh->prepare( |
123 |
my $usth = $dbh->prepare( |
120 |
"UPDATE accountlines SET amountoutstanding= ? |
124 |
"UPDATE accountlines SET amountoutstanding= ? |
121 |
WHERE (accountlines_id = ?)" |
125 |
WHERE (accountlines_id = ?)" |
122 |
); |
126 |
); |
123 |
$usth->execute( $newamtos, $thisacct ); |
127 |
$usth->execute( $newamtos, $thisacct ); |
124 |
$usth->finish; |
128 |
|
125 |
# $usth = $dbh->prepare( |
129 |
if ( C4::Context->preference("FinesLog") ) { |
126 |
# "INSERT INTO accountoffsets |
130 |
$accdata->{'amountoutstanding_new'} = $newamtos; |
127 |
# (borrowernumber, accountno, offsetaccount, offsetamount) |
131 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
128 |
# VALUES (?,?,?,?)" |
132 |
action => 'fee_payment', |
129 |
# ); |
133 |
borrowernumber => $accdata->{'borrowernumber'}, |
130 |
# $usth->execute( $borrowernumber, $accdata->{'accountno'}, |
134 |
old_amountoutstanding => $accdata->{'amountoutstanding'}, |
131 |
# $nextaccntno, $newamtos ); |
135 |
new_amountoutstanding => $newamtos, |
132 |
$usth->finish; |
136 |
amount_paid => $accdata->{'amountoutstanding'} - $newamtos, |
|
|
137 |
accountlines_id => $accdata->{'accountlines_id'}, |
138 |
accountno => $accdata->{'accountno'}, |
139 |
})); |
140 |
push( @ids, $accdata->{'accountlines_id'} ); |
141 |
} |
133 |
} |
142 |
} |
134 |
|
143 |
|
135 |
# create new line |
144 |
# create new line |
136 |
my $usth = $dbh->prepare( |
145 |
my $usth = $dbh->prepare( |
137 |
"INSERT INTO accountlines |
146 |
"INSERT INTO accountlines |
138 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
147 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
139 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
148 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
140 |
); |
149 |
); |
141 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
150 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
142 |
$usth->finish; |
151 |
|
143 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
152 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
144 |
$sth->finish; |
153 |
|
|
|
154 |
if ( C4::Context->preference("FinesLog") ) { |
155 |
$accdata->{'amountoutstanding_new'} = $newamtos; |
156 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
157 |
action => 'create_payment', |
158 |
borrowernumber => $borrowernumber, |
159 |
accountno => $nextaccntno, |
160 |
amount => $data * -1, |
161 |
amountoutstanding => $amountleft * -1, |
162 |
accounttype => 'Pay', |
163 |
accountlines_paid => \@ids, |
164 |
})); |
165 |
} |
166 |
|
145 |
} |
167 |
} |
146 |
|
168 |
|
147 |
=head2 makepayment |
169 |
=head2 makepayment |
Lines 180-186
sub makepayment {
Link Here
|
180 |
my $data = $sth->fetchrow_hashref; |
202 |
my $data = $sth->fetchrow_hashref; |
181 |
$sth->finish; |
203 |
$sth->finish; |
182 |
|
204 |
|
183 |
if($data->{'accounttype'} eq "Pay"){ |
205 |
my $payment; |
|
|
206 |
if ( $data->{'accounttype'} eq "Pay" ){ |
184 |
my $udp = |
207 |
my $udp = |
185 |
$dbh->prepare( |
208 |
$dbh->prepare( |
186 |
"UPDATE accountlines |
209 |
"UPDATE accountlines |
Lines 190-196
sub makepayment {
Link Here
|
190 |
); |
213 |
); |
191 |
$udp->execute($accountlines_id); |
214 |
$udp->execute($accountlines_id); |
192 |
$udp->finish; |
215 |
$udp->finish; |
193 |
}else{ |
216 |
} else { |
194 |
my $udp = |
217 |
my $udp = |
195 |
$dbh->prepare( |
218 |
$dbh->prepare( |
196 |
"UPDATE accountlines |
219 |
"UPDATE accountlines |
Lines 201-208
sub makepayment {
Link Here
|
201 |
$udp->execute($accountlines_id); |
224 |
$udp->execute($accountlines_id); |
202 |
$udp->finish; |
225 |
$udp->finish; |
203 |
|
226 |
|
204 |
# create new line |
227 |
# create new line |
205 |
my $payment = 0 - $amount; |
228 |
$payment = 0 - $amount; |
206 |
|
229 |
|
207 |
my $ins = |
230 |
my $ins = |
208 |
$dbh->prepare( |
231 |
$dbh->prepare( |
Lines 214-225
sub makepayment {
Link Here
|
214 |
$ins->finish; |
237 |
$ins->finish; |
215 |
} |
238 |
} |
216 |
|
239 |
|
|
|
240 |
if ( C4::Context->preference("FinesLog") ) { |
241 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
242 |
action => 'fine_payment', |
243 |
borrowernumber => $borrowernumber, |
244 |
old_amountoutstanding => $data->{'amountoutstanding'}, |
245 |
new_amountoutstanding => 0, |
246 |
amount_paid => $data->{'amountoutstanding'}, |
247 |
accountlines_id => $data->{'accountlines_id'}, |
248 |
accountno => $data->{'accountno'}, |
249 |
})); |
250 |
|
251 |
|
252 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
253 |
action => 'create_payment', |
254 |
borrowernumber => $borrowernumber, |
255 |
accountno => $nextaccntno, |
256 |
amount => $payment, |
257 |
amountoutstanding => 0,, |
258 |
accounttype => 'Pay', |
259 |
accountlines_paid => [$data->{'accountlines_id'}], |
260 |
})); |
261 |
} |
262 |
|
263 |
|
217 |
# FIXME - The second argument to &UpdateStats is supposed to be the |
264 |
# FIXME - The second argument to &UpdateStats is supposed to be the |
218 |
# branch code. |
265 |
# branch code. |
219 |
# UpdateStats is now being passed $accountno too. MTJ |
266 |
# UpdateStats is now being passed $accountno too. MTJ |
220 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, |
267 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, |
221 |
$accountno ); |
268 |
$accountno ); |
222 |
#from perldoc: for SELECT only #$sth->finish; |
|
|
223 |
|
269 |
|
224 |
#check to see what accounttype |
270 |
#check to see what accounttype |
225 |
if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) { |
271 |
if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) { |
Lines 314-320
sub chargelostitem{
Link Here
|
314 |
$sth2->execute($borrowernumber,$accountno,$amount, |
360 |
$sth2->execute($borrowernumber,$accountno,$amount, |
315 |
$description,$amount,$itemnumber,$manager_id); |
361 |
$description,$amount,$itemnumber,$manager_id); |
316 |
$sth2->finish; |
362 |
$sth2->finish; |
317 |
# FIXME: Log this ? |
363 |
|
|
|
364 |
if ( C4::Context->preference("FinesLog") ) { |
365 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
366 |
action => 'create_fee', |
367 |
borrowernumber => $borrowernumber, |
368 |
accountno => $accountno, |
369 |
amount => $amount, |
370 |
amountoutstanding => $amount, |
371 |
description => $description, |
372 |
accounttype => 'L', |
373 |
itemnumber => $itemnumber, |
374 |
})); |
375 |
} |
376 |
|
318 |
} |
377 |
} |
319 |
} |
378 |
} |
320 |
|
379 |
|
Lines 396-414
sub manualinvoice {
Link Here
|
396 |
|
455 |
|
397 |
if ( $itemnum ) { |
456 |
if ( $itemnum ) { |
398 |
$desc .= ' ' . $itemnum; |
457 |
$desc .= ' ' . $itemnum; |
399 |
my $sth = $dbh->prepare( |
458 |
my $sth = $dbh->prepare(" |
400 |
'INSERT INTO accountlines |
459 |
INSERT INTO accountlines |
401 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
460 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
402 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
461 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?) |
403 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
462 |
"); |
404 |
} else { |
463 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
405 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
464 |
} else { |
|
|
465 |
my $sth=$dbh->prepare(" |
466 |
INSERT INTO accountlines |
406 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
467 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
407 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
468 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?) |
408 |
); |
469 |
"); |
409 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
470 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $notifyid, $note, $manager_id ); |
410 |
$amountleft, $notifyid, $note, $manager_id ); |
471 |
} |
|
|
472 |
|
473 |
if ( C4::Context->preference("FinesLog") ) { |
474 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
475 |
action => 'create_fee', |
476 |
borrowernumber => $borrowernumber, |
477 |
accountno => $accountno, |
478 |
amount => $amount, |
479 |
description => $desc, |
480 |
accounttype => $type, |
481 |
amountoutstanding => $amountleft, |
482 |
notify_id => $notifyid, |
483 |
note => $note, |
484 |
itemnumber => $itemnum |
485 |
})); |
411 |
} |
486 |
} |
|
|
487 |
|
412 |
return 0; |
488 |
return 0; |
413 |
} |
489 |
} |
414 |
|
490 |
|
Lines 653-659
sub ReversePayment {
Link Here
|
653 |
my ( $accountlines_id ) = @_; |
729 |
my ( $accountlines_id ) = @_; |
654 |
my $dbh = C4::Context->dbh; |
730 |
my $dbh = C4::Context->dbh; |
655 |
|
731 |
|
656 |
my $sth = $dbh->prepare('SELECT amountoutstanding FROM accountlines WHERE accountlines_id = ?'); |
732 |
my $sth = $dbh->prepare('SELECT * FROM accountlines WHERE accountlines_id = ?'); |
657 |
$sth->execute( $accountlines_id ); |
733 |
$sth->execute( $accountlines_id ); |
658 |
my $row = $sth->fetchrow_hashref(); |
734 |
my $row = $sth->fetchrow_hashref(); |
659 |
my $amount_outstanding = $row->{'amountoutstanding'}; |
735 |
my $amount_outstanding = $row->{'amountoutstanding'}; |
Lines 665-670
sub ReversePayment {
Link Here
|
665 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
741 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
666 |
$sth->execute( $accountlines_id ); |
742 |
$sth->execute( $accountlines_id ); |
667 |
} |
743 |
} |
|
|
744 |
|
745 |
if ( C4::Context->preference("FinesLog") ) { |
746 |
if ( $amount_outstanding <= 0 ) { |
747 |
$row->{'amountoutstanding'} *= -1; |
748 |
} else { |
749 |
$row->{'amountoutstanding'} = '0'; |
750 |
} |
751 |
$row->{'description'} .= ' Reversed -'; |
752 |
logaction("FINES", 'MODIFY', $row->{'borrowernumber'}, Dumper({ |
753 |
action => 'reverse_fee_payment', |
754 |
borrowernumber => $row->{'borrowernumber'}, |
755 |
old_amountoutstanding => $row->{'amountoutstanding'}, |
756 |
new_amountoutstanding => 0 - $amount_outstanding,, |
757 |
accountlines_id => $row->{'accountlines_id'}, |
758 |
accountno => $row->{'accountno'}, |
759 |
})); |
760 |
|
761 |
} |
762 |
|
668 |
} |
763 |
} |
669 |
|
764 |
|
670 |
=head2 recordpayment_selectaccts |
765 |
=head2 recordpayment_selectaccts |
Lines 707-714
sub recordpayment_selectaccts {
Link Here
|
707 |
my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber); |
802 |
my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber); |
708 |
|
803 |
|
709 |
# offset transactions |
804 |
# offset transactions |
710 |
my $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding= ? ' . |
805 |
my $sth = $dbh->prepare(" |
711 |
'WHERE accountlines_id=?'); |
806 |
UPDATE accountlines SET amountoutstanding = ? |
|
|
807 |
WHERE accountlines_id = ? |
808 |
"); |
809 |
|
810 |
my @ids; |
712 |
for my $accdata ( @{$rows} ) { |
811 |
for my $accdata ( @{$rows} ) { |
713 |
if ($amountleft == 0) { |
812 |
if ($amountleft == 0) { |
714 |
last; |
813 |
last; |
Lines 723-736
sub recordpayment_selectaccts {
Link Here
|
723 |
} |
822 |
} |
724 |
my $thisacct = $accdata->{accountlines_id}; |
823 |
my $thisacct = $accdata->{accountlines_id}; |
725 |
$sth->execute( $newamtos, $thisacct ); |
824 |
$sth->execute( $newamtos, $thisacct ); |
|
|
825 |
|
826 |
if ( C4::Context->preference("FinesLog") ) { |
827 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
828 |
action => 'fee_payment', |
829 |
borrowernumber => $borrowernumber, |
830 |
old_amountoutstanding => $accdata->{'amountoutstanding'}, |
831 |
new_amountoutstanding => $newamtos, |
832 |
amount_paid => $accdata->{'amountoutstanding'} - $newamtos, |
833 |
accountlines_id => $accdata->{'accountlines_id'}, |
834 |
accountno => $accdata->{'accountno'}, |
835 |
})); |
836 |
push( @ids, $accdata->{'accountlines_id'} ); |
837 |
} |
838 |
|
726 |
} |
839 |
} |
727 |
|
840 |
|
728 |
# create new line |
841 |
# create new line |
729 |
$sql = 'INSERT INTO accountlines ' . |
842 |
$sql = " |
730 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) ' . |
843 |
INSERT INTO accountlines |
731 |
q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)|; |
844 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
|
|
845 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?) |
846 |
"; |
732 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id ); |
847 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id ); |
733 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
848 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
|
|
849 |
|
850 |
if ( C4::Context->preference("FinesLog") ) { |
851 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
852 |
action => 'create_payment', |
853 |
borrowernumber => $borrowernumber, |
854 |
accountno => $nextaccntno, |
855 |
amount => 0 - $amount, |
856 |
amountoutstanding => 0 - $amountleft, |
857 |
accounttype => 'Pay', |
858 |
accountlines_paid => \@ids, |
859 |
})); |
860 |
} |
861 |
|
734 |
return; |
862 |
return; |
735 |
} |
863 |
} |
736 |
|
864 |
|
Lines 748-760
sub makepartialpayment {
Link Here
|
748 |
my $nextaccntno = getnextacctno($borrowernumber); |
876 |
my $nextaccntno = getnextacctno($borrowernumber); |
749 |
my $newamtos = 0; |
877 |
my $newamtos = 0; |
750 |
|
878 |
|
751 |
my $data = $dbh->selectrow_hashref( |
879 |
my $data = $dbh->selectrow_hashref('SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
752 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
|
|
753 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
880 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
754 |
|
881 |
|
755 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
882 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
756 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
883 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
757 |
|
884 |
|
|
|
885 |
if ( C4::Context->preference("FinesLog") ) { |
886 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
887 |
action => 'fee_payment', |
888 |
borrowernumber => $borrowernumber, |
889 |
old_amountoutstanding => $data->{'amountoutstanding'}, |
890 |
new_amountoutstanding => $new_outstanding, |
891 |
amount_paid => $data->{'amountoutstanding'} - $new_outstanding, |
892 |
accountlines_id => $data->{'accountlines_id'}, |
893 |
accountno => $data->{'accountno'}, |
894 |
})); |
895 |
} |
896 |
|
758 |
# create new line |
897 |
# create new line |
759 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
898 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
760 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' |
899 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' |
Lines 765-770
sub makepartialpayment {
Link Here
|
765 |
|
904 |
|
766 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
905 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
767 |
|
906 |
|
|
|
907 |
if ( C4::Context->preference("FinesLog") ) { |
908 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
909 |
action => 'create_payment', |
910 |
borrowernumber => $user, |
911 |
accountno => $nextaccntno, |
912 |
amount => 0 - $amount, |
913 |
accounttype => 'Pay', |
914 |
itemnumber => $data->{'itemnumber'}, |
915 |
accountlines_paid => [ $data->{'accountlines_id'} ], |
916 |
})); |
917 |
} |
918 |
|
768 |
return; |
919 |
return; |
769 |
} |
920 |
} |
770 |
|
921 |
|
Lines 783-789
C<$branch> is the branchcode of the library where the writeoff occurred.
Link Here
|
783 |
=cut |
934 |
=cut |
784 |
|
935 |
|
785 |
sub WriteOffFee { |
936 |
sub WriteOffFee { |
786 |
my ( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch ) = @_; |
937 |
my ( $borrowernumber, $accountlines_id, $itemnum, $accounttype, $amount, $branch ) = @_; |
787 |
$branch ||= C4::Context->userenv->{branch}; |
938 |
$branch ||= C4::Context->userenv->{branch}; |
788 |
my $manager_id = 0; |
939 |
my $manager_id = 0; |
789 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
940 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 799-805
sub WriteOffFee {
Link Here
|
799 |
WHERE accountlines_id = ? AND borrowernumber = ? |
950 |
WHERE accountlines_id = ? AND borrowernumber = ? |
800 |
"; |
951 |
"; |
801 |
$sth = $dbh->prepare( $query ); |
952 |
$sth = $dbh->prepare( $query ); |
802 |
$sth->execute( $accountline_id, $borrowernumber ); |
953 |
$sth->execute( $accountlines_id, $borrowernumber ); |
|
|
954 |
|
955 |
if ( C4::Context->preference("FinesLog") ) { |
956 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
957 |
action => 'fee_writeoff', |
958 |
borrowernumber => $borrowernumber, |
959 |
accountlines_id => $accountlines_id, |
960 |
})); |
961 |
} |
803 |
|
962 |
|
804 |
$query =" |
963 |
$query =" |
805 |
INSERT INTO accountlines |
964 |
INSERT INTO accountlines |
Lines 810-815
sub WriteOffFee {
Link Here
|
810 |
my $acct = getnextacctno($borrowernumber); |
969 |
my $acct = getnextacctno($borrowernumber); |
811 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); |
970 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); |
812 |
|
971 |
|
|
|
972 |
if ( C4::Context->preference("FinesLog") ) { |
973 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
974 |
action => 'create_writeoff', |
975 |
borrowernumber => $borrowernumber, |
976 |
accountno => $acct, |
977 |
amount => 0 - $amount, |
978 |
accounttype => 'W', |
979 |
itemnumber => $itemnum, |
980 |
accountlines_paid => [ $accountlines_id ], |
981 |
})); |
982 |
} |
983 |
|
813 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
984 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
814 |
|
985 |
|
815 |
} |
986 |
} |