Bug 31097

Summary: Patron restriction types should display in staff interface and OPAC
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: PatronsAssignee: Philip Orr <philip.orr>
Status: Pushed to main --- QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, kyle.m.hall, oleonard, philip.orr
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Bug Depends on: 23681    
Bug Blocks:    
Attachments: Attachment to Bug 31097 - Patron restriction types should display in staff interface and OPAC
Bug 31097: display restriction types
Attachment to Bug 31097 - Patron restriction types should display in staff interface and OPAC
Bug 31097: Added more restrictions info
Bug 31097: display restriction types
Bug 31097: Added more restrictions info
Bug 31097: Display restriction types
Bug 31097: Added more restrictions info
Bug 31097: Add classes, drop an ELSE, drop <br />
Bug 31097: Add classes, drop an ELSE, drop <br />
Bug 31097: Update restriction type display text
Bug 31097: (follow-up) Restructure messages a bit
Bug 31097: (follow-up) Standardize appearance of colon between restriction type and comments

Description Martin Renvoize 2022-07-04 14:28:31 UTC
Where we display the patron restrictions in the OPAC and Staff client, we don't always display the type description.. only the comment.

We should add this to the display.
Comment 1 Philip Orr 2024-04-17 15:30:04 UTC
Agreed, had a client ask me about that the other day.
Comment 2 Philip Orr 2024-04-18 09:35:16 UTC
taking this one.
Comment 3 Philip Orr 2024-04-18 09:50:00 UTC
Created attachment 165059 [details] [review]
Attachment to Bug 31097 - Patron restriction types should display in staff interface and OPAC

Bug 31097: display restriction types

This patch changes the display of patron
restrictions in checkout and patron details
pages to show the restriction type for each
restriction. It also changes the display so
each restriction is shown on a newline.

To test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly
Comment 4 Philip Orr 2024-04-18 09:53:27 UTC
Credit to ashimema on this one, as he knew the proper TT :)
Comment 5 Matt Blenkinsop 2024-04-18 10:02:22 UTC
Created attachment 165060 [details] [review]
Bug 31097: display restriction types

This patch changes the display of patron
restrictions in checkout and patron details
pages to show the restriction type for each
restriction. It also changes the display so
each restriction is shown on a newline.

To test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 6 Martin Renvoize 2024-04-18 11:08:53 UTC
This is a good improvement.. but I think we could do even better ;)

* We could improve the output a little by checking whether there's a comment before adding the colon.. or put in a "No comment" text as a default.

* Should we rename the bug to reflect we've only looked at the staff client here.. or should we consider doing the same for opac-user.tt and possibly /opac-reserve.tt

I must admit.. I also wonder about exposing more information here.. we've got access to all of it so we could put in whether the restriction is indefinite or has an end date and we might want to order restrictions by start/end/indefinite perhaps so we should the 'most important' first?
Comment 7 Philip Orr 2024-04-18 15:50:52 UTC
Created attachment 165138 [details] [review]
Attachment to Bug 31097 - Patron restriction types should display in staff interface and OPAC

Bug 31097: display restriction types

This patch changes the display of patron
restrictions in checkout and patron details
pages to show the restriction type for each
restriction. It also changes the display so
each restriction is shown on a newline.

To test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 8 Philip Orr 2024-04-18 15:50:55 UTC
Created attachment 165139 [details] [review]
Bug 31097: Added more restrictions info

Added more info to the restrictions message
in circulation as well as to the OPAC display
in "Your account" and to the display of
restriction messages when trying to place a
hold in the OPAC.

To Test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
4a. Make sure that you add some with an
expiration date and some without
4b. Make sure you add some with a comment and
some without
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed and not all info
is displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly
10. Notice the colon is only displayed
if there is a comment
11. Notice the expiration date is also displayed
12. Open the OPAC and log in with that user
(or if you want to log in with your own user:
 make sure they have all the restrictions
 mentioned above as well)
13. Go to "Your account" in the OPAC
14. Notice the display of restrictions
15. Try to place a hold on any record
16. Notice the display of restrictions
Comment 9 Philip Orr 2024-04-18 15:55:15 UTC
Good idea on checking if there's a comment first, added that now.
opac-user.tt and opac-reserve.tt now show the full display as well.
I like the idea of sorting by expiration date, but I haven't found
out how exactly to do that in TT yet. If you know how, point me in
the right direction and I'm happy to write a new patch :)
Comment 10 Martin Renvoize 2024-04-19 16:28:50 UTC
Created attachment 165218 [details] [review]
Bug 31097: display restriction types

This patch changes the display of patron
restrictions in checkout and patron details
pages to show the restriction type for each
restriction. It also changes the display so
each restriction is shown on a newline.

To test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 11 Martin Renvoize 2024-04-19 16:28:53 UTC
Created attachment 165219 [details] [review]
Bug 31097: Added more restrictions info

Added more info to the restrictions message
in circulation as well as to the OPAC display
in "Your account" and to the display of
restriction messages when trying to place a
hold in the OPAC.

To Test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
4a. Make sure that you add some with an
expiration date and some without
4b. Make sure you add some with a comment and
some without
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed and not all info
is displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly
10. Notice the colon is only displayed
if there is a comment
11. Notice the expiration date is also displayed
12. Open the OPAC and log in with that user
(or if you want to log in with your own user:
 make sure they have all the restrictions
 mentioned above as well)
13. Go to "Your account" in the OPAC
14. Notice the display of restrictions
15. Try to place a hold on any record
16. Notice the display of restrictions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2024-04-19 16:30:09 UTC
Created attachment 165220 [details] [review]
Bug 31097: Display restriction types

This patch changes the display of patron
restrictions in checkout and patron details
pages to show the restriction type for each
restriction. It also changes the display so
each restriction is shown on a newline.

To test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2024-04-19 16:30:11 UTC
Created attachment 165221 [details] [review]
Bug 31097: Added more restrictions info

Added more info to the restrictions message
in circulation as well as to the OPAC display
in "Your account" and to the display of
restriction messages when trying to place a
hold in the OPAC.

To Test:
1. Before applying patch, set system preference
"PatronRestrictionTypes" to "Allow"
2. Go to Administration -> Patron restriction types
3. Add some restriction types, make sure you
fill out both "Code" and "Label"
4. Go to any patron and add one or more of each
restriction type
4a. Make sure that you add some with an
expiration date and some without
4b. Make sure you add some with a comment and
some without
5. Go to that patron's checkout page
6. Notice that only the comments of the
restrictions are displayed and not all info
is displayed
7. Apply the patch
8. Reload the page
9. Notice the restriction types are now
displayed correctly
10. Notice the colon is only displayed
if there is a comment
11. Notice the expiration date is also displayed
12. Open the OPAC and log in with that user
(or if you want to log in with your own user:
 make sure they have all the restrictions
 mentioned above as well)
13. Go to "Your account" in the OPAC
14. Notice the display of restrictions
15. Try to place a hold on any record
16. Notice the display of restrictions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2024-04-19 16:32:13 UTC
This is great, thankyou!

I couldn't work out he ordering either.. I thought you could add is like:

[% FOR restriction IN patron.restrictions({},{ order_by => expiration }) %]

But it didn't appear to work.

Anyway, I think this is already a vast improvement, so I'm signing off and passing QA
Comment 15 Katrin Fischer 2024-04-29 07:21:03 UTC
I am a bit overly careful maybe as this is for the OPAC and I am not sure how much libraries are relying on things displaying or not displaying in a certain way.

1) When no restriction types are used, all restrictions use the internal type "Manual" which currently will display like this:

Manual, frozen until: Indefinite
Manual: Unter, frozen until: 05/08/2024 

I think the "Manual" could be confusing to patrons and I am also not sure how this might be translated. Maybe we should hide the type in this case?

2) I'd really like some classes to make it possible to customize the content a bit. At the moment it's all one text paragraph. Using block elements or a list could also help avoid the <br />.


Some notes (not blocking)

* Some lines are almost repeated identically. The IF/ELSE on restriction.comment could be moved to only include the first line that is different to make it a little more compact.
Comment 16 Martin Renvoize 2024-05-02 10:42:14 UTC Comment hidden (obsolete)
Comment 17 Martin Renvoize 2024-05-02 10:50:45 UTC
Created attachment 166055 [details] [review]
Bug 31097: Add classes, drop an ELSE, drop <br />

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 18 Katrin Fischer 2024-05-03 13:03:16 UTC
This is much better, thanks!
Can we still take care of not displying the "Manual" for libraries not using the restriction types (or just in general?)

For testing I have added 3 restrictions, it also highlights what I mean I think:

Manual: Foo, frozen until: 28.05.2024
Manual
Manual: bar, frozen until: Indefinite

Sorry!

Maybe we should just update "Manual" to "Manual restriction"?
Comment 19 Martin Renvoize 2024-05-07 10:46:09 UTC
Created attachment 166255 [details] [review]
Bug 31097: Update restriction type display text
Comment 20 Katrin Fischer 2024-05-07 14:57:39 UTC
I've asked Owen to take a look, waiting a little longer with this one.
Comment 21 Owen Leonard 2024-05-07 15:23:39 UTC
Created attachment 166296 [details] [review]
Bug 31097: (follow-up) Restructure messages a bit

This patch updates the patron restrictions markup and splits up some
strings to (hopefully) improve the translation process. The patch also
fixes a bug in a previous patch which prevented manual restrictions from
being displayed if there was also a restriction added by
overdue_notices.pl.

Test that all three kinds of restrictions display correctly:

 - Restrictions added by overdue process
 - Manual restriction without an expiration date
 - Manual restriction with an expiration date
Comment 22 Katrin Fischer 2024-05-08 15:23:19 UTC
This is a tricky one. I think we will leave it as is now, but some notes:

For an indefinite restriction without comment, there is no punctuation between the restriction description and the note about it being indefinite.

When there is punctuation, there is a colon with a space between restriction description and the colon. 

I didn't see an easy way to fix these.
Comment 23 Owen Leonard 2024-05-08 16:02:10 UTC
Created attachment 166428 [details] [review]
Bug 31097: (follow-up) Standardize appearance of colon between restriction type and comments
Comment 24 Katrin Fischer 2024-05-08 16:24:54 UTC
Pushed for 24.05!

Well done everyone, thank you!