From 7b8780daa14dad446c0c7b0cdf4f01fe90531ed3 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 25 Oct 2019 13:36:11 +0000 Subject: [PATCH] Bug 23901: Fix sms_input is null in opac-messaging.tt When sms messaging is disabled, JavaScript breaks in opac-messaging.tt. Bug introduced in Bug 22862. To test: 1. Enable EnhancedMessagingPreferences system preference 2. Disable sms messaging by unsetting SMSSendDriver system preference 3. Go to OPAC -> your messaging 4. Observe JavaScript error "sms_input is null" in your browser console 5. Apply patch 6. Refresh page and observe the error is gone Sponsored-by: Koha-Suomi Oy Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index d33c7b7b88..ef2b776144 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -193,6 +193,7 @@ function normalizeSMS(value){ var sms_input = document.getElementById('SMSnumber'); +if (typeof sms_input !== 'undefined' && sms_input !== null) { sms_input.addEventListener('keyup', function(){ var field = sms_input.value; sms_input.value = normalizeSMS(field); @@ -204,6 +205,7 @@ sms_input.addEventListener('paste', function(event) { sms_input.value = normalizeSMS(paste); }, 100); }); +} //]]> -- 2.39.5