From d454b1140958da121e9a3852081338c3664e6faf Mon Sep 17 00:00:00 2001 From: PhilipOrr Date: Tue, 1 Apr 2025 09:59:39 +0000 Subject: [PATCH] Bug 39498: correct patron restrictions displays Test plan: 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: a. find a patron with an overdue item checked out (or create an overdue checkout on a patron's account) b. go to Tools -> Overdue notice/status triggers c. 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" d. run misc/cronjobs/overdue_notices.pl e. 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. Signed-off-by: Claire Hernandez --- .../prog/en/includes/patron_messages.inc | 21 ++++++++------ .../bootstrap/en/modules/opac-reserve.tt | 29 ++++++++++--------- 2 files changed, 28 insertions(+), 22 deletions(-) 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 5d71adf30d..1a6d00b7c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -97,14 +97,10 @@ until [% userdebarreddate | $KohaDates %] [% END %] - [% IF ( debarredcomment ) %] - with the explanation:
- [% IF debarredcomment.search('OVERDUES_PROCESS') %] - Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %] - [% ELSE %] [% FOREACH restriction IN patron.restrictions %]
+ [%- restriction.type.display_text | html -%]: [% IF restriction.expiration %] [% restriction.expiration | $KohaDates %] @@ -112,12 +108,19 @@ Indefinite [% END %] - [%- restriction.type.display_text | html -%][%- IF restriction.comment -%]: [%- restriction.comment | html_line_break -%][%- END -%] + [% IF restriction.comment.search('OVERDUES_PROCESS') %] + Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %] + [% ELSE %] + [% IF restriction.comment %] + with the explanation:
+ [%- IF restriction.comment -%][%- restriction.comment | html_line_break -%][%- END -%] + [% ELSE %] + + [% END %] + [% END %]
[% END %] - [% END %]

- [% END %] +
View restrictions 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 59e5704950..c49af9c7a5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -55,21 +55,24 @@ Comment:
- [% 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 %]
- [%- restriction.type.display_text | html -%][%- IF restriction.comment -%] - : [% restriction.comment | html_line_break %], frozen until: - - [%- IF restriction.expiration -%] - [%- restriction.expiration | $KohaDates -%] - [%- ELSE -%] - Indefinite - [%- END -%] - - [% END %] + [%- restriction.type.display_text | html -%] + [% IF restriction.comment.search('OVERDUES_PROCESS') %] + Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | html_line_break %] + [% ELSE %] + [%- IF restriction.comment -%] + : [% restriction.comment | html_line_break %], frozen until: + [% ELSE %] + , frozen until: + [% END %] + + [%- IF restriction.expiration -%] + [%- restriction.expiration | $KohaDates -%] + [%- ELSE -%] + Indefinite + [%- END -%] +
[% END %] [% END %] -- 2.39.5