Bugzilla – Attachment 182491 Details for
Bug 39498
Correct display of patron restriction comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39498: correct patron restrictions displays
Bug-39498-correct-patron-restrictions-displays.patch (text/plain), 18.55 KB, created by
Owen Leonard
on 2025-05-15 15:35:40 UTC
(
hide
)
Description:
Bug 39498: correct patron restrictions displays
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-05-15 15:35:40 UTC
Size:
18.55 KB
patch
obsolete
>From 4e9eeadc4eb5390e405f78dd21214aad806cb329 Mon Sep 17 00:00:00 2001 >From: PhilipOrr <philip.orr@lmscloud.de> >Date: Tue, 1 Apr 2025 09:59:39 +0000 >Subject: [PATCH] Bug 39498: correct patron restrictions displays > >This patch updates the way patron restrictions are displayed in the OPAC >and staff interface, with the intention of making the details of each >restriction more clear. In the OPAC, a new include file is created to be >reused on the holds page and the user summary page. opac-user.pl is >updated to allow a parameter to be passed to automatically open the >"Overdues" tab. > >Test plan (copied from the original patch): > >1. Before applying the patch, check how the display is currently. First > set syspref PatronRestrictionTypes to "Allow" >2. Add two different new restriction types, fill out both "Code" and > "Label" >3. Go to a patron's checkout page and add one of each of these > restrictions, but do not fill out the comment field when adding them! >4. Observe that in the checkouts page and details page of the patron, it > just says "Restricted since..." and does not show the restriction > types. >5. Add another restriction, this time fill out the comment field >6. Observe that now in checkout and detail pages, the labels from the > restriction types are listed and the comment shown. >7. Apply patch >8. Go to patron's details and checkout pages and check the restrictions > are now displayed correctly, that is the text "with the explanation" > is only shown for the restrictions that actually have a comment > 8b. Log in to the OPAC with that patron and check they are displayed > correctly in their summary page and when the patron is trying to > place a hold. >9. Go to a different patron's account and add a restriction without a > comment >10. Check it is now displayed correctly >11. Add more restrictions and check they are displayed correctly. Also > add an OVERDUES restriction: > 11a. Find a patron with an overdue item checked out (or create an > overdue checkout on a patron's account) > 11b. Go to Tools -> Overdue notice/status triggers > 11c. Set up a rule for that patron's category, e.g. "First" -> > Delay: 1, make sure to mark the check box for "Restrict" and > "Print" > 11d. Run misc/cronjobs/overdue_notices.pl > 11e. That patron should now also have an OVERDUES restriction >12. Turn PatronRestrictionTypes off again and check the patrons if > everything is still displayed correctly >13. Go to another different patron and add a restriction with no > comment, check if it is displayed correctly >14. Add another restriction with a comment and check it is displayed > correctly >15. Log in to the OPAC with the patron that had OVERDUES restriction and > check they are displayed correctly in their summary page and when > the patron is trying to place a hold. >16. Same thing for the other patron without the OVERDUES restriction. >--- > .../prog/en/includes/patron_messages.inc | 46 +++++++++---------- > .../en/includes/patron-restrictions.inc | 27 +++++++++++ > .../bootstrap/en/modules/opac-reserve.tt | 46 +++---------------- > .../bootstrap/en/modules/opac-user.tt | 36 ++------------- > opac/opac-user.pl | 1 + > 5 files changed, 59 insertions(+), 97 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-restrictions.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >index 5d71adf30d7..942993dde70 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >@@ -92,32 +92,28 @@ > > [% IF ( userdebarred ) %] > <li class="userdebarred blocker"> >- <span class="circ-hlt"> Restricted since [% debarredsince | $KohaDates %]:</span> Patron's account is restricted >- [% IF ( userdebarreddate ) %] >- until [% userdebarreddate | $KohaDates %] >- [% END %] >- >- [% IF ( debarredcomment ) %] >- with the explanation: <br /> >- <em> >- [% IF debarredcomment.search('OVERDUES_PROCESS') %] >- Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %] >- [% ELSE %] >- [% FOREACH restriction IN patron.restrictions %] >- <div class="[% restriction.type.code | lower | html %]_restriction"> >- <span class="restriction_expiration"> >- [% IF restriction.expiration %] >- [% restriction.expiration | $KohaDates %] >- [% ELSE %] >- <strong>Indefinite</strong> >- [% END %] >- </span> >- <span class="restriction_detail"> [%- restriction.type.display_text | html -%][%- IF restriction.comment -%]: [%- restriction.comment | html_line_break -%][%- END -%] </span> >- </div> >+ <span class="circ-hlt">Account restricted since [% debarredsince | $KohaDates %]</span> >+ <ul> >+ [% FOREACH restriction IN patron.restrictions %] >+ <li class="[% restriction.type.code | lower | html %]_restriction"> >+ <span class="restriction_expiration"> >+ [% IF restriction.expiration %] >+ <strong>Restriction expiring [% restriction.expiration | $KohaDates %]</strong> >+ [% ELSE %] >+ <strong>Indefinite restriction</strong> >+ [% END %] >+ </span> >+ [% IF restriction.comment.search('OVERDUES_PROCESS') %] >+ Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %] >+ [% ELSE %] >+ [% IF restriction.comment %] >+ <span class="restriction_detail">[%- restriction.comment | html_line_break -%]</span> >+ [% END %] > [% END %] >- [% END %] </em >- ><br /> >- [% END %] >+ <span class="restriction_type">([%- restriction.type.display_text | html -%])</span> >+ </li> >+ [% END %] >+ </ul> > <a class="btn btn-xs btn-default" href="#reldebarments-tab" onclick="(new bootstrap.Tab($('#reldebarments-tab'))).show()"><i class="fa fa-ban"></i> View restrictions</a> > </li> > <!-- /.blocker --> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-restrictions.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-restrictions.inc >new file mode 100644 >index 00000000000..7b2453b7b37 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-restrictions.inc >@@ -0,0 +1,27 @@ >+<li class="userdebarred blocker"> >+ <strong>Your account has been frozen</strong> >+ <ul> >+ [% FOREACH restriction IN logged_in_user.restrictions %] >+ <li class="[% restriction.type.code | lower | html %]_restriction"> >+ <span class="restriction_expiration"> >+ [% IF restriction.expiration %] >+ <strong>Restriction expiring [% restriction.expiration | $KohaDates %]</strong> >+ [% ELSE %] >+ <strong>Indefinite restriction</strong> >+ [% END %] >+ </span> >+ [% IF restriction.comment.search('OVERDUES_PROCESS') %] >+ <span class="restriction_detail">Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %]</span> >+ [% ELSE %] >+ [% IF restriction.comment %] >+ <span class="restriction_detail">[%- restriction.comment | html_line_break -%]</span> >+ [% END %] >+ [% END %] >+ </li> >+ [% END %] >+ <li> >+ <span>Usually the reason for freezing an account is old overdues or damage fees. If it appears that your account is clear, please contact the library.</span> >+ <a href="/cgi-bin/koha/opac-account.pl">Check your charges page.</a> <a href="/cgi-bin/koha/opac-user.pl?opac-user-overdues=1">Check your overdues.</a> >+ </li> >+ </ul> >+</li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index 59e57049507..ffc97ff6fe0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -30,8 +30,8 @@ > <div id="holds" class="maincontent"> > <h1>Placing a hold</h1> > [% IF ( message ) %] >- <div id="holdmessages" class="alert"> >- <p>Sorry, you cannot place holds.</p> >+ <div id="holdmessages" class="alert alert-warning"> >+ <h2>Sorry, you cannot place holds.</h2> > <ul> > [% IF ( GNA ) %] > <li id="gna"> >@@ -49,41 +49,7 @@ > [% END %] > > [% IF ( debarred ) %] >- <li id="debarred"> >- Your account has been frozen. >- [% IF debarred_comment %] >- Comment:<br /> >- <span id="userdebarred_comment"> >- <strong> >- [% IF debarred_comment.search('OVERDUES_PROCESS') %] >- Restriction added by overdues process [% debarred_comment.remove('OVERDUES_PROCESS ') | html_line_break %] >- [% ELSE %] >- [% FOR restriction IN logged_in_user.restrictions %] >- <div class="patron_restriction"> >- [%- restriction.type.display_text | html -%][%- IF restriction.comment -%] >- : <span class="restriction_comment">[% restriction.comment | html_line_break %]</span>, frozen until: >- <span class="restriction_expiration"> >- [%- IF restriction.expiration -%] >- [%- restriction.expiration | $KohaDates -%] >- [%- ELSE -%] >- <strong>Indefinite</strong> >- [%- END -%] >- </span> >- [% END %] >- </div> >- [% END %] >- [% END %] >- </strong> >- </span> >- [% END %] >- >- [% IF debarred_date && debarred_date != '9999-12-31' %] >- End date: >- <span id="userdebarred_date">[% debarred_date | $KohaDates %]</span> >- [% END %] >- <br /><em>Usually the reason for freezing an account is old overdues or damage fees. If shows your account to be clear, please contact the library.</em> >- <a href="/cgi-bin/koha/opac-account.pl">Go to your charges page</a> >- </li> >+ [% INCLUDE "patron-restrictions.inc" %] > [% END %] > > [% IF ( too_much_oweing ) %] >@@ -273,9 +239,9 @@ > [% END %] > </select> > [% IF at_least_one_library_not_available_for_pickup %] >- <div class="at_least_one_library_not_available_note" >- >Note: Library policy does not allow hold/pickup of an item available locally. Please come to the library to retrieve these items</div >- > >+ <div class="at_least_one_library_not_available_note"> >+ Note: Library policy does not allow hold/pickup of an item available locally. Please come to the library to retrieve these items >+ </div> > [% END %] > [% END # / UNLESS bibitemloo.holdable %] > </li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index c0777a8bab7..9b1f5685ab5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -167,36 +167,7 @@ > [% IF ( discharge_available ) %] > <li id="discharged"> <strong>Please note:</strong> Your account is frozen because it has been discharged. <a href="/cgi-bin/koha/opac-discharge.pl?op=get">Get your discharge</a> </li> > [% ELSE %] >- <li id="userdebarred"> >- <strong>Please note:</strong> Your account has been frozen. >- [% IF ( borrower.debarredcomment ) %] >- Comment:<br /> >- <ul id="userdebarred_comment"> >- [% FOREACH restriction IN logged_in_user.restrictions %] >- <li class="patron_restriction"> >- <strong>[%- restriction.type.display_text | html -%]: </strong> >- [% IF restriction.comment.search('OVERDUES_PROCESS') %] >- Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | html_line_break %] >- [% ELSE %] >- [%- IF restriction.comment -%] >- <span class="restriction_comment">[% restriction.comment | html_line_break %]</span>. >- [%- END -%] >- [% END %] >- [%- IF restriction.expiration -%] >- Account frozen until <span class="restriction_expiration">[%- restriction.expiration | $KohaDates -%]</span> >- [%- ELSE -%] >- <strong>Account frozen indefinitely</strong> >- [%- END -%] >- </li> >- [% END %] >- </ul> >- [% END %] >- >- <p >- ><em>Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library.</em> >- <a href="/cgi-bin/koha/opac-account.pl">Go to your charges page</a></p >- > >- </li> >+ [% INCLUDE "patron-restrictions.inc" %] > [% END %] > [% END %] > [% IF ( borrower.gonenoaddress ) %] >@@ -1094,8 +1065,9 @@ > $(document).ready(function(){ > [% IF ( opac_user_holds ) %] > $("#opac-user-views a[href='#opac-user-holds_panel']").tab("show"); >- [% END %] >- [% IF ( opac_user_article_requests ) %] >+ [% ELSIF ( opac_user_overdues ) %] >+ $("#opac-user-views a[href='#opac-user-overdues_panel']").tab("show"); >+ [% ELSIF ( opac_user_article_requests ) %] > $("#opac-user-views a[href='#opac-user-article-requests_panel']").tab("show"); > [% END %] > $('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests.size | html %]')); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 9d7109bcac7..be5f63896b2 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -430,6 +430,7 @@ $template->param( > OpacHoldNotes => C4::Context->preference('OpacHoldNotes'), > failed_holds => scalar $query->param('failed_holds'), > opac_user_holds => scalar $query->param('opac-user-holds') || 0, >+ opac_user_overdues => scalar $query->param('opac-user-overdues') || 0, > opac_user_article_requests => scalar $query->param('opac-user-article-requests') || 0, > ); > >-- >2.39.5
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 39498
:
180126
|
180272
|
182301
|
182425
|
182426
|
182437
| 182491