summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorlevinse <levinse>2011-01-10 19:46:13 +0000
committerlevinse <levinse>2011-01-10 19:46:13 +0000
commit3aae44e96b429d182a7e36cf0ebb0d4bfef842d9 (patch)
treede0cc61e48ff0973c13c8e4dbe2380994d4a4135 /httemplate
parent9a46dd94e70887c5365c4b10d9db0d1b7f1b71ab (diff)
vitelity API improvements for toll-free and fax, RT11009
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/process/svc_phone.html3
-rw-r--r--httemplate/edit/svc_phone.cgi2
-rw-r--r--httemplate/elements/select-did.html16
-rw-r--r--httemplate/elements/select-phonenum.html39
-rw-r--r--httemplate/misc/phonenums.cgi21
-rw-r--r--httemplate/view/svc_phone.cgi2
6 files changed, 72 insertions, 11 deletions
diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html
index ddc938216..9dd1226cc 100644
--- a/httemplate/edit/process/svc_phone.html
+++ b/httemplate/edit/process/svc_phone.html
@@ -9,6 +9,9 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+my $tollfreephonenum = $cgi->param('tollfreephonenum');
+$cgi->param('phonenum',$tollfreephonenum) if $tollfreephonenum =~ /^\d+$/;
+
my $args_callback = sub {
my( $cgi, $object ) = @_;
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index 8dd58d7ed..1623ed38a 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -38,6 +38,8 @@ push @fields, { field => 'pbxsvc',
maxlength => $conf->config('svc_phone-phone_name-max_length'),
},
'route',
+ 'forwarddst',
+ 'email',
{ value => 'E911 Information',
type => 'tablebreak-tr-title',
diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html
index 062c98a80..546d90e8d 100644
--- a/httemplate/elements/select-did.html
+++ b/httemplate/elements/select-did.html
@@ -58,6 +58,19 @@ Example:
</TR>
</TABLE>
+
+% if ( $tollfree ) {
+ or toll-free
+ <% include('/elements/select-phonenum.html',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select phone number',
+ 'tollfree' => 1,
+ 'prefix' => 'tollfree',
+ 'bulknum' => 0,
+ )
+ %>
+% }
+
% if ( $bulknum ) {
<div id="bulkdid" style="padding-top: 11px">
% my $i;
@@ -100,6 +113,9 @@ if ( scalar(@exports) > 1 ) {
my $use_selector = scalar(@exports) ? 1 : 0;
+my $tollfree = 0;
+$tollfree = 1 if (scalar(@exports) && $exports[0]->exporttype eq 'vitelity');
+
my $bulknum = $opt{'bulknum'} || 0;
#my $field = $opt{'field'} || 'phonenum';
diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html
index 986329043..25a885a39 100644
--- a/httemplate/elements/select-phonenum.html
+++ b/httemplate/elements/select-phonenum.html
@@ -86,13 +86,50 @@
}
+% if ( $opt{'tollfree'} ) {
+ function <% $opt{'prefix'} %>update_phonenums(phonenums) {
+ // lame hack so I can copy the code from above
+ what = document.getElementById('<% $opt{prefix} %>phonenum');
+
+ // blank the current phonenum
+ for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
+ what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
+
+% if ($opt{empty}) {
+ opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
+% }
+
+ // add the new phonenums
+ var phonenumArray = eval('(' + phonenums + ')' );
+ for ( var s = 0; s < phonenumArray.length; s++ ) {
+ var phonenumLabel = phonenumArray[s];
+ if ( phonenumLabel == "" )
+ phonenumLabel = '(n/a)';
+ opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
+ }
+
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
+
+ if ( phonenumArray.length >= 1 ) {
+ what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
+ what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
+ }
+
+ }
+ <% $opt{'prefix'} %>get_phonenums( 'tollfree', <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
+% }
+
</SCRIPT>
+% unless ( $opt{'tollfree'} ) {
<DIV ID="phonenumwait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding phone numbers</B></DIV>
<DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV>
+% }
-<SELECT NAME="<% $opt{'prefix'} %>phonenum" notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+<SELECT ID="<% $opt{'prefix'} %>phonenum" NAME="<% $opt{'prefix'} %>phonenum"
+ notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>"
+ <% $opt{'disabled'} %>>
<OPTION VALUE="">Select phone number</OPTION>
</SELECT>
diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi
index 2ed0f617d..b86d03f5d 100644
--- a/httemplate/misc/phonenums.cgi
+++ b/httemplate/misc/phonenums.cgi
@@ -1,12 +1,8 @@
-%# [ <% join(', ', map { qq("$_") } @exchanges) %> ]
<% objToJson(\@exchanges) %>
<%init>
my( $exchangestring, $svcpart ) = $cgi->param('arg');
-$exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
- or die "unparsable exchange: $exchangestring";
-my( $areacode, $exchange ) = ( $1, $2 );
my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
die "unknown svcpart $svcpart" unless $part_svc;
@@ -18,12 +14,19 @@ if ( scalar(@exports) > 1 ) {
}
my $export = $exports[0];
-my $something = $export->get_dids('areacode'=>$areacode,
- 'exchange'=>$exchange,
- );
-
-#warn Dumper($something);
+my %opts = ();
+if ( $exchangestring eq 'tollfree' ) {
+ $opts{'tollfree'} = 1;
+}
+else {
+ $exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
+ or die "unparsable exchange: $exchangestring";
+ my( $areacode, $exchange ) = ( $1, $2 );
+ $opts{'areacode'} = $areacode;
+ $opts{'exchange'} = $exchange;
+}
+my $something = $export->get_dids(%opts);
my @exchanges = @{ $something };
</%init>
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index c2379a079..7b0ea7071 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -19,7 +19,7 @@ my %labels = map { $_ => ( ref($fields->{$_})
my @fields = qw( countrycode phonenum );
push @fields, 'domain' if $conf->exists('svc_phone-domain');
-push @fields, qw( pbx_title sip_password pin phone_name route );
+push @fields, qw( pbx_title sip_password pin phone_name route forwarddst email );
if ( $conf->exists('svc_phone-lnp') ) {
push @fields, 'lnp_status',