[Bug 20921] New: Expose borrowernumber and branch when user is logged in to OPAC
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Bug ID: 20921 Summary: Expose borrowernumber and branch when user is logged in to OPAC Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Some libraries would like the ability to trigger javascript ofr users of a certain branch or specific borrowers. There is currently no way to retrieve this information on the opac. This patchset will add these two variables as attributes on the loggedinusername span -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 76005 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76005&action=edit Bug 20921: Add borrowernumber and branchcode as html attributes To test: 1 - Apply patch 2 - Visit the opac 3 - Sign in 4 - You should not see any difference 5 - Inspect the element 'Welcome, {username}' 6 - Note the attributes for borrowernumber and branchcode 7 - Add to OPACUserJS: $(document).ready(function(){ console.log( $(".loggedinusername").attr('branchcode')); console.log( $(".loggedinusername").attr('borrowernumber')); }); 8 - Check the console and note you can see the info expected -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I think we already have the branch in the source code, but in another spot. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 paxed <pasi.kallinen@joensuu.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pasi.kallinen@joensuu.fi --- Comment #3 from paxed <pasi.kallinen@joensuu.fi> --- Custom HTML attributes should be prefixed with "data-" (as per the HTML5 spec) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- It's a class in the <body> tag: <body ID="advsearch" class="branch-CPL scrollto" > branch-CPL represents the branch of the currently logged in user. Maybe it would be cleaner to also add the borrowernumber there? Also the use of custom attributes appears strange to me - why use class for the username but then 2 attributes? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 --- Comment #5 from Owen Leonard <oleonard@myacpl.org> --- (In reply to paxed from comment #3)
Custom HTML attributes should be prefixed with "data-" (as per the HTML5 spec)
I agree with this. I think it makes sense to add data- attributes for branch and borrowernumber even with the branch information in a class. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Talked to Owen on IRC - all things cleared up. I think only thing missing here is adding the data- prefix. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #76005|0 |1 is obsolete| | --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 76200 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76200&action=edit Bug 20921: Add borrowernumber and branchcode as html attributes To test: 1 - Apply patch 2 - Visit the opac 3 - Sign in 4 - You should not see any difference 5 - Inspect the element 'Welcome, {username}' 6 - Note the attributes for borrowernumber and branchcode 7 - Add to OPACUserJS: $(document).ready(function(){ console.log( $(".loggedinusername").attr('data-branchcode')); console.log( $(".loggedinusername").attr('data-borrowernumber')); }); 8 - Check the console and note you can see the info expected -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Maryse Simard <maryse.simard@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Maryse Simard <maryse.simard@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #76200|0 |1 is obsolete| | --- Comment #8 from Maryse Simard <maryse.simard@inlibro.com> --- Created attachment 76310 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76310&action=edit Bug 20921: Add borrowernumber and branchcode as html attributes To test: 1 - Apply patch 2 - Visit the opac 3 - Sign in 4 - You should not see any difference 5 - Inspect the element 'Welcome, {username}' 6 - Note the attributes for borrowernumber and branchcode 7 - Add to OPACUserJS: $(document).ready(function(){ console.log( $(".loggedinusername").attr('data-branchcode')); console.log( $(".loggedinusername").attr('data-borrowernumber')); }); 8 - Check the console and note you can see the info expected Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Followed the test plan and it works. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #76310|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 76413 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76413&action=edit Bug 20921: Add borrowernumber and branchcode as html attributes To test: 1 - Apply patch 2 - Visit the opac 3 - Sign in 4 - You should not see any difference 5 - Inspect the element 'Welcome, {username}' 6 - Note the attributes for borrowernumber and branchcode 7 - Add to OPACUserJS: $(document).ready(function(){ console.log( $(".loggedinusername").attr('data-branchcode')); console.log( $(".loggedinusername").attr('data-borrowernumber')); }); 8 - Check the console and note you can see the info expected Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Followed the test plan and it works. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 76414 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76414&action=edit Bug 20921: Fix opac_auth for selenium Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 76415 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76415&action=edit Bug 20921: Add selenium tests for .loggedinusername Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Assignee|oleonard@myacpl.org |nick@bywatersolutions.com --- Comment #12 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I am not sure it makes sense to have borrowernumber and branchcode at loggedinusername level. Maybe we should rename it "loggedinuser"? Can be done later. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #13 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20921 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Master |RESOLVED CC| |martin.renvoize@ptfs-europe | |.com --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Enhancement, won't be backported to 18.05.x series. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org