View | Details | Raw Unified | Return to bug 8231
Collapse All | Expand All

(-)a/C4/Circulation.pm (-7 / +18 lines)
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
            }
(-)a/circ/returns.pl (+3 lines)
Lines 457-462 foreach my $code ( keys %$messages ) { Link Here
457
        $err{debarborrowernumber} = $borrower->{borrowernumber};
457
        $err{debarborrowernumber} = $borrower->{borrowernumber};
458
        $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
458
        $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
459
    }
459
    }
460
    elsif ( $code eq 'PrevDebarred' ) {
461
        $err{prevdebarred}        = $messages->{'PrevDebarred'};
462
    }
460
    else {
463
    else {
461
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
464
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
462
        # This forces the issue of staying in sync w/ Circulation.pm
465
        # This forces the issue of staying in sync w/ Circulation.pm
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +3 lines)
Lines 349-354 $(document).ready(function () { Link Here
349
                    [% IF ( errmsgloo.debarred ) %]
349
                    [% IF ( errmsgloo.debarred ) %]
350
                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %] </p>
350
                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %] </p>
351
                    [% END %]
351
                    [% END %]
352
                    [% IF ( errmsgloo.prevdebarred ) %]
353
                        <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %]</p>
354
                    [% END %]
352
            [% END %]
355
            [% END %]
353
[% IF ( soundon ) %]
356
[% IF ( soundon ) %]
354
<audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
357
<audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
355
- 

Return to bug 8231