Lines 1873-1883
sub AddReturn {
Link Here
|
1873 |
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); |
1873 |
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); |
1874 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1874 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1875 |
|
1875 |
|
1876 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1876 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1877 |
# fix fine days |
1877 |
# fix fine days |
1878 |
my $debardate = |
1878 |
my ($debardate,$reminder) = _debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1879 |
_debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1879 |
if ($reminder){ |
1880 |
$messages->{Debarred} = $debardate if ($debardate); |
1880 |
$messages->{'PrevDebarred'} = $debardate; |
|
|
1881 |
} else { |
1882 |
$messages->{'Debarred'} = $debardate if $debardate; |
1883 |
} |
1884 |
} elsif ( $issue->{date_due} and $borrower->{'debarred'} ) { |
1885 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
1886 |
$borrower_debar_dt->truncate(to => 'day'); |
1887 |
my $today_dt = $today->clone()->truncate(to => 'day'); |
1888 |
if ( DateTime->compare( $borrower_debar_dt, $today_dt ) != -1 ) { |
1889 |
$messages->{'PrevDebarred'} = $borrower->{'debarred'}; |
1890 |
} |
1881 |
} |
1891 |
} |
1882 |
} |
1892 |
} |
1883 |
|
1893 |
|
Lines 2054-2065
sub _debar_user_on_return {
Link Here
|
2054 |
$dt_today->clone()->add_duration( $deltadays * $finedays ); |
2064 |
$dt_today->clone()->add_duration( $deltadays * $finedays ); |
2055 |
if ( $borrower->{debarred} ) { |
2065 |
if ( $borrower->{debarred} ) { |
2056 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
2066 |
my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); |
2057 |
|
2067 |
$borrower_debar_dt->truncate(to => 'day'); |
|
|
2068 |
$new_debar_dt->truncate(to=>'day'); |
2058 |
# Update patron only if new date > old |
2069 |
# Update patron only if new date > old |
2059 |
if ( DateTime->compare( $borrower_debar_dt, $new_debar_dt ) != |
2070 |
if ( DateTime->compare( $borrower_debar_dt, $new_debar_dt ) != |
2060 |
-1 ) |
2071 |
-1 ) |
2061 |
{ |
2072 |
{ |
2062 |
return; |
2073 |
return ($borrower_debar_dt,1); |
2063 |
} |
2074 |
} |
2064 |
|
2075 |
|
2065 |
} |
2076 |
} |