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

(-)a/C4/Circulation.pm (-6 / +17 lines)
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
            }
(-)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 350-355 $(document).ready(function () { Link Here
350
                    [% IF ( errmsgloo.debarred ) %]
350
                    [% IF ( errmsgloo.debarred ) %]
351
                        <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
                        <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>
352
                    [% END %]
352
                    [% END %]
353
                    [% IF ( errmsgloo.prevdebarred ) %]
354
                        <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %]</p>
355
                    [% END %]
353
            [% END %]
356
            [% END %]
354
[% IF ( soundon ) %]
357
[% IF ( soundon ) %]
355
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
358
<audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
356
- 

Return to bug 8231