[Bug 25765] New: Replace Branches.GetLoggedInBranchcode with use of logged_in_user in templates
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Bug ID: 25765 Summary: Replace Branches.GetLoggedInBranchcode with use of logged_in_user in templates Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: fridolin.somers@biblibre.com QA Contact: testopia@bugs.koha-community.org The template plugin Branches contains a method GetLoggedInBranchcode that returns branch code of the current loggedin user. This is a bit off scope of the plugin and can easily be replaced by logged_in_user variable (a Koha::Patron object used is most templates) : logged_in_user.library.branchcode -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|oleonard@myacpl.org |fridolin.somers@biblibre.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #1 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Oups mistake, GetLoggedInBranchcode is correct and depends on loggin choice. It is var LoginBranchname I want to correct. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Replace |Replace LoginBranchname |Branches.GetLoggedInBranchc |with use of Branches |ode with use of |template plugin |logged_in_user in templates | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Replace LoginBranchname |Replace LoginBranchname and |with use of Branches |LoginBranchcode with use of |template plugin |Branches template plugin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #2 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Created attachment 105909 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105909&action=edit Bug 25765: Add GetLoggedInBranchname method Add GetLoggedInBranchname method to Branches templates plugin. Also changes GetName method to use Koha::Library instead of direct SQL. Test plan : Run prove t/db_dependent/Template/Plugin/Branches.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #3 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Created attachment 105910 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105910&action=edit Bug 25765: Replace LoginBranchname and LoginBranchcode with use of Branches template plugin The template plugin Branches contains a method GetLoggedInBranchcode that returns current branch code. This patch adds GetLoggedInBranchname to get current branch name. It is used to replace vars LoginBranchname and LoginBranchcode sent to all templates in C4/Auth.pm. In labels and patrons cards modules, I choose to remove a unseless display of current branch in a hint. In acqui/acqui-home.tt, I choose to remove a useless display of current branch and also because table of founds contains a filter on library. Test plan: Check pages source code to see branch code or name is correct. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25770 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |21746 CC| |jonathan.druart@bugs.koha-c | |ommunity.org Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21746 [Bug 21746] Remove NO_LIBRARY_SET -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105909|0 |1 is obsolete| | --- Comment #4 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Created attachment 106357 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=106357&action=edit Bug 25765: Add GetLoggedInBranchname method Add GetLoggedInBranchname method to Branches templates plugin. Also changes GetName method to use Koha::Library instead of direct SQL. Test plan : Run prove t/db_dependent/Template/Plugin/Branches.t Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105910|0 |1 is obsolete| | --- Comment #5 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Created attachment 106358 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=106358&action=edit Bug 25765: Replace LoginBranchname and LoginBranchcode with use of Branches template plugin The template plugin Branches contains a method GetLoggedInBranchcode that returns current branch code. This patch adds GetLoggedInBranchname to get current branch name. It is used to replace vars LoginBranchname and LoginBranchcode sent to all templates in C4/Auth.pm. In labels and patrons cards modules, I choose to remove a unseless display of current branch in a hint. In acqui/acqui-home.tt, I choose to remove a useless display of current branch and also because table of founds contains a filter on library. Test plan: Check pages source code to see branch code or name is correct. list of the pages: /cgi-bin/koha/acqui/acqui-home.pl /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX /cgi-bin/koha/circ/branchoverdues.pl /cgi-bin/koha/circ/set-library.pl /cgi-bin/koha/circ/offline.pl /cgi-bin/koha/labels/label-edit-batch.pl?op=new /cgi-bin/koha/labels/label-manage.pl /cgi-bin/koha/patroncards/edit-batch.pl /cgi-bin/koha/patroncards/manage.pl OPAC: /cgi-bin/koha/opac-detail.pl?biblionumber=XXX Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net Status|Needs Signoff |Signed Off --- Comment #6 from Victor Grousset/tuxayo <victor@tuxayo.net> --- It works! Test was done by opening the 10 test pages and comparing the source code before and after the patch with a diff tool. The only actually changes are the 4 pages without the hint. And acqui/acqui-home.tt as advertised. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Throwing this out there.. I'm really not a fan of the method names in some of our template plugins.. a mixture of lower case accessors and mixed case ones.. and I'm also not entirely sure we need as many as we impliment. Why not add a 'current' method to just return the current branches Koha::Library object.. perhaps unblessed.. and then you can refer to the relevant field via dot notation.. for example? [% Branches.current.name %] [% Branches.current.code %] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Also.. this introduces an additional DB hit.. you could fetch the branchname from context instead. I feel caching of the logged in library object is ripe for performance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #106357|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 107154 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107154&action=edit Bug 25765: Add GetLoggedInBranchname method Add GetLoggedInBranchname method to Branches templates plugin. Also changes GetName method to use Koha::Library instead of direct SQL. Test plan : Run prove t/db_dependent/Template/Plugin/Branches.t Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #106358|0 |1 is obsolete| | --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 107155 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107155&action=edit Bug 25765: Replace LoginBranchname and LoginBranchcode with use of Branches template plugin The template plugin Branches contains a method GetLoggedInBranchcode that returns current branch code. This patch adds GetLoggedInBranchname to get current branch name. It is used to replace vars LoginBranchname and LoginBranchcode sent to all templates in C4/Auth.pm. In labels and patrons cards modules, I choose to remove a unseless display of current branch in a hint. In acqui/acqui-home.tt, I choose to remove a useless display of current branch and also because table of founds contains a filter on library. Test plan: Check pages source code to see branch code or name is correct. list of the pages: /cgi-bin/koha/acqui/acqui-home.pl /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX /cgi-bin/koha/circ/branchoverdues.pl /cgi-bin/koha/circ/set-library.pl /cgi-bin/koha/circ/offline.pl /cgi-bin/koha/labels/label-edit-batch.pl?op=new /cgi-bin/koha/labels/label-manage.pl /cgi-bin/koha/patroncards/edit-batch.pl /cgi-bin/koha/patroncards/manage.pl OPAC: /cgi-bin/koha/opac-detail.pl?biblionumber=XXX Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 107156 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107156&action=edit Bug 25765: (QA follow-up) Save a DB hit Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 107157 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107157&action=edit Bug 25765: (QA follow-up) Use method directly in cleanborrowers Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Leaving to the RM's discretion. I've added a couple of followups, one to restore fetching branchname from the userenv and save us a DB hit (this will be used of pretty much every page the loads and as such could be costly performance wise to always re-fetch from the DB). I still like the idea of 'Branches.current' returning the currently logged in branch object at some point, but I feel that's out of scope for here. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #14 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- (In reply to Martin Renvoize from comment #8)
Also.. this introduces an additional DB hit.. you could fetch the branchname from context instead.
I feel caching of the logged in library object is ripe for performance.
Ah yep but the primary cause of this bug report is that we face encoding issues on branch name when session storage is on tmp file. Its quite random but i think the performance difference is really minor, most pages use hundreds of SQL requests. When session is in DB there is still a query ^^. We should better add branche name in Memcached no ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Fridolin SOMERS from comment #14)
(In reply to Martin Renvoize from comment #8)
Also.. this introduces an additional DB hit.. you could fetch the branchname from context instead.
I feel caching of the logged in library object is ripe for performance.
Ah yep but the primary cause of this bug report is that we face encoding issues on branch name when session storage is on tmp file. Its quite random but i think the performance difference is really minor, most pages use hundreds of SQL requests. When session is in DB there is still a query ^^.
We should better add branche name in Memcached no ?
Sorry I missed you comment before pushing it. Do you mean there is an encoding issue in the current version? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #17 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- (In reply to Jonathan Druart from comment #16)
Sorry I missed you comment before pushing it. Do you mean there is an encoding issue in the current version?
Yep when using tmp session storage, go to system preferences page, it breaks encoding in library name. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00 |20.11.00, 20.05.03 released in| | Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com --- Comment #18 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 20.05.x for 20.05.03 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 --- Comment #19 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Fridolin SOMERS from comment #17)
(In reply to Jonathan Druart from comment #16)
Sorry I missed you comment before pushing it. Do you mean there is an encoding issue in the current version?
Yep when using tmp session storage, go to system preferences page, it breaks encoding in library name.
Can you please detail the different steps to recreate the issue, I don't manage to see what you describe. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25765 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aleisha@catalyst.net.nz --- Comment #20 from Aleisha Amohia <aleisha@catalyst.net.nz> --- enhancement, not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org