[Bug 42292] New: Tidy all script tags - opac
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Bug ID: 42292 Summary: Tidy all script tags - opac Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Blocks: 42094 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 [Bug 42094] Tidy all script tags (except value_builder) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196801 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196801&action=edit Bug 42292: Tidy all script tags - OPAC In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the OPAC module. Non-trivial changes, we modify the whole OPAC in a single patch. Testing this patch should focus on: * date formatting * the cover images on the search result and shelves views -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196802 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196802&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Patch from commit 1cabb37 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41653 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41653 [Bug 41653] Stores for permissions and sysprefs should be under the Koha namespace -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196801|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196802|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #3 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197693 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197693&action=edit Bug 42292: Tidy all script tags - OPAC In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the OPAC module. Non-trivial changes, we modify the whole OPAC in a single patch. Testing this patch should focus on: * date formatting * the cover images on the search result and shelves views Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #4 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197694 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197694&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #5 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197695 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197695&action=edit Bug 42292: (follow-up) Replace removed dateformat_pref var in OPAC calendar.inc The OPAC port moved the dateformat pref into Koha.addPrefs and dropped the local `var dateformat_pref = ...;` declaration, but four usages of `dateformat_pref` remain in the same file (the debug alert, two `switch` statements, and the get_dateformat_str call in validate_date). At runtime the switches throw ReferenceError, so flatpickr ends up with the default 'Y-m-d' format and date validation via validate_date crashes before showing the invalid-date alert. Replace all remaining occurrences with Koha.prefs.dateformat, which is populated by the new addPrefs block at the top of the include. To test: - Set dateformat syspref to each of us / metric / dmydot / iso. - Open any OPAC page using a flatpickr input (e.g. hold date, patron dob on the registration form). - Confirm the widget renders dates in the expected format and entering an invalid string triggers the validate_date alert. - No ReferenceError in the browser console on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #6 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197696 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197696&action=edit Bug 42292: (follow-up) Rename opac-shelves print flag to avoid shadowing window.print The port declares `var print = [% print ? 1 : 0 | html %];` at the top of the tt-allowed block, then later calls `window.print()` inside `if (print) { ... }`. Declaring `var print` at top-level overwrites the built-in `window.print` with 0 or 1, so the subsequent `window.print()` call throws "print is not a function" and the print view never fires its actual print dialog. Rename the flag to `should_print` and update the single `if (print)` check accordingly. To test: - Open a public list with items in the OPAC. - Click "Print this list" (or load the page with op=print). - The browser print dialog opens and the window closes afterwards. - No "print is not a function" error in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #7 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197697 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197697&action=edit Bug 42292: (follow-up) Fix duplicate NovelistSelectProfile declaration In the new tt-allowed block, the NovelistSelect fallback declarations redeclare `NovelistSelectProfile` instead of also exposing `NovelistSelectPassword`: var NovelistSelectProfile = "[% NovelistSelectProfile | html %]"; var NovelistSelectProfile = "[% NovelistSelectPassword | html %]"; So `NovelistSelectProfile` ends up holding the password, and `NovelistSelectPassword` is never declared. The later `novSelect.loadContentForQuery(..., NovelistSelectProfile, NovelistSelectPassword, ...)` call then throws ReferenceError and NovelistSelect content never loads on biblio detail pages. Rename the second declaration to `NovelistSelectPassword` to match the original template behaviour. To test: - Configure the NovelistSelect sysprefs (NovelistSelectEnabled, NovelistSelectProfile, NovelistSelectPassword) in the OPAC. Real NovelistSelect content only loads with valid EBSCO subscription credentials -- with dummy values the JS path still runs but the tab stays empty; that is still sufficient to verify this fix. - Open an OPAC biblio detail page with a known ISBN. - In the browser console, run console.log(NovelistSelectProfile, NovelistSelectPassword) and confirm both values are printed (before the fix, NovelistSelectPassword is undefined). - With valid subscription credentials, NovelistSelect content loads in its tab/panel instead of throwing a ReferenceError in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #8 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197698 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197698&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 <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de --- Comment #9 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Failing QA for qa script failure we need to handle. Processing files [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc [FAIL] koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc [RUNNING] koha-tmpl/opac-tmpl/bootstrap/en/includes/password_check.inc [FAIL] koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc ... Result: [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc [FAIL] koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc FAIL valid_template cssinclude: not found [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc [PASS] koha-tmpl/opac-tmpl/bootstrap/en/includes/js-date-format.inc [FAIL] koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc FAIL valid_template jsinclude: not found doc-head-close.inc uses [% PROCESS cssinclude %] (line 74) opac-bottom.inc uses [% PROCESS jsinclude %] (line 183). Those macros are defined by the calling module template via [% MACRO cssinclude BLOCK %]…[% END %] / [% MACRO jsinclude BLOCK %]…[% END %] and resolved at runtime through the caller's scope. When QohA's valid_template check renders each of these includes standalone there is no caller scope, so PROCESS does not find the macros and Template Toolkit throws. I tried a try catch around the PROCESS calls but that would alter runtime behaviour which we probably don't want. How should we fix it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- xt/author/valid-templates.t is passing so I think we can ignore the QA failure. I think I've seen them raised by the QA script already. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #10)
xt/author/valid-templates.t is passing so I think we can ignore the QA failure. I think I've seen them raised by the QA script already.
82 if ( $theme->{'theme'} eq 'bootstrap' ) { 83 run_template_test( 84 $theme->{'modules'}, 85 $theme->{'includes'}, 86 87 # templates or dirs to exclude from testing because 88 # they cannot stand alone 89 'doc-head-close.inc', 90 'opac-bottom.inc', They are actually ignored by the tests. They should be ignored from the QA script as well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #12 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Alright, makes sense. Thanks. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Fixed on https://gitlab.com/koha-community/qa-test-tools/-/merge_requests/101 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197694|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197695|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197696|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197697|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197698|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198507 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198507&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198508 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198508&action=edit Bug 42292: (follow-up) Replace removed dateformat_pref var in OPAC calendar.inc The OPAC port moved the dateformat pref into Koha.addPrefs and dropped the local `var dateformat_pref = ...;` declaration, but four usages of `dateformat_pref` remain in the same file (the debug alert, two `switch` statements, and the get_dateformat_str call in validate_date). At runtime the switches throw ReferenceError, so flatpickr ends up with the default 'Y-m-d' format and date validation via validate_date crashes before showing the invalid-date alert. Replace all remaining occurrences with Koha.prefs.dateformat, which is populated by the new addPrefs block at the top of the include. To test: - Set dateformat syspref to each of us / metric / dmydot / iso. - Open any OPAC page using a flatpickr input (e.g. hold date, patron dob on the registration form). - Confirm the widget renders dates in the expected format and entering an invalid string triggers the validate_date alert. - No ReferenceError in the browser console on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198509 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198509&action=edit Bug 42292: (follow-up) Rename opac-shelves print flag to avoid shadowing window.print The port declares `var print = [% print ? 1 : 0 | html %];` at the top of the tt-allowed block, then later calls `window.print()` inside `if (print) { ... }`. Declaring `var print` at top-level overwrites the built-in `window.print` with 0 or 1, so the subsequent `window.print()` call throws "print is not a function" and the print view never fires its actual print dialog. Rename the flag to `should_print` and update the single `if (print)` check accordingly. To test: - Open a public list with items in the OPAC. - Click "Print this list" (or load the page with op=print). - The browser print dialog opens and the window closes afterwards. - No "print is not a function" error in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #17 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198510 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198510&action=edit Bug 42292: (follow-up) Fix duplicate NovelistSelectProfile declaration In the new tt-allowed block, the NovelistSelect fallback declarations redeclare `NovelistSelectProfile` instead of also exposing `NovelistSelectPassword`: var NovelistSelectProfile = "[% NovelistSelectProfile | html %]"; var NovelistSelectProfile = "[% NovelistSelectPassword | html %]"; So `NovelistSelectProfile` ends up holding the password, and `NovelistSelectPassword` is never declared. The later `novSelect.loadContentForQuery(..., NovelistSelectProfile, NovelistSelectPassword, ...)` call then throws ReferenceError and NovelistSelect content never loads on biblio detail pages. Rename the second declaration to `NovelistSelectPassword` to match the original template behaviour. To test: - Configure the NovelistSelect sysprefs (NovelistSelectEnabled, NovelistSelectProfile, NovelistSelectPassword) in the OPAC. Real NovelistSelect content only loads with valid EBSCO subscription credentials -- with dummy values the JS path still runs but the tab stays empty; that is still sufficient to verify this fix. - Open an OPAC biblio detail page with a known ISBN. - In the browser console, run console.log(NovelistSelectProfile, NovelistSelectPassword) and confirm both values are printed (before the fix, NovelistSelectPassword is undefined). - With valid subscription credentials, NovelistSelect content loads in its tab/panel instead of throwing a ReferenceError in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #18 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198511 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198511&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 <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197693|0 |1 is obsolete| | Attachment #198507|0 |1 is obsolete| | Attachment #198508|0 |1 is obsolete| | Attachment #198509|0 |1 is obsolete| | Attachment #198510|0 |1 is obsolete| | Attachment #198511|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #19 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200396 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200396&action=edit Bug 42292: Tidy all script tags - OPAC In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the OPAC module. Non-trivial changes, we modify the whole OPAC in a single patch. Testing this patch should focus on: * date formatting * the cover images on the search result and shelves views Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #20 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200397 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200397&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #21 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200398 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200398&action=edit Bug 42292: (follow-up) Replace removed dateformat_pref var in OPAC calendar.inc The OPAC port moved the dateformat pref into Koha.addPrefs and dropped the local `var dateformat_pref = ...;` declaration, but four usages of `dateformat_pref` remain in the same file (the debug alert, two `switch` statements, and the get_dateformat_str call in validate_date). At runtime the switches throw ReferenceError, so flatpickr ends up with the default 'Y-m-d' format and date validation via validate_date crashes before showing the invalid-date alert. Replace all remaining occurrences with Koha.prefs.dateformat, which is populated by the new addPrefs block at the top of the include. To test: - Set dateformat syspref to each of us / metric / dmydot / iso. - Open any OPAC page using a flatpickr input (e.g. hold date, patron dob on the registration form). - Confirm the widget renders dates in the expected format and entering an invalid string triggers the validate_date alert. - No ReferenceError in the browser console on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #22 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200399 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200399&action=edit Bug 42292: (follow-up) Rename opac-shelves print flag to avoid shadowing window.print The port declares `var print = [% print ? 1 : 0 | html %];` at the top of the tt-allowed block, then later calls `window.print()` inside `if (print) { ... }`. Declaring `var print` at top-level overwrites the built-in `window.print` with 0 or 1, so the subsequent `window.print()` call throws "print is not a function" and the print view never fires its actual print dialog. Rename the flag to `should_print` and update the single `if (print)` check accordingly. To test: - Open a public list with items in the OPAC. - Click "Print this list" (or load the page with op=print). - The browser print dialog opens and the window closes afterwards. - No "print is not a function" error in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #23 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200400 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200400&action=edit Bug 42292: (follow-up) Fix duplicate NovelistSelectProfile declaration In the new tt-allowed block, the NovelistSelect fallback declarations redeclare `NovelistSelectProfile` instead of also exposing `NovelistSelectPassword`: var NovelistSelectProfile = "[% NovelistSelectProfile | html %]"; var NovelistSelectProfile = "[% NovelistSelectPassword | html %]"; So `NovelistSelectProfile` ends up holding the password, and `NovelistSelectPassword` is never declared. The later `novSelect.loadContentForQuery(..., NovelistSelectProfile, NovelistSelectPassword, ...)` call then throws ReferenceError and NovelistSelect content never loads on biblio detail pages. Rename the second declaration to `NovelistSelectPassword` to match the original template behaviour. To test: - Configure the NovelistSelect sysprefs (NovelistSelectEnabled, NovelistSelectProfile, NovelistSelectPassword) in the OPAC. Real NovelistSelect content only loads with valid EBSCO subscription credentials -- with dummy values the JS path still runs but the tab stays empty; that is still sufficient to verify this fix. - Open an OPAC biblio detail page with a known ISBN. - In the browser console, run console.log(NovelistSelectProfile, NovelistSelectPassword) and confirm both values are printed (before the fix, NovelistSelectPassword is undefined). - With valid subscription credentials, NovelistSelect content loads in its tab/panel instead of throwing a ReferenceError in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #24 from Jonathan Druart <jonathan.druart@gmail.com> --- 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 <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bibliothek@th-wildau.de QA Contact|testopia@bugs.koha-communit |bibliothek@th-wildau.de |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200396|0 |1 is obsolete| | Attachment #200397|0 |1 is obsolete| | Attachment #200398|0 |1 is obsolete| | Attachment #200399|0 |1 is obsolete| | Attachment #200400|0 |1 is obsolete| | Attachment #200401|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #25 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200910 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200910&action=edit Bug 42292: Tidy all script tags - OPAC In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the OPAC module. Non-trivial changes, we modify the whole OPAC in a single patch. Testing this patch should focus on: * date formatting * the cover images on the search result and shelves views Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #26 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200911&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #27 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200912&action=edit Bug 42292: (follow-up) Replace removed dateformat_pref var in OPAC calendar.inc The OPAC port moved the dateformat pref into Koha.addPrefs and dropped the local `var dateformat_pref = ...;` declaration, but four usages of `dateformat_pref` remain in the same file (the debug alert, two `switch` statements, and the get_dateformat_str call in validate_date). At runtime the switches throw ReferenceError, so flatpickr ends up with the default 'Y-m-d' format and date validation via validate_date crashes before showing the invalid-date alert. Replace all remaining occurrences with Koha.prefs.dateformat, which is populated by the new addPrefs block at the top of the include. To test: - Set dateformat syspref to each of us / metric / dmydot / iso. - Open any OPAC page using a flatpickr input (e.g. hold date, patron dob on the registration form). - Confirm the widget renders dates in the expected format and entering an invalid string triggers the validate_date alert. - No ReferenceError in the browser console on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #28 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200913 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200913&action=edit Bug 42292: (follow-up) Rename opac-shelves print flag to avoid shadowing window.print The port declares `var print = [% print ? 1 : 0 | html %];` at the top of the tt-allowed block, then later calls `window.print()` inside `if (print) { ... }`. Declaring `var print` at top-level overwrites the built-in `window.print` with 0 or 1, so the subsequent `window.print()` call throws "print is not a function" and the print view never fires its actual print dialog. Rename the flag to `should_print` and update the single `if (print)` check accordingly. To test: - Open a public list with items in the OPAC. - Click "Print this list" (or load the page with op=print). - The browser print dialog opens and the window closes afterwards. - No "print is not a function" error in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #29 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200914 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200914&action=edit Bug 42292: (follow-up) Fix duplicate NovelistSelectProfile declaration In the new tt-allowed block, the NovelistSelect fallback declarations redeclare `NovelistSelectProfile` instead of also exposing `NovelistSelectPassword`: var NovelistSelectProfile = "[% NovelistSelectProfile | html %]"; var NovelistSelectProfile = "[% NovelistSelectPassword | html %]"; So `NovelistSelectProfile` ends up holding the password, and `NovelistSelectPassword` is never declared. The later `novSelect.loadContentForQuery(..., NovelistSelectProfile, NovelistSelectPassword, ...)` call then throws ReferenceError and NovelistSelect content never loads on biblio detail pages. Rename the second declaration to `NovelistSelectPassword` to match the original template behaviour. To test: - Configure the NovelistSelect sysprefs (NovelistSelectEnabled, NovelistSelectProfile, NovelistSelectPassword) in the OPAC. Real NovelistSelect content only loads with valid EBSCO subscription credentials -- with dummy values the JS path still runs but the tab stays empty; that is still sufficient to verify this fix. - Open an OPAC biblio detail page with a known ISBN. - In the browser console, run console.log(NovelistSelectProfile, NovelistSelectPassword) and confirm both values are printed (before the fix, NovelistSelectPassword is undefined). - With valid subscription credentials, NovelistSelect content loads in its tab/panel instead of throwing a ReferenceError in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #30 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200915&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 <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #31 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200916&action=edit Bug 42292: (QA follow-up) Fix Uncaught TypeError on opac-readingrecord This prevents an 'Uncaught TypeError: can't access property "DataTable", table is undefined' when a patron has no items checked out yet and is visiting opac-readingrecord. To test: a) log in in opac, open dev console b) go to /cgi-bin/koha/opac-readingrecord.pl c) without patch applied the error above occurs with patch applied no error is thrown -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #32 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200917 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200917&action=edit Bug 42292: (QA follow-up) Fix evaluation of OpacHighlightedWords to be numeric in opac-results OpacHighlightedWords was set in quotation marks and resulted in either "1" or "0". As "0" and "1" always evaluates to true in JS the following error was thrown when OpacHighlightedWords was set to Don't highlight: Uncaught TypeError: $(...).highlight is not a function To test: a) Set system preference OpacHighlightedWords to Don't highlight b) search a title in the opac with open dev console and check that no error (like above) is thrown. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #33 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200918 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200918&action=edit Bug 42292: (QA follow-up) Remove unnecessary brace in opac-shelves confirmModal had an unnecessary brace at the end which led to an 'Uncaught SyntaxError: missing ) after argument list' error. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #34 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200919 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200919&action=edit Bug 42292: (QA follow-up) remove unused reference OverDriveEnabled in opac-shelves As OverDriveEnabled is declared via SET in the template and not a system preference and after all not used in that script it is removed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #35 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200920 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200920&action=edit Bug 42292: (QA follow-up) replace remaining OD_password_required with Koha.prefs.OverDrivePasswordRequired As in opac-user.tt OD_password_required was replaced by Koha.prefs.OverDrivePasswordRequired. The script overdrive.js checks already for the Koha.prefs variable. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200910|0 |1 is obsolete| | Attachment #200911|0 |1 is obsolete| | Attachment #200912|0 |1 is obsolete| | Attachment #200913|0 |1 is obsolete| | Attachment #200914|0 |1 is obsolete| | Attachment #200915|0 |1 is obsolete| | Attachment #200916|0 |1 is obsolete| | Attachment #200917|0 |1 is obsolete| | Attachment #200918|0 |1 is obsolete| | Attachment #200919|0 |1 is obsolete| | Attachment #200920|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #36 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200955 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200955&action=edit Bug 42292: Tidy all script tags - OPAC In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the OPAC module. Non-trivial changes, we modify the whole OPAC in a single patch. Testing this patch should focus on: * date formatting * the cover images on the search result and shelves views Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #37 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200956 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200956&action=edit Bug 42292: Tidy all script tags - OPAC (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #38 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200957 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200957&action=edit Bug 42292: (follow-up) Replace removed dateformat_pref var in OPAC calendar.inc The OPAC port moved the dateformat pref into Koha.addPrefs and dropped the local `var dateformat_pref = ...;` declaration, but four usages of `dateformat_pref` remain in the same file (the debug alert, two `switch` statements, and the get_dateformat_str call in validate_date). At runtime the switches throw ReferenceError, so flatpickr ends up with the default 'Y-m-d' format and date validation via validate_date crashes before showing the invalid-date alert. Replace all remaining occurrences with Koha.prefs.dateformat, which is populated by the new addPrefs block at the top of the include. To test: - Set dateformat syspref to each of us / metric / dmydot / iso. - Open any OPAC page using a flatpickr input (e.g. hold date, patron dob on the registration form). - Confirm the widget renders dates in the expected format and entering an invalid string triggers the validate_date alert. - No ReferenceError in the browser console on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #39 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200958 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200958&action=edit Bug 42292: (follow-up) Rename opac-shelves print flag to avoid shadowing window.print The port declares `var print = [% print ? 1 : 0 | html %];` at the top of the tt-allowed block, then later calls `window.print()` inside `if (print) { ... }`. Declaring `var print` at top-level overwrites the built-in `window.print` with 0 or 1, so the subsequent `window.print()` call throws "print is not a function" and the print view never fires its actual print dialog. Rename the flag to `should_print` and update the single `if (print)` check accordingly. To test: - Open a public list with items in the OPAC. - Click "Print this list" (or load the page with op=print). - The browser print dialog opens and the window closes afterwards. - No "print is not a function" error in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #40 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200959 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200959&action=edit Bug 42292: (follow-up) Fix duplicate NovelistSelectProfile declaration In the new tt-allowed block, the NovelistSelect fallback declarations redeclare `NovelistSelectProfile` instead of also exposing `NovelistSelectPassword`: var NovelistSelectProfile = "[% NovelistSelectProfile | html %]"; var NovelistSelectProfile = "[% NovelistSelectPassword | html %]"; So `NovelistSelectProfile` ends up holding the password, and `NovelistSelectPassword` is never declared. The later `novSelect.loadContentForQuery(..., NovelistSelectProfile, NovelistSelectPassword, ...)` call then throws ReferenceError and NovelistSelect content never loads on biblio detail pages. Rename the second declaration to `NovelistSelectPassword` to match the original template behaviour. To test: - Configure the NovelistSelect sysprefs (NovelistSelectEnabled, NovelistSelectProfile, NovelistSelectPassword) in the OPAC. Real NovelistSelect content only loads with valid EBSCO subscription credentials -- with dummy values the JS path still runs but the tab stays empty; that is still sufficient to verify this fix. - Open an OPAC biblio detail page with a known ISBN. - In the browser console, run console.log(NovelistSelectProfile, NovelistSelectPassword) and confirm both values are printed (before the fix, NovelistSelectPassword is undefined). - With valid subscription credentials, NovelistSelect content loads in its tab/panel instead of throwing a ReferenceError in the console. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #41 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200960 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200960&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 <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #42 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200961 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200961&action=edit Bug 42292: (QA follow-up) Fix Uncaught TypeError on opac-readingrecord This prevents an 'Uncaught TypeError: can't access property "DataTable", table is undefined' when a patron has no items checked out yet and is visiting opac-readingrecord. To test: a) log in in opac, open dev console b) go to /cgi-bin/koha/opac-readingrecord.pl c) without patch applied the error above occurs with patch applied no error is thrown -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #43 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200962 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200962&action=edit Bug 42292: (QA follow-up) Fix evaluation of OpacHighlightedWords to be numeric in opac-results OpacHighlightedWords was set in quotation marks and resulted in either "1" or "0". As "0" and "1" always evaluates to true in JS the following error was thrown when OpacHighlightedWords was set to Don't highlight: Uncaught TypeError: $(...).highlight is not a function To test: a) Set system preference OpacHighlightedWords to Don't highlight b) search a title in the opac with open dev console and check that no error (like above) is thrown. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #44 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200963 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200963&action=edit Bug 42292: (QA follow-up) remove unused reference OverDriveEnabled in opac-shelves As OverDriveEnabled is declared via SET in the template and not a system preference and after all not used in that script it is removed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #45 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200964 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200964&action=edit Bug 42292: (QA follow-up) replace remaining OD_password_required with Koha.prefs.OverDrivePasswordRequired As in opac-user.tt OD_password_required was replaced by Koha.prefs.OverDrivePasswordRequired. The script overdrive.js checks already for the Koha.prefs variable. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 --- Comment #46 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jan Kissig from comment #33)
Created attachment 200918 [details] [review] Bug 42292: (QA follow-up) Remove unnecessary brace in opac-shelves
confirmModal had an unnecessary brace at the end which led to an 'Uncaught SyntaxError: missing ) after argument list' error.
This is not expected, so I have investigated: * I have applied only the first patch * perl misc/devel/tidy.pl $(git diff --name-only HEAD~1) => No extra bracket * git commit -a [also with --date], and adjusted the commit message with the second patch * applied the other patches "Remove unnecessary brace in opac-shelves" has been skipped (changed already applied) Thanks for the QA and the follow-ups, Jan! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org