Lines 38-44
BEGIN {
Link Here
|
38 |
@ISA = qw(Exporter); |
38 |
@ISA = qw(Exporter); |
39 |
@EXPORT = qw( |
39 |
@EXPORT = qw( |
40 |
&manualinvoice |
40 |
&manualinvoice |
41 |
&getnextacctno |
|
|
42 |
&chargelostitem |
41 |
&chargelostitem |
43 |
&purge_zero_balance_fees |
42 |
&purge_zero_balance_fees |
44 |
); |
43 |
); |
Lines 60-88
patron.
Link Here
|
60 |
|
59 |
|
61 |
=head1 FUNCTIONS |
60 |
=head1 FUNCTIONS |
62 |
|
61 |
|
63 |
=head2 getnextacctno |
|
|
64 |
|
65 |
$nextacct = &getnextacctno($borrowernumber); |
66 |
|
67 |
Returns the next unused account number for the patron with the given |
68 |
borrower number. |
69 |
|
70 |
=cut |
71 |
|
72 |
#' |
73 |
# FIXME - Okay, so what does the above actually _mean_? |
74 |
sub getnextacctno { |
75 |
my ($borrowernumber) = shift or return; |
76 |
my $sth = C4::Context->dbh->prepare( |
77 |
"SELECT accountno+1 FROM accountlines |
78 |
WHERE (borrowernumber = ?) |
79 |
ORDER BY accountno DESC |
80 |
LIMIT 1" |
81 |
); |
82 |
$sth->execute($borrowernumber); |
83 |
return ($sth->fetchrow || 1); |
84 |
} |
85 |
|
86 |
=head2 chargelostitem |
62 |
=head2 chargelostitem |
87 |
|
63 |
|
88 |
In a default install of Koha the following lost values are set |
64 |
In a default install of Koha the following lost values are set |
Lines 125-131
sub chargelostitem{
Link Here
|
125 |
my $accountline = Koha::Account::Line->new( |
101 |
my $accountline = Koha::Account::Line->new( |
126 |
{ |
102 |
{ |
127 |
borrowernumber => $borrowernumber, |
103 |
borrowernumber => $borrowernumber, |
128 |
accountno => getnextacctno($borrowernumber), |
|
|
129 |
date => \'NOW()', |
104 |
date => \'NOW()', |
130 |
amount => $processfee, |
105 |
amount => $processfee, |
131 |
description => $description, |
106 |
description => $description, |
Lines 149-155
sub chargelostitem{
Link Here
|
149 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
124 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
150 |
action => 'create_fee', |
125 |
action => 'create_fee', |
151 |
borrowernumber => $accountline->borrowernumber,, |
126 |
borrowernumber => $accountline->borrowernumber,, |
152 |
accountno => $accountline->accountno, |
|
|
153 |
amount => $accountline->amount, |
127 |
amount => $accountline->amount, |
154 |
description => $accountline->description, |
128 |
description => $accountline->description, |
155 |
accounttype => $accountline->accounttype, |
129 |
accounttype => $accountline->accounttype, |
Lines 165-171
sub chargelostitem{
Link Here
|
165 |
my $accountline = Koha::Account::Line->new( |
139 |
my $accountline = Koha::Account::Line->new( |
166 |
{ |
140 |
{ |
167 |
borrowernumber => $borrowernumber, |
141 |
borrowernumber => $borrowernumber, |
168 |
accountno => getnextacctno($borrowernumber), |
|
|
169 |
date => \'NOW()', |
142 |
date => \'NOW()', |
170 |
amount => $replacementprice, |
143 |
amount => $replacementprice, |
171 |
description => $description, |
144 |
description => $description, |
Lines 188-194
sub chargelostitem{
Link Here
|
188 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
161 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
189 |
action => 'create_fee', |
162 |
action => 'create_fee', |
190 |
borrowernumber => $accountline->borrowernumber,, |
163 |
borrowernumber => $accountline->borrowernumber,, |
191 |
accountno => $accountline->accountno, |
|
|
192 |
amount => $accountline->amount, |
164 |
amount => $accountline->amount, |
193 |
description => $accountline->description, |
165 |
description => $accountline->description, |
194 |
accounttype => $accountline->accounttype, |
166 |
accounttype => $accountline->accounttype, |
Lines 234-246
sub manualinvoice {
Link Here
|
234 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
206 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
235 |
my $dbh = C4::Context->dbh; |
207 |
my $dbh = C4::Context->dbh; |
236 |
my $insert; |
208 |
my $insert; |
237 |
my $accountno = getnextacctno($borrowernumber); |
|
|
238 |
my $amountleft = $amount; |
209 |
my $amountleft = $amount; |
239 |
|
210 |
|
240 |
my $accountline = Koha::Account::Line->new( |
211 |
my $accountline = Koha::Account::Line->new( |
241 |
{ |
212 |
{ |
242 |
borrowernumber => $borrowernumber, |
213 |
borrowernumber => $borrowernumber, |
243 |
accountno => $accountno, |
|
|
244 |
date => \'NOW()', |
214 |
date => \'NOW()', |
245 |
amount => $amount, |
215 |
amount => $amount, |
246 |
description => $desc, |
216 |
description => $desc, |
Lines 264-270
sub manualinvoice {
Link Here
|
264 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
234 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
265 |
action => 'create_fee', |
235 |
action => 'create_fee', |
266 |
borrowernumber => $borrowernumber, |
236 |
borrowernumber => $borrowernumber, |
267 |
accountno => $accountno, |
|
|
268 |
amount => $amount, |
237 |
amount => $amount, |
269 |
description => $desc, |
238 |
description => $desc, |
270 |
accounttype => $type, |
239 |
accounttype => $type, |