From 6db91aa3cf3b0c99fe7aeb4cb4f9bbb6fc713762 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 28 Feb 2018 14:26:06 -0300 Subject: [PATCH] Bug 20298: Fix SMS characters counter when TranslateNotices is set If you have multiple languages installed, the notices and slips page uses the same HTML id multiple times, once for each language. This prevents eg. the SMS character count javascript from working, because each of the textareas has the same id. Test plan: Test the sms characters counter, with and without TranslateNotices Make sure other features on this page still work correctly QA: Make sure this change of id did not break something else. Signed-off-by: Brendan Gallagher --- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index e40fd33..fc5e66b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -301,23 +301,23 @@ [% IF letter.is_html %] - + [% ELSE %] - + [% END %]
  • - +
  • [% IF letter.message_transport_type == 'sms' %] - [% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters + [% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters [% END %] - +
    - [% FOREACH SQLfieldname IN SQLfieldnames %] [% END %] @@ -326,7 +326,7 @@
  • @@ -500,13 +500,14 @@ }); var sms_limit = 160; - $("#content_sms").on("keyup", function(){ + $(".content_sms").on("keyup", function(){ var length = $(this).val().length; - $("#sms_counter").html(length + "/" + sms_limit + _(" characters")); + var sms_counter = ("#sms_counter_" + $(this).data('lang')); + $(sms_counter).html(length + "/" + sms_limit + _(" characters")); if ( length > sms_limit ) { - $("#sms_counter").css("color", "red"); + $(sms_counter).css("color", "red"); } else { - $("#sms_counter").css("color", "black"); + $(sms_counter).css("color", "black"); } }); $( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 }); -- 2.1.4