From 7934ac2de21debc15ce89405ed0f4c061c4f0236 Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 11 Jan 2011 02:03:44 +0000 Subject: [PATCH] Vitelity API improvements for toll-free and vfax, RT11009 --- FS/FS/part_export/vitelity.pm | 9 ++++++--- httemplate/elements/select-did.html | 14 ++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/FS/FS/part_export/vitelity.pm b/FS/FS/part_export/vitelity.pm index d44335b65..5654affa3 100644 --- a/FS/FS/part_export/vitelity.pm +++ b/FS/FS/part_export/vitelity.pm @@ -15,6 +15,11 @@ tie my %options, 'Tie::IxHash', 'routesip' => { label=>'routesip (optional sub-account)' }, 'type' => { label=>'type (optional DID type to order)' }, 'fax' => { label=>'vfax service', type=>'checkbox' }, + 'restrict_selection' => { type=>'select', + label=>'Restrict DID Selection', + options=>[ '', 'tollfree', 'non-tollfree' ], + } + ; %info = ( @@ -247,15 +252,13 @@ sub _export_insert { $vparams{'type'} = $self->option('type') if defined $self->option('type'); - $command = 'getlocaldid'; $success = 'success'; # this is OK as Vitelity for now is US/CA only; it's not a hack - $command = 'gettollfree' if $vparams{'did'} =~ /^800|^88[8765]/; + $command = 'gettollfree' if $vparams{'did'} =~ /^800|^888|^877|^866|^855/; if($self->option('fax')) { - # supposedly should work for toll-free fax too $command = 'getdid'; $success = 'ok'; } diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html index 546d90e8d..5256ae44d 100644 --- a/httemplate/elements/select-did.html +++ b/httemplate/elements/select-did.html @@ -13,6 +13,9 @@ Example: % if ( $use_selector ) { +% if ( $export->exporttype eq 'vitelity' && +% ( $export->option('restrict_selection') eq 'non-tollfree' +% || !$export->option('restrict_selection')) ) { @@ -59,8 +62,11 @@ Example:
-% if ( $tollfree ) { - or toll-free +% } +% if ( $export->exporttype eq 'vitelity' && +% ( $export->option('restrict_selection') eq 'tollfree' +% || !$export->option('restrict_selection')) ) { + Toll-free <% include('/elements/select-phonenum.html', 'svcpart' => $svcpart, 'empty' => 'Select phone number', @@ -113,8 +119,8 @@ 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 $export; +$export = $exports[0] if scalar(@exports); my $bulknum = $opt{'bulknum'} || 0; -- 2.11.0