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 2136-2151
sub _debar_user_on_return {
Link Here
|
2136 |
my ( $borrower, $item, $dt_due, $dt_today ) = @_; |
2136 |
my ( $borrower, $item, $dt_due, $dt_today ) = @_; |
2137 |
|
2137 |
|
2138 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2138 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2139 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
|
|
2140 |
|
2141 |
# $deltadays is a DateTime::Duration object |
2142 |
my $deltadays = $calendar->days_between( $dt_due, $dt_today ); |
2143 |
|
2139 |
|
2144 |
my $circcontrol = C4::Context->preference('CircControl'); |
2140 |
my $circcontrol = C4::Context->preference('CircControl'); |
2145 |
my $issuingrule = |
2141 |
my $issuingrule = |
2146 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
2142 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
2147 |
my $finedays = $issuingrule->{finedays}; |
2143 |
my $finedays = $issuingrule->{finedays}; |
2148 |
my $unit = $issuingrule->{lengthunit}; |
2144 |
my $unit = $issuingrule->{lengthunit}; |
|
|
2145 |
my $chargeable_units = get_chargeable_units($unit, $dt_due, $dt_today, $branchcode); |
2149 |
|
2146 |
|
2150 |
if ($finedays) { |
2147 |
if ($finedays) { |
2151 |
|
2148 |
|
Lines 2157-2162
sub _debar_user_on_return {
Link Here
|
2157 |
my $grace = |
2154 |
my $grace = |
2158 |
DateTime::Duration->new( $unit => $issuingrule->{firstremind} ); |
2155 |
DateTime::Duration->new( $unit => $issuingrule->{firstremind} ); |
2159 |
|
2156 |
|
|
|
2157 |
my $deltadays = DateTime::Duration->new( |
2158 |
days => $chargeable_units |
2159 |
); |
2160 |
if ( $deltadays->subtract($grace)->is_positive() ) { |
2160 |
if ( $deltadays->subtract($grace)->is_positive() ) { |
2161 |
my $suspension_days = $deltadays * $finedays; |
2161 |
my $suspension_days = $deltadays * $finedays; |
2162 |
|
2162 |
|