https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292
--- Comment #24 from Jonathan Druart <[email protected]> --- Created attachment 200401 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200401&action=edit Bug 42292: (follow-up) Fix OverDrive/OpenLibrary references in opac-results.tt Three issues introduced by the OPAC port of opac-results.tt: - The tt-allowed block sets OverDriveEnabled via `Koha.Preference("OverDriveEnabled")`, but OverDriveEnabled is a TT-side SET variable (computed from OverDriveLibraryID + OverDriveClientKey + OverDriveClientSecret), not a system preference, so Koha.prefs.OverDriveEnabled is always "". The code at line 621 then reads an unprefixed `OverDriveEnabled` identifier which is not declared -- the OverDrive result block never fires. - The neighbouring block `if (OpenLibrarySearch) { ... }` reads an unprefixed identifier for a value that is only exposed on Koha.prefs, so the OpenLibrary result block also never fires. - Both blocks build a throbber <img> with `src=\`${interface}/${theme}/images/spinner-small.gif\`` inside a single-quoted JS string; the backticks are literal characters there, so the rendered src ends up as that literal template text, not a usable URL. Replace the OverDriveEnabled addPrefs entry with a plain `const OverDriveEnabled = [% OverDriveEnabled ? 1 : 0 | html %];` that reads the TT SET variable, prefix OpenLibrarySearch with Koha.prefs, and rebuild the throbber src via normal string concatenation. To test: - With OverDrive configured (OPACOverDrive, OverDriveLibraryID, OverDriveClientKey, OverDriveClientSecret), run a search in the OPAC: the OverDrive results panel shows the spinner and then the API results. - With OpenLibrarySearch enabled, the OpenLibrary panel does the same. - In both cases the spinner image loads (no broken-image icon). - Disable both prefs -> neither panel is rendered, no console errors. Signed-off-by: Paul Derscheid <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
