From ebcc7486589042be154ff55c32f8982111a8061a 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 on 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 --- 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.17.1