summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/phonenums.cgi10
-rw-r--r--httemplate/misc/regions.cgi26
2 files changed, 31 insertions, 5 deletions
diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi
index fd5de2ae6..5084628eb 100644
--- a/httemplate/misc/phonenums.cgi
+++ b/httemplate/misc/phonenums.cgi
@@ -21,13 +21,13 @@ if ( $exchangestring ) {
my %opts = ();
if ( $exchangestring eq 'tollfree' ) {
$opts{'tollfree'} = 1;
- }
- #elsif ( $exchangestring =~ /^([\w\s\:\,\(\)\-]+), ([A-Z][A-Z])$/ ) {
- elsif ( $exchangestring =~ /^(.+), ([A-Z][A-Z])$/ ) {
+ } elsif ( $exchangestring =~ /^_REGION (.*)$/ ) {
+ $opts{'region'} = $1;
+ #} elsif ( $exchangestring =~ /^([\w\s\:\,\(\)\-]+), ([A-Z][A-Z])$/ ) {
+ } elsif ( $exchangestring =~ /^(.+), ([A-Z][A-Z])$/ ) {
$opts{'ratecenter'} = $1;
$opts{'state'} = $2;
- }
- else {
+ } else {
$exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
or die "unparsable exchange: $exchangestring";
my( $areacode, $exchange ) = ( $1, $2 );
diff --git a/httemplate/misc/regions.cgi b/httemplate/misc/regions.cgi
new file mode 100644
index 000000000..2450ea31a
--- /dev/null
+++ b/httemplate/misc/regions.cgi
@@ -0,0 +1,26 @@
+<% objToJson(\@regions) %>
+<%init>
+
+my( $state, $svcpart ) = $cgi->param('arg');
+
+my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
+die "unknown svcpart $svcpart" unless $part_svc;
+
+my @regions = ();
+if ( $state ) {
+
+ my @exports = $part_svc->part_export_did;
+ if ( scalar(@exports) > 1 ) {
+ die "more than one DID-providing export attached to svcpart $svcpart";
+ } elsif ( ! @exports ) {
+ die "no DID providing export attached to svcpart $svcpart";
+ }
+ my $export = $exports[0];
+
+ my $something = $export->get_dids('state'=>$state);
+
+ @regions = @{ $something };
+
+}
+
+</%init>