View | Details | Raw Unified | Return to bug 22862
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (+6 lines)
Lines 315-320 $(document).ready(function(){ Link Here
315
        function(value, element, phone) {
315
        function(value, element, phone) {
316
            var e164 = "^\\+?[1-9]\\d{1,14}$";
316
            var e164 = "^\\+?[1-9]\\d{1,14}$";
317
            var re = new RegExp(e164);
317
            var re = new RegExp(e164);
318
319
            let has_plus = value.charAt(0) === '+';
320
            value = value.replace(/\D/g,'');
321
            if ( has_plus ) value = '+' + value;
322
            element.value = value;
323
318
            return this.optional(element) || re.test(value);
324
            return this.optional(element) || re.test(value);
319
        },
325
        },
320
        jQuery.validator.messages.phone);
326
        jQuery.validator.messages.phone);
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-1 / +22 lines)
Lines 185-190 Link Here
185
    });
185
    });
186
    $("#info_digests").tooltip();
186
    $("#info_digests").tooltip();
187
  });
187
  });
188
189
function normalizeSMS(value){
190
  let has_plus = value.charAt(0) === '+';
191
  let new_value = value.replace(/[^0-9]+/g, '');
192
  if ( has_plus ) new_value = '+' + new_value;
193
  return new_value;
194
}
195
196
var sms_input = document.getElementById('SMSnumber');
197
198
sms_input.addEventListener('keyup', function(){
199
  var field = sms_input.value;
200
  sms_input.value = normalizeSMS(field);
201
});
202
203
sms_input.addEventListener('paste', function(event) {
204
  let paste = (event.clipboardData || window.clipboardData).getData('text');
205
  setTimeout(function () {
206
    sms_input.value = normalizeSMS(paste);
207
  }, 100);
208
});
209
188
//]]>
210
//]]>
189
</script>
211
</script>
190
[% END %]
212
[% END %]
191
- 

Return to bug 22862