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

(-)a/Koha/Patron/Restriction.pm (+18 lines)
Lines 18-23 package Koha::Patron::Restriction; Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Koha::Database;
20
use Koha::Database;
21
use Koha::DateUtils qw( dt_from_string );
21
use Koha::Patron::Restriction::Type;
22
use Koha::Patron::Restriction::Type;
22
23
23
use base qw(Koha::Object);
24
use base qw(Koha::Object);
Lines 44-49 sub type { Link Here
44
    return Koha::Patron::Restriction::Type->_new_from_dbic($type_rs);
45
    return Koha::Patron::Restriction::Type->_new_from_dbic($type_rs);
45
}
46
}
46
47
48
=head3 is_expired
49
50
my $is_expired = $restriction->is_expired;
51
52
Returns 1 if the restriction is expired or 0;
53
54
=cut
55
56
sub is_expired {
57
    my ($self) = @_;
58
    return 0 unless $self->expiration;
59
    # This condition must be consistant with Koha::Patron->is_debarred
60
    my $makes_patron_debarred = dt_from_string( $self->expiration ) > dt_from_string;
61
    return 1 unless $makes_patron_debarred;
62
    return 0;
63
}
64
47
=head2 Internal methods
65
=head2 Internal methods
48
66
49
=head3 _type
67
=head3 _type
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc (-3 / +9 lines)
Lines 19-25 Link Here
19
        </thead>
19
        </thead>
20
        <tbody>
20
        <tbody>
21
            [% FOREACH restriction IN patron.restrictions %]
21
            [% FOREACH restriction IN patron.restrictions %]
22
                <tr>
22
                [% IF restriction.is_expired %]<tr class="expired">[% ELSE %]<tr>[% END %]
23
                    <td>
23
                    <td>
24
                        [% PROCESS restriction_type_description restriction_type=restriction.type %]
24
                        [% PROCESS restriction_type_description restriction_type=restriction.type %]
25
                    </td>
25
                    </td>
Lines 30-36 Link Here
30
                            [% restriction.comment | $raw %]
30
                            [% restriction.comment | $raw %]
31
                        [% END %]
31
                        [% END %]
32
                    </td>
32
                    </td>
33
                    <td>[% IF restriction.expiration %] [% restriction.expiration | $KohaDates %] [% ELSE %] <em>Indefinite</em> [% END %]</td>
33
                    <td>
34
                        [% IF restriction.expiration %]
35
                            [% restriction.expiration | $KohaDates %]
36
                            [% IF restriction.is_expired %](<span>expired</span>)[% END %]
37
                        [% ELSE %]
38
                            <em>Indefinite</em>
39
                        [% END %]
40
                    </td>
34
                    <td>[% restriction.created | $KohaDates %]</td>
41
                    <td>[% restriction.created | $KohaDates %]</td>
35
                    [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
42
                    [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
36
                        <td>
43
                        <td>
37
- 

Return to bug 26053