Bug 26847 - Make borrower category code accessible in all pages of the OPAC
Summary: Make borrower category code accessible in all pages of the OPAC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Victor Grousset/tuxayo
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2020-10-28 14:33 UTC by Rickard Lindfors
Modified: 2022-06-06 20:24 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.02,20.05.16
Circulation function:


Attachments
Bug 26847: Add unit test for categorycode in masthead (1.60 KB, patch)
2020-11-04 15:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (1.94 KB, patch)
2020-11-04 15:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26847: Add unit test for categorycode in masthead (1.64 KB, patch)
2020-11-04 16:33 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (2.00 KB, patch)
2020-11-04 16:33 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 26847: Add UI test for categorycode in masthead (1.70 KB, patch)
2020-12-29 16:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (2.05 KB, patch)
2020-12-29 16:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 26847: (follow-up) fix get_attribute() call (1.27 KB, patch)
2021-01-05 13:25 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Rickard Lindfors 2020-10-28 14:33:55 UTC
It would be useful to see which borrower category a user has when logged in. This way, the library could personalize information with javascript, to certain categories.

On every page, there's for example: data-borrowernumber and data-branchcode. Maybe here, it would be suitable for a data-borrowercategory?
Comment 1 Martin Renvoize (ashimema) 2020-11-04 15:00:34 UTC
Created attachment 113003 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

This unit test adds a regression test for the addition of categorycode
into the masthead of the staff client.
Comment 2 Martin Renvoize (ashimema) 2020-11-04 15:00:37 UTC
Created attachment 113004 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.
Comment 3 Lucas Gass (lukeg) 2020-11-04 16:33:40 UTC
Created attachment 113012 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

This unit test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2020-11-04 16:33:49 UTC
Created attachment 113013 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Victor Grousset/tuxayo 2020-12-29 16:07:20 UTC
Created attachment 114726 [details] [review]
Bug 26847: Add UI test for categorycode in masthead

This test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Victor Grousset/tuxayo 2020-12-29 16:07:24 UTC
Created attachment 114727 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 7 Victor Grousset/tuxayo 2020-12-29 19:37:10 UTC
Comment on attachment 113012 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

Fixed test terminology in the commit message "unit test" => "UI test"
Comment 8 David Cook 2021-01-04 01:27:59 UTC
Another idea is to provide a Javascript object that is accessible by Javascript. 

That could be a more extensible way of getting this functionality.
Comment 9 Katrin Fischer 2021-01-04 08:08:15 UTC
(In reply to David Cook from comment #8)
> Another idea is to provide a Javascript object that is accessible by
> Javascript. 
> 
> That could be a more extensible way of getting this functionality.

But it would make it harder to tie CSS to it. I think having it in the HTML works well for both.
Comment 10 Jonathan Druart 2021-01-04 15:34:22 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 David Cook 2021-01-04 22:24:58 UTC
(In reply to Katrin Fischer from comment #9)
> (In reply to David Cook from comment #8)
> > Another idea is to provide a Javascript object that is accessible by
> > Javascript. 
> > 
> > That could be a more extensible way of getting this functionality.
> 
> But it would make it harder to tie CSS to it. I think having it in the HTML
> works well for both.

Looking at the previous comments, no one mentioned CSS; they only mentioned Javascript. But I think that you make a really good point. It could be interesting to use CSS tied to borrower category.
Comment 12 Victor Grousset/tuxayo 2021-01-05 13:25:12 UTC
Created attachment 114872 [details] [review]
Bug 26847: (follow-up) fix get_attribute() call

Since the upgrade to Selenium 3 in bug 27055, an additional parameter is
required for get_attribute() to actually work.
https://metacpan.org/pod/Selenium::Remote::WebElement#get_attribute
Comment 13 Jonathan Druart 2021-01-05 13:41:17 UTC
Last patch pushed to master for 21.05.00
Comment 14 Fridolin Somers 2021-01-07 14:31:44 UTC
Small yet useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.02
Comment 15 Andrew Fuerste-Henry 2021-01-12 14:40:41 UTC
Enhancement, not backported to 20.05. Please ask if needed
Comment 16 Rickard Lindfors 2021-02-26 08:38:17 UTC
Yes, please backport to 20.05 :)
Comment 17 Rickard Lindfors 2021-08-30 09:22:35 UTC
Hi Andrew! Can you please backport to 20.05? Thanks!
Comment 18 Jonathan Druart 2021-08-30 10:13:51 UTC
Victor, can you have a look at backporting these patches into 20.05 please?
Comment 19 Victor Grousset/tuxayo 2021-08-31 05:25:47 UTC
Backported: Pushed to 20.05.x branch for 20.05.16
Comment 20 Rickard Lindfors 2021-08-31 05:45:42 UTC
Thanks Victor!
Comment 21 Wainui Witika-Park 2021-09-07 01:56:13 UTC
Should this be backported to 19.11.x for 19.11.22?
Comment 22 Victor Grousset/tuxayo 2021-09-08 02:22:03 UTC
the request was only for 20.05.x
severity is not >= to major
so you don't have to try to backport

But it's your call to try to backport some things anyway if they are low risk.
I tend to do that for accessibility and translatability.
Comment 23 Wainui Witika-Park 2021-09-16 23:31:58 UTC
Not backported to 19.11.x