Lines 41-47
use C4::Koha qw(
Link Here
|
41 |
GetAuthValCode |
41 |
GetAuthValCode |
42 |
GetKohaAuthorisedValueLib |
42 |
GetKohaAuthorisedValueLib |
43 |
); |
43 |
); |
44 |
use C4::Overdues qw(CalcFine UpdateFine); |
44 |
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units); |
45 |
use C4::RotatingCollections qw(GetCollectionItemBranches); |
45 |
use C4::RotatingCollections qw(GetCollectionItemBranches); |
46 |
use Algorithm::CheckDigits; |
46 |
use Algorithm::CheckDigits; |
47 |
|
47 |
|
Lines 2135-2150
sub _debar_user_on_return {
Link Here
|
2135 |
my ( $borrower, $item, $dt_due, $dt_today ) = @_; |
2135 |
my ( $borrower, $item, $dt_due, $dt_today ) = @_; |
2136 |
|
2136 |
|
2137 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2137 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2138 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
|
|
2139 |
|
2140 |
# $deltadays is a DateTime::Duration object |
2141 |
my $deltadays = $calendar->days_between( $dt_due, $dt_today ); |
2142 |
|
2138 |
|
2143 |
my $circcontrol = C4::Context->preference('CircControl'); |
2139 |
my $circcontrol = C4::Context->preference('CircControl'); |
2144 |
my $issuingrule = |
2140 |
my $issuingrule = |
2145 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
2141 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
2146 |
my $finedays = $issuingrule->{finedays}; |
2142 |
my $finedays = $issuingrule->{finedays}; |
2147 |
my $unit = $issuingrule->{lengthunit}; |
2143 |
my $unit = $issuingrule->{lengthunit}; |
|
|
2144 |
my $chargeable_units = get_chargeable_units($unit, $dt_due, $dt_today, $branchcode); |
2148 |
|
2145 |
|
2149 |
if ($finedays) { |
2146 |
if ($finedays) { |
2150 |
|
2147 |
|
Lines 2156-2161
sub _debar_user_on_return {
Link Here
|
2156 |
my $grace = |
2153 |
my $grace = |
2157 |
DateTime::Duration->new( $unit => $issuingrule->{firstremind} ); |
2154 |
DateTime::Duration->new( $unit => $issuingrule->{firstremind} ); |
2158 |
|
2155 |
|
|
|
2156 |
my $deltadays = DateTime::Duration->new( |
2157 |
days => $chargeable_units |
2158 |
); |
2159 |
if ( $deltadays->subtract($grace)->is_positive() ) { |
2159 |
if ( $deltadays->subtract($grace)->is_positive() ) { |
2160 |
my $suspension_days = $deltadays * $finedays; |
2160 |
my $suspension_days = $deltadays * $finedays; |
2161 |
|
2161 |
|