GetAuthValCode
GetKohaAuthorisedValueLib
);
-use C4::Overdues qw(CalcFine UpdateFine);
+use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
use C4::RotatingCollections qw(GetCollectionItemBranches);
use Algorithm::CheckDigits;
my ( $borrower, $item, $dt_due, $dt_today ) = @_;
my $branchcode = _GetCircControlBranch( $item, $borrower );
- my $calendar = Koha::Calendar->new( branchcode => $branchcode );
-
- # $deltadays is a DateTime::Duration object
- my $deltadays = $calendar->days_between( $dt_due, $dt_today );
my $circcontrol = C4::Context->preference('CircControl');
my $issuingrule =
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode );
my $finedays = $issuingrule->{finedays};
my $unit = $issuingrule->{lengthunit};
+ my $chargeable_units = get_chargeable_units($unit, $dt_due, $dt_today, $branchcode);
if ($finedays) {
my $grace =
DateTime::Duration->new( $unit => $issuingrule->{firstremind} );
+ my $deltadays = DateTime::Duration->new(
+ days => $chargeable_units
+ );
if ( $deltadays->subtract($grace)->is_positive() ) {
my $suspension_days = $deltadays * $finedays;
&AmountNotify
&UpdateFine
&GetFine
-
+ &get_chargeable_units
&CheckItemNotify
&GetOverduesForBranch
&RemoveNotifyLine
my $fine_unit = $data->{lengthunit};
$fine_unit ||= 'days';
- my $chargeable_units = _get_chargeable_units($fine_unit, $start_date, $end_date, $branchcode);
+ my $chargeable_units = get_chargeable_units($fine_unit, $start_date, $end_date, $branchcode);
my $units_minus_grace = $chargeable_units - $data->{firstremind};
my $amount = 0;
if ($data->{'chargeperiod'} && ($units_minus_grace > 0) ) {
}
-=head2 _get_chargeable_units
+=head2 get_chargeable_units
- _get_chargeable_units($unit, $start_date_ $end_date, $branchcode);
+ get_chargeable_units($unit, $start_date_ $end_date, $branchcode);
return integer value of units between C<$start_date> and C<$end_date>, factoring in holidays for C<$branchcode>.
=cut
-sub _get_chargeable_units {
+sub get_chargeable_units {
my ($unit, $date_due, $date_returned, $branchcode) = @_;
# If the due date is later than the return date