Lines 132-213
sub chargelostitem {
Link Here
|
132 |
} |
132 |
} |
133 |
} |
133 |
} |
134 |
|
134 |
|
135 |
=head2 manualinvoice |
|
|
136 |
|
137 |
&manualinvoice($borrowernumber, $itemnumber, $description, $type, |
138 |
$amount, $note); |
139 |
|
140 |
This function is now deprecated and not used anywhere within koha. It is due for complete removal in 19.11 |
141 |
|
142 |
=cut |
143 |
|
144 |
sub manualinvoice { |
145 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
146 |
|
147 |
deprecated "C4::Accounts::manualinvoice is deprecated in favor of Koha::Account->add_debit"; |
148 |
|
149 |
my $manager_id = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef; |
150 |
my $dbh = C4::Context->dbh; |
151 |
my $amountleft = $amount; |
152 |
|
153 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
154 |
|
155 |
my $issue_id; |
156 |
if ( $type eq 'LOST' && $itemnum ) { |
157 |
my $checkouts = Koha::Checkouts->search( |
158 |
{ itemnumber => $itemnum, borrowernumber => $borrowernumber } ); |
159 |
my $checkout = |
160 |
$checkouts->count |
161 |
? $checkouts->next |
162 |
: Koha::Old::Checkouts->search( |
163 |
{ itemnumber => $itemnum, borrowernumber => $borrowernumber }, |
164 |
{ order_by => { -desc => 'returndate' }, rows => 1 } |
165 |
)->next; |
166 |
$issue_id = $checkout ? $checkout->issue_id : undef; |
167 |
} |
168 |
|
169 |
my $accountline = Koha::Account::Line->new( |
170 |
{ |
171 |
borrowernumber => $borrowernumber, |
172 |
date => \'NOW()', |
173 |
amount => $amount, |
174 |
description => $desc, |
175 |
debit_type_code => $type, |
176 |
amountoutstanding => $amountleft, |
177 |
itemnumber => $itemnum || undef, |
178 |
issue_id => $issue_id, |
179 |
note => $note, |
180 |
manager_id => $manager_id, |
181 |
interface => C4::Context->interface, |
182 |
branchcode => $branchcode, |
183 |
} |
184 |
)->store(); |
185 |
|
186 |
my $account_offset = Koha::Account::Offset->new( |
187 |
{ |
188 |
debit_id => $accountline->id, |
189 |
type => 'Manual Debit', |
190 |
amount => $amount, |
191 |
} |
192 |
)->store(); |
193 |
|
194 |
if ( C4::Context->preference("FinesLog") ) { |
195 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
196 |
action => 'create_fee', |
197 |
borrowernumber => $borrowernumber, |
198 |
amount => $amount, |
199 |
description => $desc, |
200 |
debit_type_code => $type, |
201 |
amountoutstanding => $amountleft, |
202 |
note => $note, |
203 |
itemnumber => $itemnum, |
204 |
manager_id => $manager_id, |
205 |
})); |
206 |
} |
207 |
|
208 |
return 0; |
209 |
} |
210 |
|
211 |
=head2 purge_zero_balance_fees |
135 |
=head2 purge_zero_balance_fees |
212 |
|
136 |
|
213 |
purge_zero_balance_fees( $days ); |
137 |
purge_zero_balance_fees( $days ); |