Bug 27031 - Koha.Preference() should be used more often in header.inc and js_includes.inc
Summary: Koha.Preference() should be used more often in header.inc and js_includes.inc
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks: 26791 27324
  Show dependency treegraph
 
Reported: 2020-11-16 10:12 UTC by David Cook
Modified: 2022-06-06 20:24 UTC (History)
4 users (show)

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


Attachments
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc (3.97 KB, patch)
2020-12-24 00:09 UTC, David Cook
Details | Diff | Splinter Review
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc (4.03 KB, patch)
2020-12-30 20:42 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc (4.09 KB, patch)
2021-01-02 18:22 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2020-11-16 10:12:32 UTC
header.inc is still using the [% intranetbookbag %] instead of using Koha.Preference('intranetbookbag').
Comment 1 David Cook 2020-12-24 00:09:21 UTC
Created attachment 114694 [details] [review]
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc

This patch uses the Koha.Preference() macro more often in key includes.
(In the longer term, it will help reduce dependency in problematic C4::Auth code.)

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/mainpage.pl
2. Note "Cart" link in nav bar
3. Click "Cart" and note "Your cart is currently empty" text
4. Click "More" and note "Course Reserves" in dropdown menu
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Click "Select all" above search results
7. Click "Add to cart"
8. Note "Cart" now has 3 displaying next to it
9. Click "Cart"
10. Note there are three titles in the cart
11. Click "Empty and close" and click "OK" to confirm
12. Note "Cart (0)" now appears in the top nav
13. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetNav
14. Save the following content in the system preference: <li><a href="/index.html">New Home</a></li>
15. Refresh the page
16. Note "New Home" appears in the top nav between "Cart" and "More"
Comment 2 Lucas Gass 2020-12-30 20:42:25 UTC
Created attachment 114753 [details] [review]
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc

This patch uses the Koha.Preference() macro more often in key includes.
(In the longer term, it will help reduce dependency in problematic C4::Auth code.)

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/mainpage.pl
2. Note "Cart" link in nav bar
3. Click "Cart" and note "Your cart is currently empty" text
4. Click "More" and note "Course Reserves" in dropdown menu
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Click "Select all" above search results
7. Click "Add to cart"
8. Note "Cart" now has 3 displaying next to it
9. Click "Cart"
10. Note there are three titles in the cart
11. Click "Empty and close" and click "OK" to confirm
12. Note "Cart (0)" now appears in the top nav
13. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetNav
14. Save the following content in the system preference: <li><a href="/index.html">New Home</a></li>
15. Refresh the page
16. Note "New Home" appears in the top nav between "Cart" and "More"

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Katrin Fischer 2021-01-02 18:21:53 UTC
The patch itself is ok, but I wonder if we should remove all remaining instances of the variable and also the code from Auth.pm. I have filed bug 27324 for a possible follow-up.
Comment 4 Katrin Fischer 2021-01-02 18:22:29 UTC
Created attachment 114766 [details] [review]
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc

This patch uses the Koha.Preference() macro more often in key includes.
(In the longer term, it will help reduce dependency in problematic C4::Auth code.)

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/mainpage.pl
2. Note "Cart" link in nav bar
3. Click "Cart" and note "Your cart is currently empty" text
4. Click "More" and note "Course Reserves" in dropdown menu
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Click "Select all" above search results
7. Click "Add to cart"
8. Note "Cart" now has 3 displaying next to it
9. Click "Cart"
10. Note there are three titles in the cart
11. Click "Empty and close" and click "OK" to confirm
12. Note "Cart (0)" now appears in the top nav
13. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetNav
14. Save the following content in the system preference: <li><a href="/index.html">New Home</a></li>
15. Refresh the page
16. Note "New Home" appears in the top nav between "Cart" and "More"

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2021-01-04 13:10:39 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 6 Fridolin Somers 2021-01-07 13:56:59 UTC
Pushed to 20.11.x for 20.11.02
Comment 7 Andrew Fuerste-Henry 2021-01-11 21:18:14 UTC
Doesn't apply cleanly to 20.05, please rebase if needed