Bug 32205 - Unnecessary sysprefs used in template params for masthead during failed OPAC auth
Summary: Unnecessary sysprefs used in template params for masthead during failed OPAC ...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-15 01:22 UTC by David Cook
Modified: 2023-12-28 20:43 UTC (History)
6 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:
23.05.00,22.11.04,22.05.11,21.11.19


Attachments
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth (2.15 KB, patch)
2022-11-15 01:28 UTC, David Cook
Details | Diff | Splinter Review
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth (2.21 KB, patch)
2022-12-23 19:11 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth (2.26 KB, patch)
2023-02-09 18:53 UTC, solene.ngamga
Details | Diff | Splinter Review
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth (2.34 KB, patch)
2023-02-23 09:19 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2022-11-15 01:22:10 UTC
C4::Auth sends many sysprefs as template params unnecessarily since the create of Koha.Preference().

This issue highlights some of them which are sent during a failed OPAC.
Comment 1 David Cook 2022-11-15 01:28:34 UTC
Created attachment 143889 [details] [review]
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth

This patch removes some unnecessary syspref template params for
failed OPAC auth. The templates handle these syspref using the
Koha.Preference() TT plugin function, so they're completely redundant
and just make checkauth() longer than it needs to be.

Test plan:
1) Apply patch
2) Enable OpacCloud, OpacBrowser, and OpacTopissue sysprefs
3) koha-plack --restart kohadev
4) Log out of Koha if you're logged in
5) Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
6) Note that you can see the Cart as well as links for the following:
Browse by hierarchy, Authority search, Tag cloud, Subject cloud,
Most popular
Comment 2 David Cook 2022-11-15 01:33:08 UTC
There are more sysprefs to remove (both for OPAC and staff interface), but I thought this was an easily manageable chunk.
Comment 3 Fridolin Somers 2022-12-22 08:12:48 UTC
Ah I found a place where a preference is missing Koha.Preference() use.
It is TagsEnabled at :

koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && TagsEnabled && TagsInputOnList ) %]
Comment 4 David Cook 2022-12-22 23:59:27 UTC
(In reply to Fridolin Somers from comment #3)
> Ah I found a place where a preference is missing Koha.Preference() use.
> It is TagsEnabled at :
> 
> koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:[% SET
> TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) &&
> TagsEnabled && TagsInputOnList ) %]

It gets fetched in opac/opac-basket.pl using C4::Context->preference('TagsEnabled') and then passed to the template as TagsEnabled.
Comment 5 Fridolin Somers 2022-12-23 19:05:08 UTC
(In reply to David Cook from comment #4)
> (In reply to Fridolin Somers from comment #3)
> > Ah I found a place where a preference is missing Koha.Preference() use.
> > It is TagsEnabled at :
> > 
> > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:[% SET
> > TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) &&
> > TagsEnabled && TagsInputOnList ) %]
> 
> It gets fetched in opac/opac-basket.pl using
> C4::Context->preference('TagsEnabled') and then passed to the template as
> TagsEnabled.

OK great so we ignore it ;)
Comment 6 Fridolin Somers 2022-12-23 19:11:08 UTC
Created attachment 144827 [details] [review]
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth

This patch removes some unnecessary syspref template params for
failed OPAC auth. The templates handle these syspref using the
Koha.Preference() TT plugin function, so they're completely redundant
and just make checkauth() longer than it needs to be.

Test plan:
1) Apply patch
2) Enable OpacCloud, OpacBrowser, and OpacTopissue sysprefs
3) koha-plack --restart kohadev
4) Log out of Koha if you're logged in
5) Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
6) Note that you can see the Cart as well as links for the following:
Browse by hierarchy, Authority search, Tag cloud, Subject cloud,
Most popular

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 7 solene.ngamga 2023-02-09 18:53:42 UTC
Created attachment 146446 [details] [review]
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth

This patch removes some unnecessary syspref template params for
failed OPAC auth. The templates handle these syspref using the
Koha.Preference() TT plugin function, so they're completely redundant
and just make checkauth() longer than it needs to be.

Test plan:
1) Apply patch
2) Enable OpacCloud, OpacBrowser, and OpacTopissue sysprefs
3) koha-plack --restart kohadev
4) Log out of Koha if you're logged in
5) Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
6) Note that you can see the Cart as well as links for the following:
Browse by hierarchy, Authority search, Tag cloud, Subject cloud,
Most popular

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Comment 8 Jonathan Druart 2023-02-23 09:19:52 UTC
Created attachment 147201 [details] [review]
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth

This patch removes some unnecessary syspref template params for
failed OPAC auth. The templates handle these syspref using the
Koha.Preference() TT plugin function, so they're completely redundant
and just make checkauth() longer than it needs to be.

Test plan:
1) Apply patch
2) Enable OpacCloud, OpacBrowser, and OpacTopissue sysprefs
3) koha-plack --restart kohadev
4) Log out of Koha if you're logged in
5) Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
6) Note that you can see the Cart as well as links for the following:
Browse by hierarchy, Authority search, Tag cloud, Subject cloud,
Most popular

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2023-02-23 09:20:02 UTC
An ideal solution would have been to remove them all ;)
Comment 10 David Cook 2023-02-23 22:45:25 UTC
(In reply to Jonathan Druart from comment #9)
> An ideal solution would have been to remove them all ;)

Someday...
Comment 11 Tomás Cohen Arazi 2023-02-27 14:42:10 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 12 Matt Blenkinsop 2023-03-01 09:51:08 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 13 Lucas Gass 2023-03-10 14:21:43 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 14 Arthur Suzuki 2023-03-29 13:03:27 UTC
applied to 21.11 for 21.11.19
Comment 15 wainuiwitikapark 2023-04-27 05:37:12 UTC
Not backported to 21.05.x