Bug 36172 - Warn about incorrect values in the opacthemes system preference
Summary: Warn about incorrect values in the opacthemes system preference
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: 21.11
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-27 09:58 UTC by Rudolf Byker
Modified: 2024-02-27 12:26 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolf Byker 2024-02-27 09:58:22 UTC
Relevant IRC discussion:

- https://irc.koha-community.org/koha/2024-02-26#i_2538655
- https://irc.koha-community.org/koha/2024-02-27#i_2538955

tl;dr

- https://irc.koha-community.org/koha/2024-02-27#i_2539035

I had this set in my database from 12 years ago when someone had a custom theme for our Koha:

MariaDB [koha_rsc]> select * from systempreferences where variable='opacthemes';
+------------+----------+---------+--------------------------------------------------+--------+
| variable   | value    | options | explanation                                      | type   |
+------------+----------+---------+--------------------------------------------------+--------+
| opacthemes | prog_rsc |         | Define the current theme for the OPAC interface. | Themes |
+------------+----------+---------+--------------------------------------------------+--------+

When upgrading from 21.05 to 21.11, this caused the return value of `sub get_xsl_filename` in `C4/XSLT.pm` to be "/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl" instead of "/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl" when `OPACXSLTDetailsDisplay` is set to "default". This caused the parts of the page where the XSLT output should be to be completely empty. No errors were shown in any of `/var/log/koha/*/*.log` when reloading those pages.

Workaround: Put full paths like "/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl" in the `OPACXSLT*Display` preferences instead of "default".

Manual fix:

1. Run this query: `update systempreferences set value = "bootstrap" where variable = "opacthemes";`
2. Restart everything: `systemctl restart memcached && systemctl restart apache2 && systemctl restart koha-common`

Proposed permanent fix:
- Have a fallback value for XSLT files when it does not exist on the disk AND show a warning in the logs. OR: Don't have a fallback, and throw an error and crash the program with a sensible error message.
- Show a warning somewhere when "opacthemes" contains an invalid value.

Feel free to close this if it's already fixed in a later version.
Comment 1 Owen Leonard 2024-02-27 12:26:31 UTC
This makes me think that since we don't offer an "official" alternative to the Bootstrap theme maybe we should move the "opacthemes" and "template" preferences to the local use tab.