Lines 1875-1884
sub AddReturn {
Link Here
|
1875 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1875 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1876 |
|
1876 |
|
1877 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1877 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1878 |
# fix fine days |
1878 |
# fix fine days |
1879 |
my $debardate = |
1879 |
my ($debardate,$reminder) = _debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1880 |
_debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1880 |
if ($reminder){ |
1881 |
$messages->{Debarred} = $debardate if ($debardate); |
1881 |
$messages->{'PrevDebarred'} = $debardate; |
|
|
1882 |
} else { |
1883 |
$messages->{'Debarred'} = $debardate if $debardate; |
1884 |
} |
1885 |
# there's no overdue on the item but borrower had been previously debarred |
1886 |
} elsif ( $issue->{date_due} and $borrower->{'debarred'} ) { |
1887 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
1888 |
$borrower_debar_dt->truncate(to => 'day'); |
1889 |
my $today_dt = $today->clone()->truncate(to => 'day'); |
1890 |
if ( DateTime->compare( $borrower_debar_dt, $today_dt ) != -1 ) { |
1891 |
$messages->{'PrevDebarred'} = $borrower->{'debarred'}; |
1892 |
} |
1882 |
} |
1893 |
} |
1883 |
} |
1894 |
} |
1884 |
|
1895 |
|
Lines 2070-2076
sub _debar_user_on_return {
Link Here
|
2070 |
expiration => $new_debar_dt->ymd(), |
2081 |
expiration => $new_debar_dt->ymd(), |
2071 |
type => 'SUSPENSION', |
2082 |
type => 'SUSPENSION', |
2072 |
}); |
2083 |
}); |
2073 |
|
2084 |
# if borrower was already debarred but does not get an extra debarment |
|
|
2085 |
if ( $borrower->{debarred} eq Koha::Borrower::Debarments::IsDebarred($borrower->{borrowernumber}) ) { |
2086 |
return ($borrower->{debarred},1); |
2087 |
} |
2074 |
return $new_debar_dt->ymd(); |
2088 |
return $new_debar_dt->ymd(); |
2075 |
} |
2089 |
} |
2076 |
} |
2090 |
} |