Lines 145-150
sub chargelostitem{
Link Here
|
145 |
$replacementprice = $defaultreplacecost; |
145 |
$replacementprice = $defaultreplacecost; |
146 |
} |
146 |
} |
147 |
# first make sure the borrower hasn't already been charged for this item |
147 |
# first make sure the borrower hasn't already been charged for this item |
|
|
148 |
# FIXME this should be more exact |
149 |
# there is no reason a user can't lose an item, find and return it, and lost it again |
148 |
my $existing_charges = Koha::Account::Lines->search( |
150 |
my $existing_charges = Koha::Account::Lines->search( |
149 |
{ |
151 |
{ |
150 |
borrowernumber => $borrowernumber, |
152 |
borrowernumber => $borrowernumber, |
Lines 155-203
sub chargelostitem{
Link Here
|
155 |
|
157 |
|
156 |
# OK, they haven't |
158 |
# OK, they haven't |
157 |
unless ($existing_charges) { |
159 |
unless ($existing_charges) { |
158 |
my $manager_id = 0; |
|
|
159 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
160 |
# This item is on issue ... add replacement cost to the borrower's record and mark it returned |
161 |
# Note that we add this to the account even if there's no replacement price, allowing some other |
162 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
163 |
my $accountno = getnextacctno($borrowernumber); |
164 |
|
165 |
my $accountline = Koha::Account::Line->new( |
166 |
{ |
167 |
borrowernumber => $borrowernumber, |
168 |
accountno => $accountno, |
169 |
date => \'NOW()', |
170 |
amount => $amount, |
171 |
description => $description, |
172 |
accounttype => 'L', |
173 |
amountoutstanding => $amount, |
174 |
itemnumber => $itemnumber, |
175 |
manager_id => $manager_id, |
176 |
} |
177 |
)->store(); |
178 |
|
179 |
my $account_offset = Koha::Account::Offset->new( |
180 |
{ |
181 |
debit_id => $accountline->id, |
182 |
type => 'Lost Item', |
183 |
amount => $amount, |
184 |
} |
185 |
)->store(); |
186 |
|
187 |
if ( C4::Context->preference("FinesLog") ) { |
188 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
189 |
action => 'create_fee', |
190 |
borrowernumber => $borrowernumber, |
191 |
accountno => $accountno, |
192 |
amount => $amount, |
193 |
amountoutstanding => $amount, |
194 |
description => $description, |
195 |
accounttype => 'L', |
196 |
itemnumber => $itemnumber, |
197 |
manager_id => $manager_id, |
198 |
})); |
199 |
} |
200 |
|
201 |
#add processing fee |
160 |
#add processing fee |
202 |
if ($processfee && $processfee > 0){ |
161 |
if ($processfee && $processfee > 0){ |
203 |
manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1); |
162 |
manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1); |
204 |
- |
|
|