If a library does not have the OverDrivePasswordRequired system preference = 'Required' then translated OPAC Overdrive search result pages throw a JavaScript error and do not display results. The problematic line (below) in the English template is: var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %]; Which is translated to the following in the en-NZ (and other languages) template: var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %][% END %]; Like in bug 23713 the line is translated to: var OD_password_required = ; When it should be: var OD_password_required = 0;
Created attachment 136056 [details] [review] Bug 30958: OPAC overdrive search result page broken for translations Note: You will need a valid OverDrive subscription to test this. This patch fixes a JavaScript error thrown on the OPAC overdrive search results page for libraries using translation templates and who don't have the OverDrivePasswordRequired system preference = 'Required'. Test plan: 1. Install the en-NZ translation: https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client 2. Enable the en-NZ language: - In the OPACLanguages system preference -> tick 'English New Zealand (en-NZ)' checkbox and untick 'English (en)' 3. Fill in the OverDrive system preferences: - Make sure you set: OverDrivePasswordRequired = "Not required" 4. Perform an OPAC search 5. Click on the Overdrive results link 6. Open the browser console and notice there is a JS error, and the OverDrive results do not load 7. Apply patch 8. Update the en_NZ translation: 9. Repeat steps 4, 5 and 6 and notice there is no JavaScript error and the OverDrive results do display Sponsored-by: Melbourne Athenaeum Library, Australia
Created attachment 136068 [details] [review] Bug 30958: OPAC overdrive search result page broken for translations Note: You will need a valid OverDrive subscription to test this. This patch fixes a JavaScript error thrown on the OPAC overdrive search results page for libraries using translation templates and who don't have the OverDrivePasswordRequired system preference = 'Required'. Test plan: 1. Install the en-NZ translation: https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client 2. Enable the en-NZ language: - In the OPACLanguages system preference -> tick 'English New Zealand (en-NZ)' checkbox and untick 'English (en)' 3. Fill in the OverDrive system preferences: - Make sure you set: OverDrivePasswordRequired = "Not required" 4. Perform an OPAC search 5. Click on the Overdrive results link 6. Open the browser console and notice there is a JS error, and the OverDrive results do not load 7. Apply patch 8. Update the en_NZ translation: 9. Repeat steps 4, 5 and 6 and notice there is no JavaScript error and the OverDrive results do display Sponsored-by: Melbourne Athenaeum Library, Australia Signed-off-by: Owen Leonard <oleonard@myacpl.org>
There are a couple of other instances that I saw which should also be addressed. I searched the NZ templates for "1[% ELSE %][% END %]"
I've filed Bug 30991 - [% ELSE %]0[% END %] will break translations if used for assigning variables for fixing any other occurrences so this can move on.
Created attachment 136310 [details] [review] Bug 30958: OPAC overdrive search result page broken for translations Note: You will need a valid OverDrive subscription to test this. This patch fixes a JavaScript error thrown on the OPAC overdrive search results page for libraries using translation templates and who don't have the OverDrivePasswordRequired system preference = 'Required'. Test plan: 1. Install the en-NZ translation: https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client 2. Enable the en-NZ language: - In the OPACLanguages system preference -> tick 'English New Zealand (en-NZ)' checkbox and untick 'English (en)' 3. Fill in the OverDrive system preferences: - Make sure you set: OverDrivePasswordRequired = "Not required" 4. Perform an OPAC search 5. Click on the Overdrive results link 6. Open the browser console and notice there is a JS error, and the OverDrive results do not load 7. Apply patch 8. Update the en_NZ translation: 9. Repeat steps 4, 5 and 6 and notice there is no JavaScript error and the OverDrive results do display Sponsored-by: Melbourne Athenaeum Library, Australia Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for 22.05.03
backported to 21.11.x for 21.11.11
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document, marking resolved.
(In reply to Victor Grousset/tuxayo from comment #9) > Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. > > Nothing to document, marking resolved. Hi Victor, We have a client (Melbourne Athenaeum Library - who sponsored this fix) running 21.05.x who would love to have this fix before their next Koha upgrade. Would it be possible for you to backport this fix to 21.05.x please? Many thanks! Alex
Sure, will try in the next days :)
(In reply to Victor Grousset/tuxayo from comment #11) > Sure, will try in the next days :) Thanks very much Victor :)
Backported: Pushed to 21.05.x branch for 21.05.18
(In reply to Victor Grousset/tuxayo from comment #13) > Backported: Pushed to 21.05.x branch for 21.05.18 Thanks Victor!