Bug 23713

Summary: Subscription add form broken for translations
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: I18N/L10NAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Julian Maurice <julian.maurice>
Severity: critical    
Priority: P5 - low CC: b.pastern4k, colin.campbell, f.demians, fridolin.somers, jonathan.druart, julian.maurice, katrin.fischer, library, lucas, magnus
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26158
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30958
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.05
Attachments: Bug 23713: Subscription add form broken for translations
Bug 23713: Subscription add form broken for translations
Bug 23713: (follow-up) Add missing semicolon
Bug 23713: Subscription add form broken for translations
Bug 23713: (follow-up) Add missing semicolon
Bug 23713: Subscription add form broken for translations
Bug 23713: (follow-up) Add missing semicolon

Description Katrin Fischer 2019-10-01 14:43:07 UTC
It's not possible to add a new subscription using translated templates.

What I see is:

English template:
var mana_enabled = [% IF (Koha.Preference('Mana') == 1 && mana_url) %]1[% ELSE %]0[% END %];

de-DE template:
var mana_enabled = [% IF (Koha.Preference('Mana') == 1 && mana_url) %]1[% ELSE %][% END %];

We are also missing a semicolon in one of the lines, but this doesn't seem to effect the page functionality:

     var MSG_PATTERN_IRREG = _("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid")


Thx to Michael Hoffert and Alexander Arlt from koha-de for reporting it initially and figuring out the root of the issue!
Comment 1 Katrin Fischer 2019-10-01 14:49:25 UTC
To give a bit more info, the Javascript we get from the wrong TT is:

var mana_enabled = ;

So this implodes. It should be:

var mana_enabled = 0;
Comment 2 Owen Leonard 2019-10-01 16:22:58 UTC
Created attachment 93385 [details] [review]
Bug 23713: Subscription add form broken for translations

This patch makes a change to the subscription entry template as a
workaround to a translation bug which is causing JavaScript errors when
using translated templates.

To test, apply the patch and update and install the de-DE template:

> cd misc/translator
> perl translate update de-DE
> perl translate install de-DE

 - Go to Administration -> System preferences and enable the "Deutsch
   (de-DE)" language under I18N/L10N preferences -> language.
 - Switch to the "Deutsch" translation.
 - Go to Zeitschriften (Serials) -> Neues Abonnement (New subscription)
   and open the browser console. There should be no errors.
 - Links which trigger JavaScript events should work correctly:
   "Lieferant suchen," "Nach Datensatz suchen," etc.
Comment 3 Katrin Fischer 2019-10-02 06:27:43 UTC
Thx, Owen! Was going to tackle it this morning in a similar fashion!
Comment 4 Katrin Fischer 2019-10-02 07:39:42 UTC
Great test plan!
Comment 5 Katrin Fischer 2019-10-02 09:24:30 UTC
Created attachment 93399 [details] [review]
Bug 23713: Subscription add form broken for translations

This patch makes a change to the subscription entry template as a
workaround to a translation bug which is causing JavaScript errors when
using translated templates.

To test, apply the patch and update and install the de-DE template:

> cd misc/translator
> perl translate update de-DE
> perl translate install de-DE

 - Go to Administration -> System preferences and enable the "Deutsch
   (de-DE)" language under I18N/L10N preferences -> language.
 - Switch to the "Deutsch" translation.
 - Go to Zeitschriften (Serials) -> Neues Abonnement (New subscription)
   and open the browser console. There should be no errors.
 - Links which trigger JavaScript events should work correctly:
   "Lieferant suchen," "Nach Datensatz suchen," etc.
Comment 6 Katrin Fischer 2019-10-02 09:24:34 UTC
Created attachment 93400 [details] [review]
Bug 23713: (follow-up) Add missing semicolon

Adds a missing semicolon to one of the lines with translated
messages.
Comment 7 Julian Maurice 2019-10-03 09:19:33 UTC
Created attachment 93536 [details] [review]
Bug 23713: Subscription add form broken for translations

This patch makes a change to the subscription entry template as a
workaround to a translation bug which is causing JavaScript errors when
using translated templates.

To test, apply the patch and update and install the de-DE template:

> cd misc/translator
> perl translate update de-DE
> perl translate install de-DE

 - Go to Administration -> System preferences and enable the "Deutsch
   (de-DE)" language under I18N/L10N preferences -> language.
 - Switch to the "Deutsch" translation.
 - Go to Zeitschriften (Serials) -> Neues Abonnement (New subscription)
   and open the browser console. There should be no errors.
 - Links which trigger JavaScript events should work correctly:
   "Lieferant suchen," "Nach Datensatz suchen," etc.

Reported-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Thanks-to: Michael Hoffert and Alexander Arlt from koha-de for reporting
 it initially and figuring out the root of the issue
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 8 Julian Maurice 2019-10-03 09:19:54 UTC
Created attachment 93537 [details] [review]
Bug 23713: (follow-up) Add missing semicolon

Adds a missing semicolon to one of the lines with translated
messages.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 9 Nick Clemens 2019-10-03 09:21:33 UTC
Created attachment 93538 [details] [review]
Bug 23713: Subscription add form broken for translations

This patch makes a change to the subscription entry template as a
workaround to a translation bug which is causing JavaScript errors when
using translated templates.

To test, apply the patch and update and install the de-DE template:

> cd misc/translator
> perl translate update de-DE
> perl translate install de-DE

 - Go to Administration -> System preferences and enable the "Deutsch
   (de-DE)" language under I18N/L10N preferences -> language.
 - Switch to the "Deutsch" translation.
 - Go to Zeitschriften (Serials) -> Neues Abonnement (New subscription)
   and open the browser console. There should be no errors.
 - Links which trigger JavaScript events should work correctly:
   "Lieferant suchen," "Nach Datensatz suchen," etc.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Nick Clemens 2019-10-03 09:21:36 UTC
Created attachment 93539 [details] [review]
Bug 23713: (follow-up) Add missing semicolon

Adds a missing semicolon to one of the lines with translated
messages.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Martin Renvoize 2019-10-03 09:32:05 UTC
Nice work!

Pushed to master for 19.11.00
Comment 12 Katrin Fischer 2019-10-03 09:37:22 UTC
Thx all!
Comment 13 Owen Leonard 2019-10-04 15:07:55 UTC
*** Bug 23703 has been marked as a duplicate of this bug. ***
Comment 14 Katrin Fischer 2019-11-05 18:10:01 UTC
Hi all, this is a major bug confirmed in 18.11 - can this please be backported?
Comment 15 Katrin Fischer 2019-11-05 18:10:50 UTC
*** Bug 23973 has been marked as a duplicate of this bug. ***
Comment 16 Magnus Enger 2019-11-06 07:29:59 UTC
(In reply to Katrin Fischer from comment #14)
> Hi all, this is a major bug confirmed in 18.11 - can this please be
> backported?

+1 for backporting! :-)
Comment 17 Jonathan Druart 2019-11-13 12:38:46 UTC
*** Bug 24032 has been marked as a duplicate of this bug. ***
Comment 18 Jonathan Druart 2019-11-13 12:40:48 UTC
This is weird, and this patch is just cheating. Any ideas how we could avoid that?

Upping severity, backport this one urgently!
Comment 19 Katrin Fischer 2019-11-13 13:24:40 UTC
(In reply to Katrin Fischer from comment #14)
> Hi all, this is a major bug confirmed in 18.11 - can this please be
> backported?

That should read 19.05 - as 18.11 has no Mana, this only needs to go in 19.05
Comment 20 Fridolin Somers 2019-11-15 08:32:37 UTC
Pushed to 19.05.x for 19.05.05
Comment 21 Katrin Fischer 2019-12-02 13:36:40 UTC
Can this PLEASE be finally backported to 18.11 too? This bug means the serials module is unsable for everyone not speaking/using English.
Comment 22 Katrin Fischer 2019-12-03 12:01:30 UTC
(In reply to Katrin Fischer from comment #21)
> Can this PLEASE be finally backported to 18.11 too? This bug means the
> serials module is unsable for everyone not speaking/using English.

I am sorry, but is caused by changes for Mana - but there is no Mana in 18.11.