diff options
author | ivan <ivan> | 2010-03-08 07:02:58 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-03-08 07:02:58 +0000 |
commit | 611624bc08f525d19e1bd548a7d005aa73a53145 (patch) | |
tree | f53bcfab25e8038ae485f707da619e37f46741a9 /httemplate | |
parent | 919bcddcb7a1ec551d27faac925fedc7d9644f3c (diff) |
domain names in netsapiens export (domain name association w/svc_phone), RT#5864
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 5 | ||||
-rw-r--r-- | httemplate/edit/svc_phone.cgi | 39 | ||||
-rw-r--r-- | httemplate/elements/select-svc-domain.html | 50 | ||||
-rw-r--r-- | httemplate/elements/tr-select-svc-domain.html | 34 | ||||
-rw-r--r-- | httemplate/view/svc_phone.cgi | 16 |
5 files changed, 122 insertions, 22 deletions
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 453d07f88..2e98a1b25 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -81,7 +81,10 @@ $f->{'disable_empty'} = $object->svcnum ? 1 : 0, } - if ( $f->{'type'} eq 'select-svc_pbx' ) { + if ( $f->{'type'} eq 'select-svc_pbx' + || $f->{'type'} eq 'select-svc-domain' + ) + { $f->{'include_opt_callback'} = sub { ( 'pkgnum' => $pkgnum, 'svcpart' => $svcpart, diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi index 55ee890f4..3c7b75249 100644 --- a/httemplate/edit/svc_phone.cgi +++ b/httemplate/edit/svc_phone.cgi @@ -1,22 +1,11 @@ <% include( 'elements/svc_Common.html', 'name' => 'Phone number', 'table' => 'svc_phone', - 'fields' => [ 'countrycode', - { field => 'phonenum', - type => 'select-did', - label => 'Phone number', - }, - { field => 'pbxsvc', - type => 'select-svc_pbx', - label => 'PBX', - }, - 'sip_password', - 'pin', - 'phone_name', - ], + 'fields' => \@fields, 'labels' => { 'countrycode' => 'Country code', 'phonenum' => 'Phone number', + 'domsvc' => 'Domain', 'sip_password' => 'SIP password', 'pin' => 'Voicemail PIN', 'phone_name' => 'Name', @@ -29,4 +18,28 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $conf = new FS::Conf; + +my @fields = ( 'countrycode', + { field => 'phonenum', + type => 'select-did', + label => 'Phone number', + }, + ); + +push @fields, { field => 'domsvc', + type => 'select-svc-domain', + label => 'Domain', + } + if $conf->exists('svc_phone-domain'); + +push @fields, { field => 'pbxsvc', + type => 'select-svc_pbx', + label => 'PBX', + }, + 'sip_password', + 'pin', + 'phone_name', +; + </%init> diff --git a/httemplate/elements/select-svc-domain.html b/httemplate/elements/select-svc-domain.html new file mode 100644 index 000000000..4c04466db --- /dev/null +++ b/httemplate/elements/select-svc-domain.html @@ -0,0 +1,50 @@ +<SELECT NAME="domsvc" SIZE=1> +% foreach my $svcnum ( +% sort { $svc_domain{$a} cmp $svc_domain{$b} } +% keys %svc_domain +% ) { + + <OPTION VALUE="<% $svcnum %>" + <% ($svcnum == $domsvc) ? ' SELECTED' : '' %> + ><% $svc_domain{$svcnum} %> + +% } + +</SELECT> +<%init> + +my %opt = @_; + +my %svc_domain = (); +my $domsvc; + +my $domsvc = $opt{'curr_value'}; +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + +my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + +my %svc_domain = (); + +if ( $domsvc ) { + my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $domsvc } ); + if ( $svc_domain ) { + $svc_domain{$svc_domain->svcnum} = $svc_domain; + } else { + warn "unknown svc_domain.svcnum for svc_acct.domsvc: $domsvc"; + } +} + +%svc_domain = ( + %svc_domain, + FS::svc_Domain_Mixin->domain_select_hash( 'svcpart' => $part_svc->svcpart, + 'pkgnum' => $pkgnum, + ) +); + +</%init> diff --git a/httemplate/elements/tr-select-svc-domain.html b/httemplate/elements/tr-select-svc-domain.html new file mode 100644 index 000000000..437bc5896 --- /dev/null +++ b/httemplate/elements/tr-select-svc-domain.html @@ -0,0 +1,34 @@ +%if ( $columnflag eq 'F' ) { + <INPUT TYPE="hidden" NAME="domsvc" VALUE="<% $domsvc %>"> +% } else { + + <TR> + <TD ALIGN="right"><% $opt{'label'} || 'Domain' %></TD> + <TD> + <% include('/elements/select-svc-domain.html', + 'curr_value' => $domsvc, + 'part_svc' => $part_svc, + 'cust_pkg' => $cust_pkg, + ) + %> + </TD> + </TR> +% } +<%init> + +my %opt = @_; + +my $domsvc = $opt{'curr_value'}; + +#required +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); + +my $columnflag = $part_svc->part_svc_column('domsvc')->columnflag; + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + +</%init> diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index 2733e258e..76ee7397d 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -1,16 +1,10 @@ <% include('elements/svc_Common.html', 'table' => 'svc_phone', - 'fields' => [qw( - countrycode - phonenum - pbx_title - sip_password - pin - phone_name - )], + 'fields' => \@fields, 'labels' => { 'countrycode' => 'Country code', 'phonenum' => 'Phone number', + 'domain' => 'Domain', 'pbx_title' => 'PBX', 'sip_password' => 'SIP password', 'pin' => 'PIN', @@ -21,6 +15,12 @@ %> <%init> +my $conf = new FS::Conf; + +my @fields = qw( countrycode phonenum ); +push @fields, 'domain' if $conf->exists('svc_phone-domain'); +push @fields, qw( pbx_title sip_password pin phone_name ); + my $html_foot = sub { my $svc_phone = shift; |