SMS Number Munging user/mrpeters-isl/sms_munge_signoff
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 2 Oct 2012 17:31:13 +0000 (13:31 -0400)
committerMichael Peters <mrpeters@library.in.gov>
Tue, 2 Oct 2012 18:23:54 +0000 (14:23 -0400)
Munge "pretty printed" numbers into raw sets of digits in the A/T helper.

This allows aliases to still work for services that support them.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Michael Peters <mrpeters@library.in.gov>
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm

index a56a2cd..8161317 100644 (file)
@@ -323,6 +323,12 @@ $_TT_helpers = {
         };
         my $carriers = new_editor()->json_query($query);
 
+        # If this looks like a pretty-formatted number drop the pretty-formatting
+        # Otherwise assume it may be a literal alias instead of a real number
+        if ($sms_notify =~ m/^[- ()0-9]*$/) {
+            $sms_notify =~ s/[- ()]//g;
+        }
+
         my @addresses = ();
         foreach my $carrier ( @{ $carriers } ) {
             my $address = $carrier->{email_gateway};