From: Ivan Kohler Date: Sat, 26 Jan 2013 03:47:54 +0000 (-0800) Subject: allow manual override of phone number, RT#19883 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=db3e520bad7240b3f6f0d53a2b55a64ef116890b allow manual override of phone number, RT#19883 --- diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 5d650626e..3eee37f71 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -630,6 +630,10 @@ sub info { #default fallbacks... FS::part_export::DID_Common ? sub get_dids_can_tollfree { 0; } +sub get_dids_can_manual { 0; } +sub get_dids_can_edit { 0; } #don't use without can_manual, otherwise the + # DID selector provisions a new number from + # inventory each edit sub get_dids_npa_select { 1; } =back diff --git a/FS/FS/part_export/fibernetics_did.pm b/FS/FS/part_export/fibernetics_did.pm index fb0378550..a51457a03 100644 --- a/FS/FS/part_export/fibernetics_did.pm +++ b/FS/FS/part_export/fibernetics_did.pm @@ -28,6 +28,8 @@ tie my %options, 'Tie::IxHash', sub rebless { shift; } sub get_dids_can_tollfree { 0; }; +sub get_dids_can_manual { 1; }; +sub get_dids_can_edit { 1; }; sub get_dids_npa_select { 0; }; # i guess we could get em from the API, but since its returning states without diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html index 7a3b43d32..611b5142b 100644 --- a/httemplate/edit/process/svc_phone.html +++ b/httemplate/edit/process/svc_phone.html @@ -28,6 +28,9 @@ my $right = $opt{'bulk'} ? 'Bulk provision customer service' die "access denied" unless $FS::CurrentUser::CurrentUser->access_right($right); +$cgi->param('phonenum', $cgi->param('phonenum_manual') ) + if $cgi->param('phonenum_which') eq 'phonenum_manual'; + my $tollfreephonenum = $cgi->param('tollfreephonenum'); $cgi->param('phonenum',$tollfreephonenum) if $tollfreephonenum =~ /^\d+$/; diff --git a/httemplate/elements/select-areacode.html b/httemplate/elements/select-areacode.html index a302befc2..f0f56d56d 100644 --- a/httemplate/elements/select-areacode.html +++ b/httemplate/elements/select-areacode.html @@ -17,7 +17,7 @@ what.form.<% $opt{'prefix'} %>areacode.disabled = 'disabled'; what.form.<% $opt{'prefix'} %>areacode.style.display = 'none'; var areacodewait = document.getElementById('<% $opt{'prefix'} %>areacodewait'); - areacodewait.style.display = ''; + areacodewait.style.display = 'inline'; var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror'); areacodeerror.style.display = 'none'; @@ -61,7 +61,7 @@ what.form.<% $opt{'prefix'} %>areacode.style.display = ''; } else { var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror'); - areacodeerror.style.display = ''; + areacodeerror.style.display = 'inline'; } //run the callback diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html index 6e205d8ff..fe1e5d163 100644 --- a/httemplate/elements/select-did.html +++ b/httemplate/elements/select-did.html @@ -18,6 +18,27 @@ Example: +% my( $phonenum_checked, $manual_checked ) = ( '', '' ); +% if ( $export->get_dids_can_manual ) { +% #not 100% perfect UI on error handling, but it'll do +% if ( $opt{'curr_value'} ) { +% $phonenum_checked = ''; +% $manual_checked = 'CHECKED'; +% } else { +% $phonenum_checked = 'CHECKED'; +% $manual_checked = ''; +% } + + +% } + % if ( $export->get_dids_npa_select ) { % } else { +% +% #this code path currently only being used by fibernetics +% # should change "Province" label to "State" or make it configurable +% # if/when other folks need an areacode-less DID selector that goes +% # directly from state to region % } @@ -86,10 +114,131 @@ Example: 'region' => ! $export->get_dids_npa_select, ) %> -
Phone number +
>Phone number + +% if ( $export->get_dids_can_manual ) { + + + + + + + + + +% } +
+ + > Inventory + @@ -27,9 +48,10 @@ Example: 'svcpart' => $svcpart, 'disable_empty' => 0, 'empty_label' => 'Select state', + 'disabled' => ( $manual_checked ? 1 : 0 ), ) %> -
State +
>State
@@ -39,19 +61,24 @@ Example: 'empty' => 'Select area code', ) %> -
Area code +
>Area code
<% include('/elements/select-exchange.html', - 'svcpart' => $svcpart, - 'empty' => 'Select exchange', + 'svcpart' => $svcpart, + 'empty' => 'Select exchange', ) %> -
City / Exchange +
>City / Exchange
<% include('/elements/select.html', @@ -60,9 +87,10 @@ Example: 'options' => [ '', @{ $export->get_dids } ], 'labels' => { '' => 'Select province' }, 'onchange' => 'phonenum_state_changed(this);', + 'disabled' => ( $manual_checked ? 1 : 0 ), ) %> -
Province +
>Province
@@ -72,7 +100,7 @@ Example: 'empty' => 'Select region', ) %> -
Region +
>Region
+ + > Manual entry + + <& /elements/input-text.html, + %opt, + field => 'phonenum_manual', + id => 'phonenum_manual', + type => 'text', + disabled => ( $phonenum_checked ? 1 : 0 ), + &> +
% } diff --git a/httemplate/elements/select-exchange.html b/httemplate/elements/select-exchange.html index 9e4b5ce97..b9677094a 100644 --- a/httemplate/elements/select-exchange.html +++ b/httemplate/elements/select-exchange.html @@ -17,7 +17,7 @@ what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled'; what.form.<% $opt{'prefix'} %>exchange.style.display = 'none'; var exchangewait = document.getElementById('<% $opt{'prefix'} %>exchangewait'); - exchangewait.style.display = ''; + exchangewait.style.display = 'inline'; var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror'); exchangeerror.style.display = 'none'; @@ -56,7 +56,7 @@ what.form.<% $opt{'prefix'} %>exchange.style.display = ''; } else { var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror'); - exchangeerror.style.display = ''; + exchangeerror.style.display = 'inline'; } //run the callback diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html index 18abe3dea..a8d9a7c3e 100644 --- a/httemplate/elements/select-phonenum.html +++ b/httemplate/elements/select-phonenum.html @@ -17,7 +17,7 @@ what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled'; what.form.<% $opt{'prefix'} %>phonenum.style.display = 'none'; var phonenumwait = document.getElementById('<% $opt{'prefix'} %>phonenumwait'); - phonenumwait.style.display = ''; + phonenumwait.style.display = 'inline'; var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror'); phonenumerror.style.display = 'none'; @@ -54,7 +54,7 @@ what.form.<% $opt{'prefix'} %>phonenum.style.display = ''; } else { var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror'); - phonenumerror.style.display = ''; + phonenumerror.style.display = 'inline'; } //run the callback diff --git a/httemplate/elements/select-region.html b/httemplate/elements/select-region.html index 9823290db..7ed959269 100644 --- a/httemplate/elements/select-region.html +++ b/httemplate/elements/select-region.html @@ -17,7 +17,7 @@ what.form.<% $opt{'prefix'} %>region.disabled = 'disabled'; what.form.<% $opt{'prefix'} %>region.style.display = 'none'; var regionwait = document.getElementById('<% $opt{'prefix'} %>regionwait'); - regionwait.style.display = ''; + regionwait.style.display = 'inline'; var regionerror = document.getElementById('<% $opt{'prefix'} %>regionerror'); regionerror.style.display = 'none'; @@ -56,7 +56,7 @@ what.form.<% $opt{'prefix'} %>region.style.display = ''; } else { var regionerror = document.getElementById('<% $opt{'prefix'} %>regionerror'); - regionerror.style.display = ''; + regionerror.style.display = 'inline'; } //run the callback diff --git a/httemplate/elements/tr-select-did.html b/httemplate/elements/tr-select-did.html index 987ade689..2aa712f79 100644 --- a/httemplate/elements/tr-select-did.html +++ b/httemplate/elements/tr-select-did.html @@ -1,6 +1,6 @@ <% include('tr-td-label.html', @_ ) %> -% if ( $opt{'curr_value'} ne '' && $use_selector ) { +% if ( $use_selector && $opt{'curr_value'} ne '' && ! $can_edit ) { ><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %> @@ -38,4 +38,6 @@ if ( scalar(@exports) > 1 ) { my $use_selector = scalar(@exports) ? 1 : 0; +my $can_edit = scalar(@exports) && $exports[0]->get_dids_can_edit; +