Lines 36-41
use Koha::DateUtils;
Link Here
|
36 |
use Koha::Account::Lines; |
36 |
use Koha::Account::Lines; |
37 |
use Koha::Account::Offsets; |
37 |
use Koha::Account::Offsets; |
38 |
use Koha::Libraries; |
38 |
use Koha::Libraries; |
|
|
39 |
use Koha::Recalls; |
39 |
|
40 |
|
40 |
use vars qw(@ISA @EXPORT); |
41 |
use vars qw(@ISA @EXPORT); |
41 |
|
42 |
|
Lines 243-248
sub CalcFine {
Link Here
|
243 |
'fine', |
244 |
'fine', |
244 |
'overduefinescap', |
245 |
'overduefinescap', |
245 |
'cap_fine_to_replacement_price', |
246 |
'cap_fine_to_replacement_price', |
|
|
247 |
'recall_overdue_fine', |
246 |
] |
248 |
] |
247 |
} |
249 |
} |
248 |
); |
250 |
); |
Lines 262-268
sub CalcFine {
Link Here
|
262 |
# If chargeperiod_charge_at = 1, we charge a fine at the start of each charge period |
264 |
# If chargeperiod_charge_at = 1, we charge a fine at the start of each charge period |
263 |
# if chargeperiod_charge_at = 0, we charge at the end of each charge period |
265 |
# if chargeperiod_charge_at = 0, we charge at the end of each charge period |
264 |
$charge_periods = defined $issuing_rule->{chargeperiod_charge_at} && $issuing_rule->{chargeperiod_charge_at} == 1 ? ceil($charge_periods) : floor($charge_periods); |
266 |
$charge_periods = defined $issuing_rule->{chargeperiod_charge_at} && $issuing_rule->{chargeperiod_charge_at} == 1 ? ceil($charge_periods) : floor($charge_periods); |
265 |
$amount = $charge_periods * $issuing_rule->{fine}; |
267 |
|
|
|
268 |
# check if item has been recalled. recall should have been marked Overdue by cronjob, so only look at overdue recalls |
269 |
# only charge using recall_overdue_fine if there is an item-level recall for this particular item, OR a biblio-level recall |
270 |
my @recalls = Koha::Recalls->search({ biblionumber => $item->{biblionumber}, old => undef, status => 'O' }); |
271 |
my $bib_level_recall = 1 if scalar @recalls > 0; |
272 |
foreach my $recall ( @recalls ) { |
273 |
if ( $recall->item_level_recall and $recall->itemnumber == $item->{itemnumber} and $issuing_rule->{recall_overdue_fine} ) { |
274 |
$bib_level_recall = 0; |
275 |
$amount = $charge_periods * $issuing_rule->{recall_overdue_fine}; |
276 |
last; |
277 |
} |
278 |
} |
279 |
if ( $bib_level_recall and $issuing_rule->{recall_overdue_fine} ) { |
280 |
# biblio-level recall |
281 |
$amount = $charge_periods * $issuing_rule->{recall_overdue_fine}; |
282 |
} |
283 |
if ( scalar @recalls == 0 ) { |
284 |
# no recall, use normal fine amount |
285 |
$amount = $charge_periods * $issuing_rule->{fine}; |
286 |
} |
266 |
} # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. } |
287 |
} # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. } |
267 |
|
288 |
|
268 |
$amount = $issuing_rule->{overduefinescap} if $issuing_rule->{overduefinescap} && $amount > $issuing_rule->{overduefinescap}; |
289 |
$amount = $issuing_rule->{overduefinescap} if $issuing_rule->{overduefinescap} && $amount > $issuing_rule->{overduefinescap}; |