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 |
manager_id => $manager_id, |
140 |
})); |
141 |
push( @ids, $accdata->{'accountlines_id'} ); |
142 |
} |
133 |
} |
143 |
} |
134 |
|
144 |
|
135 |
# create new line |
145 |
# create new line |
136 |
my $usth = $dbh->prepare( |
146 |
my $usth = $dbh->prepare( |
137 |
"INSERT INTO accountlines |
147 |
"INSERT INTO accountlines |
138 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
148 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
139 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
149 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
140 |
); |
150 |
); |
141 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
151 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
142 |
$usth->finish; |
152 |
|
143 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
153 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
144 |
$sth->finish; |
154 |
|
|
|
155 |
if ( C4::Context->preference("FinesLog") ) { |
156 |
$accdata->{'amountoutstanding_new'} = $newamtos; |
157 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
158 |
action => 'create_payment', |
159 |
borrowernumber => $borrowernumber, |
160 |
accountno => $nextaccntno, |
161 |
amount => $data * -1, |
162 |
amountoutstanding => $amountleft * -1, |
163 |
accounttype => 'Pay', |
164 |
accountlines_paid => \@ids, |
165 |
manager_id => $manager_id, |
166 |
})); |
167 |
} |
168 |
|
145 |
} |
169 |
} |
146 |
|
170 |
|
147 |
=head2 makepayment |
171 |
=head2 makepayment |
Lines 180-186
sub makepayment {
Link Here
|
180 |
my $data = $sth->fetchrow_hashref; |
204 |
my $data = $sth->fetchrow_hashref; |
181 |
$sth->finish; |
205 |
$sth->finish; |
182 |
|
206 |
|
183 |
if($data->{'accounttype'} eq "Pay"){ |
207 |
my $payment; |
|
|
208 |
if ( $data->{'accounttype'} eq "Pay" ){ |
184 |
my $udp = |
209 |
my $udp = |
185 |
$dbh->prepare( |
210 |
$dbh->prepare( |
186 |
"UPDATE accountlines |
211 |
"UPDATE accountlines |
Lines 190-196
sub makepayment {
Link Here
|
190 |
); |
215 |
); |
191 |
$udp->execute($accountlines_id); |
216 |
$udp->execute($accountlines_id); |
192 |
$udp->finish; |
217 |
$udp->finish; |
193 |
}else{ |
218 |
} else { |
194 |
my $udp = |
219 |
my $udp = |
195 |
$dbh->prepare( |
220 |
$dbh->prepare( |
196 |
"UPDATE accountlines |
221 |
"UPDATE accountlines |
Lines 201-208
sub makepayment {
Link Here
|
201 |
$udp->execute($accountlines_id); |
226 |
$udp->execute($accountlines_id); |
202 |
$udp->finish; |
227 |
$udp->finish; |
203 |
|
228 |
|
204 |
# create new line |
229 |
# create new line |
205 |
my $payment = 0 - $amount; |
230 |
$payment = 0 - $amount; |
206 |
|
231 |
|
207 |
my $ins = |
232 |
my $ins = |
208 |
$dbh->prepare( |
233 |
$dbh->prepare( |
Lines 214-225
sub makepayment {
Link Here
|
214 |
$ins->finish; |
239 |
$ins->finish; |
215 |
} |
240 |
} |
216 |
|
241 |
|
|
|
242 |
if ( C4::Context->preference("FinesLog") ) { |
243 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
244 |
action => 'fee_payment', |
245 |
borrowernumber => $borrowernumber, |
246 |
old_amountoutstanding => $data->{'amountoutstanding'}, |
247 |
new_amountoutstanding => 0, |
248 |
amount_paid => $data->{'amountoutstanding'}, |
249 |
accountlines_id => $data->{'accountlines_id'}, |
250 |
accountno => $data->{'accountno'}, |
251 |
manager_id => $manager_id, |
252 |
})); |
253 |
|
254 |
|
255 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
256 |
action => 'create_payment', |
257 |
borrowernumber => $borrowernumber, |
258 |
accountno => $nextaccntno, |
259 |
amount => $payment, |
260 |
amountoutstanding => 0,, |
261 |
accounttype => 'Pay', |
262 |
accountlines_paid => [$data->{'accountlines_id'}], |
263 |
manager_id => $manager_id, |
264 |
})); |
265 |
} |
266 |
|
267 |
|
217 |
# FIXME - The second argument to &UpdateStats is supposed to be the |
268 |
# FIXME - The second argument to &UpdateStats is supposed to be the |
218 |
# branch code. |
269 |
# branch code. |
219 |
# UpdateStats is now being passed $accountno too. MTJ |
270 |
# UpdateStats is now being passed $accountno too. MTJ |
220 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, |
271 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, |
221 |
$accountno ); |
272 |
$accountno ); |
222 |
#from perldoc: for SELECT only #$sth->finish; |
|
|
223 |
|
273 |
|
224 |
#check to see what accounttype |
274 |
#check to see what accounttype |
225 |
if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) { |
275 |
if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) { |
Lines 314-320
sub chargelostitem{
Link Here
|
314 |
$sth2->execute($borrowernumber,$accountno,$amount, |
364 |
$sth2->execute($borrowernumber,$accountno,$amount, |
315 |
$description,$amount,$itemnumber,$manager_id); |
365 |
$description,$amount,$itemnumber,$manager_id); |
316 |
$sth2->finish; |
366 |
$sth2->finish; |
317 |
# FIXME: Log this ? |
367 |
|
|
|
368 |
if ( C4::Context->preference("FinesLog") ) { |
369 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
370 |
action => 'create_fee', |
371 |
borrowernumber => $borrowernumber, |
372 |
accountno => $accountno, |
373 |
amount => $amount, |
374 |
amountoutstanding => $amount, |
375 |
description => $description, |
376 |
accounttype => 'L', |
377 |
itemnumber => $itemnumber, |
378 |
manager_id => $manager_id, |
379 |
})); |
380 |
} |
381 |
|
318 |
} |
382 |
} |
319 |
} |
383 |
} |
320 |
|
384 |
|
Lines 396-414
sub manualinvoice {
Link Here
|
396 |
|
460 |
|
397 |
if ( $itemnum ) { |
461 |
if ( $itemnum ) { |
398 |
$desc .= ' ' . $itemnum; |
462 |
$desc .= ' ' . $itemnum; |
399 |
my $sth = $dbh->prepare( |
463 |
my $sth = $dbh->prepare(" |
400 |
'INSERT INTO accountlines |
464 |
INSERT INTO accountlines |
401 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
465 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
402 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
466 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?) |
403 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
467 |
"); |
404 |
} else { |
468 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
405 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
469 |
} else { |
|
|
470 |
my $sth=$dbh->prepare(" |
471 |
INSERT INTO accountlines |
406 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
472 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
407 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
473 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?) |
408 |
); |
474 |
"); |
409 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
475 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $notifyid, $note, $manager_id ); |
410 |
$amountleft, $notifyid, $note, $manager_id ); |
|
|
411 |
} |
476 |
} |
|
|
477 |
|
478 |
if ( C4::Context->preference("FinesLog") ) { |
479 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
480 |
action => 'create_fee', |
481 |
borrowernumber => $borrowernumber, |
482 |
accountno => $accountno, |
483 |
amount => $amount, |
484 |
description => $desc, |
485 |
accounttype => $type, |
486 |
amountoutstanding => $amountleft, |
487 |
notify_id => $notifyid, |
488 |
note => $note, |
489 |
itemnumber => $itemnum, |
490 |
manager_id => $manager_id, |
491 |
})); |
492 |
} |
493 |
|
412 |
return 0; |
494 |
return 0; |
413 |
} |
495 |
} |
414 |
|
496 |
|
Lines 653-659
sub ReversePayment {
Link Here
|
653 |
my ( $accountlines_id ) = @_; |
735 |
my ( $accountlines_id ) = @_; |
654 |
my $dbh = C4::Context->dbh; |
736 |
my $dbh = C4::Context->dbh; |
655 |
|
737 |
|
656 |
my $sth = $dbh->prepare('SELECT amountoutstanding FROM accountlines WHERE accountlines_id = ?'); |
738 |
my $sth = $dbh->prepare('SELECT * FROM accountlines WHERE accountlines_id = ?'); |
657 |
$sth->execute( $accountlines_id ); |
739 |
$sth->execute( $accountlines_id ); |
658 |
my $row = $sth->fetchrow_hashref(); |
740 |
my $row = $sth->fetchrow_hashref(); |
659 |
my $amount_outstanding = $row->{'amountoutstanding'}; |
741 |
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 = ?'); |
747 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
666 |
$sth->execute( $accountlines_id ); |
748 |
$sth->execute( $accountlines_id ); |
667 |
} |
749 |
} |
|
|
750 |
|
751 |
if ( C4::Context->preference("FinesLog") ) { |
752 |
my $manager_id = 0; |
753 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
754 |
|
755 |
if ( $amount_outstanding <= 0 ) { |
756 |
$row->{'amountoutstanding'} *= -1; |
757 |
} else { |
758 |
$row->{'amountoutstanding'} = '0'; |
759 |
} |
760 |
$row->{'description'} .= ' Reversed -'; |
761 |
logaction("FINES", 'MODIFY', $row->{'borrowernumber'}, Dumper({ |
762 |
action => 'reverse_fee_payment', |
763 |
borrowernumber => $row->{'borrowernumber'}, |
764 |
old_amountoutstanding => $row->{'amountoutstanding'}, |
765 |
new_amountoutstanding => 0 - $amount_outstanding,, |
766 |
accountlines_id => $row->{'accountlines_id'}, |
767 |
accountno => $row->{'accountno'}, |
768 |
manager_id => $manager_id, |
769 |
})); |
770 |
|
771 |
} |
772 |
|
668 |
} |
773 |
} |
669 |
|
774 |
|
670 |
=head2 recordpayment_selectaccts |
775 |
=head2 recordpayment_selectaccts |
Lines 707-714
sub recordpayment_selectaccts {
Link Here
|
707 |
my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber); |
812 |
my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber); |
708 |
|
813 |
|
709 |
# offset transactions |
814 |
# offset transactions |
710 |
my $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding= ? ' . |
815 |
my $sth = $dbh->prepare(" |
711 |
'WHERE accountlines_id=?'); |
816 |
UPDATE accountlines SET amountoutstanding = ? |
|
|
817 |
WHERE accountlines_id = ? |
818 |
"); |
819 |
|
820 |
my @ids; |
712 |
for my $accdata ( @{$rows} ) { |
821 |
for my $accdata ( @{$rows} ) { |
713 |
if ($amountleft == 0) { |
822 |
if ($amountleft == 0) { |
714 |
last; |
823 |
last; |
Lines 723-736
sub recordpayment_selectaccts {
Link Here
|
723 |
} |
832 |
} |
724 |
my $thisacct = $accdata->{accountlines_id}; |
833 |
my $thisacct = $accdata->{accountlines_id}; |
725 |
$sth->execute( $newamtos, $thisacct ); |
834 |
$sth->execute( $newamtos, $thisacct ); |
|
|
835 |
|
836 |
if ( C4::Context->preference("FinesLog") ) { |
837 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
838 |
action => 'fee_payment', |
839 |
borrowernumber => $borrowernumber, |
840 |
old_amountoutstanding => $accdata->{'amountoutstanding'}, |
841 |
new_amountoutstanding => $newamtos, |
842 |
amount_paid => $accdata->{'amountoutstanding'} - $newamtos, |
843 |
accountlines_id => $accdata->{'accountlines_id'}, |
844 |
accountno => $accdata->{'accountno'}, |
845 |
manager_id => $manager_id, |
846 |
})); |
847 |
push( @ids, $accdata->{'accountlines_id'} ); |
848 |
} |
849 |
|
726 |
} |
850 |
} |
727 |
|
851 |
|
728 |
# create new line |
852 |
# create new line |
729 |
$sql = 'INSERT INTO accountlines ' . |
853 |
$sql = " |
730 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) ' . |
854 |
INSERT INTO accountlines |
731 |
q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)|; |
855 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
|
|
856 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?) |
857 |
"; |
732 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id ); |
858 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id ); |
733 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
859 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
|
|
860 |
|
861 |
if ( C4::Context->preference("FinesLog") ) { |
862 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
863 |
action => 'create_payment', |
864 |
borrowernumber => $borrowernumber, |
865 |
accountno => $nextaccntno, |
866 |
amount => 0 - $amount, |
867 |
amountoutstanding => 0 - $amountleft, |
868 |
accounttype => 'Pay', |
869 |
accountlines_paid => \@ids, |
870 |
manager_id => $manager_id, |
871 |
})); |
872 |
} |
873 |
|
734 |
return; |
874 |
return; |
735 |
} |
875 |
} |
736 |
|
876 |
|
Lines 748-760
sub makepartialpayment {
Link Here
|
748 |
my $nextaccntno = getnextacctno($borrowernumber); |
888 |
my $nextaccntno = getnextacctno($borrowernumber); |
749 |
my $newamtos = 0; |
889 |
my $newamtos = 0; |
750 |
|
890 |
|
751 |
my $data = $dbh->selectrow_hashref( |
891 |
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; |
892 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
754 |
|
893 |
|
755 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
894 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
756 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
895 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
757 |
|
896 |
|
|
|
897 |
if ( C4::Context->preference("FinesLog") ) { |
898 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
899 |
action => 'fee_payment', |
900 |
borrowernumber => $borrowernumber, |
901 |
old_amountoutstanding => $data->{'amountoutstanding'}, |
902 |
new_amountoutstanding => $new_outstanding, |
903 |
amount_paid => $data->{'amountoutstanding'} - $new_outstanding, |
904 |
accountlines_id => $data->{'accountlines_id'}, |
905 |
accountno => $data->{'accountno'}, |
906 |
manager_id => $manager_id, |
907 |
})); |
908 |
} |
909 |
|
758 |
# create new line |
910 |
# create new line |
759 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
911 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
760 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' |
912 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' |
Lines 765-770
sub makepartialpayment {
Link Here
|
765 |
|
917 |
|
766 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
918 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
767 |
|
919 |
|
|
|
920 |
if ( C4::Context->preference("FinesLog") ) { |
921 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
922 |
action => 'create_payment', |
923 |
borrowernumber => $user, |
924 |
accountno => $nextaccntno, |
925 |
amount => 0 - $amount, |
926 |
accounttype => 'Pay', |
927 |
itemnumber => $data->{'itemnumber'}, |
928 |
accountlines_paid => [ $data->{'accountlines_id'} ], |
929 |
manager_id => $manager_id, |
930 |
})); |
931 |
} |
932 |
|
768 |
return; |
933 |
return; |
769 |
} |
934 |
} |
770 |
|
935 |
|
Lines 783-789
C<$branch> is the branchcode of the library where the writeoff occurred.
Link Here
|
783 |
=cut |
948 |
=cut |
784 |
|
949 |
|
785 |
sub WriteOffFee { |
950 |
sub WriteOffFee { |
786 |
my ( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch ) = @_; |
951 |
my ( $borrowernumber, $accountlines_id, $itemnum, $accounttype, $amount, $branch ) = @_; |
787 |
$branch ||= C4::Context->userenv->{branch}; |
952 |
$branch ||= C4::Context->userenv->{branch}; |
788 |
my $manager_id = 0; |
953 |
my $manager_id = 0; |
789 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
954 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 799-805
sub WriteOffFee {
Link Here
|
799 |
WHERE accountlines_id = ? AND borrowernumber = ? |
964 |
WHERE accountlines_id = ? AND borrowernumber = ? |
800 |
"; |
965 |
"; |
801 |
$sth = $dbh->prepare( $query ); |
966 |
$sth = $dbh->prepare( $query ); |
802 |
$sth->execute( $accountline_id, $borrowernumber ); |
967 |
$sth->execute( $accountlines_id, $borrowernumber ); |
|
|
968 |
|
969 |
if ( C4::Context->preference("FinesLog") ) { |
970 |
logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ |
971 |
action => 'fee_writeoff', |
972 |
borrowernumber => $borrowernumber, |
973 |
accountlines_id => $accountlines_id, |
974 |
manager_id => $manager_id, |
975 |
})); |
976 |
} |
803 |
|
977 |
|
804 |
$query =" |
978 |
$query =" |
805 |
INSERT INTO accountlines |
979 |
INSERT INTO accountlines |
Lines 810-815
sub WriteOffFee {
Link Here
|
810 |
my $acct = getnextacctno($borrowernumber); |
984 |
my $acct = getnextacctno($borrowernumber); |
811 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); |
985 |
$sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); |
812 |
|
986 |
|
|
|
987 |
if ( C4::Context->preference("FinesLog") ) { |
988 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
989 |
action => 'create_writeoff', |
990 |
borrowernumber => $borrowernumber, |
991 |
accountno => $acct, |
992 |
amount => 0 - $amount, |
993 |
accounttype => 'W', |
994 |
itemnumber => $itemnum, |
995 |
accountlines_paid => [ $accountlines_id ], |
996 |
manager_id => $manager_id, |
997 |
})); |
998 |
} |
999 |
|
813 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
1000 |
UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); |
814 |
|
1001 |
|
815 |
} |
1002 |
} |