Bug 26053: Distinguish expired patron restrictions
On the patron detail page, in restrictions table to show that the restriction has expired. With text and a grey color line. Uses 'text-muted' boostrap class (already used in OPAC). Test plan : 1) Go to a patron details page cgi-bin/koha/members/moremember.pl 2) Create 2 restrictions in the future 3) Edit in database to se the first restriction into the past 4) Create a retriction without date 5) Check you see on expired line text : (expired) 6) Check line is grey Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
5b25b26f70
commit
79be5f361b
2 changed files with 27 additions and 2 deletions
|
@ -18,6 +18,7 @@ package Koha::Patron::Restriction;
|
|||
use Modern::Perl;
|
||||
|
||||
use Koha::Database;
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
use Koha::Patron::Restriction::Type;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
@ -44,6 +45,23 @@ sub type {
|
|||
return Koha::Patron::Restriction::Type->_new_from_dbic($type_rs);
|
||||
}
|
||||
|
||||
=head3 is_expired
|
||||
|
||||
my $is_expired = $restriction->is_expired;
|
||||
|
||||
Returns 1 if the restriction is expired or 0;
|
||||
|
||||
=cut
|
||||
|
||||
sub is_expired {
|
||||
my ($self) = @_;
|
||||
return 0 unless $self->expiration;
|
||||
# This condition must be consistent with Koha::Patron->is_debarred
|
||||
my $makes_patron_debarred = dt_from_string( $self->expiration ) > dt_from_string;
|
||||
return 1 unless $makes_patron_debarred;
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
||||
=head3 _type
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH restriction IN patron.restrictions %]
|
||||
<tr>
|
||||
[% IF restriction.is_expired %]<tr class="expired">[% ELSE %]<tr>[% END %]
|
||||
<td>
|
||||
[% PROCESS restriction_type_description restriction_type=restriction.type %]
|
||||
</td>
|
||||
|
@ -30,7 +30,14 @@
|
|||
[% restriction.comment | $raw %]
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% IF restriction.expiration %] [% restriction.expiration | $KohaDates %] [% ELSE %] <em>Indefinite</em> [% END %]</td>
|
||||
<td>
|
||||
[% IF restriction.expiration %]
|
||||
[% restriction.expiration | $KohaDates %]
|
||||
[% IF restriction.is_expired %](<span>expired</span>)[% END %]
|
||||
[% ELSE %]
|
||||
<em>Indefinite</em>
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% restriction.created | $KohaDates %]</td>
|
||||
[% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
|
||||
<td>
|
||||
|
|
Loading…
Reference in a new issue