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

(-)a/C4/Circulation.pm (-5 / +19 lines)
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
    }
(-)a/circ/returns.pl (+3 lines)
Lines 467-472 foreach my $code ( keys %$messages ) { Link Here
467
        $err{debarborrowernumber} = $borrower->{borrowernumber};
467
        $err{debarborrowernumber} = $borrower->{borrowernumber};
468
        $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
468
        $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
469
    }
469
    }
470
    elsif ( $code eq 'PrevDebarred' ) {
471
        $err{prevdebarred}        = $messages->{'PrevDebarred'};
472
    }
470
    else {
473
    else {
471
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
474
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
472
        # This forces the issue of staying in sync w/ Circulation.pm
475
        # 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