Bugzilla – Attachment 156425 Details for
Bug 26053
Add styling to show expired patron restrictions as inactive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26053: Distinguish expired patron restrictions
Bug-26053-Distinguish-expired-patron-restrictions.patch (text/plain), 3.34 KB, created by
Fridolin Somers
on 2023-09-29 19:35:28 UTC
(
hide
)
Description:
Bug 26053: Distinguish expired patron restrictions
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2023-09-29 19:35:28 UTC
Size:
3.34 KB
patch
obsolete
>From 220e20f136b08ac16d2df1ff4ad5878600cbf0ac Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 21 Sep 2023 12:12:46 -1000 >Subject: [PATCH] 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 >--- > Koha/Patron/Restriction.pm | 16 ++++++++++++++++ > .../prog/en/includes/patron-restrictions-tab.inc | 12 ++++++++++-- > 2 files changed, 26 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron/Restriction.pm b/Koha/Patron/Restriction.pm >index 81f562fa30..87d0dc78f2 100644 >--- a/Koha/Patron/Restriction.pm >+++ b/Koha/Patron/Restriction.pm >@@ -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,21 @@ 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; >+ return 1 if dt_from_string( $self->expiration ) < dt_from_string->truncate( to => 'day' ); >+ return 0; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc >index 20a9eaf19c..8d5d8edc3c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-restrictions-tab.inc >@@ -19,7 +19,8 @@ > </thead> > <tbody> > [% FOREACH restriction IN patron.restrictions %] >- <tr> >+ [% SET restriction_tr_class = restriction.is_expired ? "text-muted" : "" %] >+ <tr class="[% restriction_tr_class | html %]"> > <td> > [% PROCESS restriction_type_description restriction_type=restriction.type %] > </td> >@@ -30,7 +31,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> >-- >2.42.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26053
:
107488
|
156026
|
156095
|
156109
|
156423
|
156424
|
156425
|
156426
|
156427
|
156428
|
156725
|
156726
|
156727
|
156728
|
156757
|
156758
|
156762
|
156763