Lines 1832-1843
sub AddReturn {
Link Here
|
1832 |
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); |
1832 |
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); |
1833 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1833 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1834 |
|
1834 |
|
1835 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1835 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1836 |
# fix fine days |
1836 |
# fix fine days |
1837 |
my $debardate = |
1837 |
my ($debardate,$reminder) = _debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1838 |
_debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1838 |
if ($reminder){ |
1839 |
$messages->{Debarred} = $debardate if ($debardate); |
1839 |
$messages->{'PrevDebarred'} = $debardate; |
1840 |
} |
1840 |
} else { |
|
|
1841 |
$messages->{'Debarred'} = $debardate if $debardate; |
1842 |
} |
1843 |
} elsif ( $issue->{date_due} and $borrower->{'debarred'} ) { |
1844 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
1845 |
$borrower_debar_dt->truncate(to => 'day'); |
1846 |
my $today_dt = $today->clone()->truncate(to => 'day'); |
1847 |
if ( DateTime->compare( $borrower_debar_dt, $today_dt ) != -1 ) { |
1848 |
$messages->{'PrevDebarred'} = $borrower->{'debarred'}; |
1849 |
} |
1850 |
} |
1841 |
} |
1851 |
} |
1842 |
|
1852 |
|
1843 |
# find reserves..... |
1853 |
# find reserves..... |
Lines 2012-2023
sub _debar_user_on_return {
Link Here
|
2012 |
$dt_today->clone()->add_duration( $deltadays * $finedays ); |
2022 |
$dt_today->clone()->add_duration( $deltadays * $finedays ); |
2013 |
if ( $borrower->{debarred} ) { |
2023 |
if ( $borrower->{debarred} ) { |
2014 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
2024 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
2015 |
|
2025 |
$borrower_debar_dt->truncate(to => 'day'); |
|
|
2026 |
$new_debar_dt->truncate(to=>'day'); |
2016 |
# Update patron only if new date > old |
2027 |
# Update patron only if new date > old |
2017 |
if ( DateTime->compare( $borrower_debar_dt, $new_debar_dt ) != |
2028 |
if ( DateTime->compare( $borrower_debar_dt, $new_debar_dt ) != |
2018 |
-1 ) |
2029 |
-1 ) |
2019 |
{ |
2030 |
{ |
2020 |
return; |
2031 |
return ($borrower_debar_dt,1); |
2021 |
} |
2032 |
} |
2022 |
|
2033 |
|
2023 |
} |
2034 |
} |