From fcb43580b83129097a2abf53104ca29f3185d44b Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 23 Dec 2014 21:01:03 -0800 Subject: Thinktel VoIP provisioning, #32084 --- httemplate/edit/elements/export_svc.html | 84 +++++++++++++++++++++++++++ httemplate/edit/elements/part_svc_column.html | 40 +++---------- httemplate/edit/part_svc.cgi | 3 + httemplate/elements/select-phonenum.html | 31 ++++++++++ httemplate/elements/tr-pkg_svc.html | 2 +- httemplate/misc/phonenums.cgi | 2 +- 6 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 httemplate/edit/elements/export_svc.html (limited to 'httemplate') diff --git a/httemplate/edit/elements/export_svc.html b/httemplate/edit/elements/export_svc.html new file mode 100644 index 000000000..5962ae7f8 --- /dev/null +++ b/httemplate/edit/elements/export_svc.html @@ -0,0 +1,84 @@ +<%args> +$part_svc +$svcdb +$clone => undef + +<%init> + +my $svcpart = $clone || $part_svc->svcpart; # may be undef + +# get a list of applicable part_exports +my @part_export; +my $export_info = FS::part_export::export_info($svcdb); +foreach ( keys %{ $export_info } ) { + push @part_export, qsearch('part_export', { exporttype => $_ }); +} +# and a hash of which ones are already assigned to this part_svc +my %export_svc; +if ( $svcpart ) { + %export_svc = map { $_->exportnum => $_ } + qsearch('export_svc', { svcpart => $svcpart }); +} + +my $count = 0; +my $columns = 3; + + + +<& /elements/table.html &> + >Exports + +% # exports +% foreach my $part_export (@part_export) { +% my $exportnum = $part_export->exportnum; + + > + <% $part_export->label_html %> +% if ( $part_export->info->{roles} ) { +% my $role_info = $part_export->info->{roles}; +% my @role_names = keys %$role_info; +% my %role_labels = map { %_ => $role_info->{$_}->{label} } @role_names; +% my $curr_role = $export_svc{$exportnum} ? $export_svc{$exportnum}->role +% : ''; + + as: + <& /elements/select.html, + 'field' => "exportnum${exportnum}_role", + 'options' => \@role_names, + 'labels' => \%role_labels, + 'curr_value' => $curr_role, + 'empty_label' => 'select', + &> + +% # XXX should lock out roles that don't apply to the selected svcdb, +% # but that's a pain in the ass +% } + + + +% $count++; +% if ( $count % $columns == 0 ) { + + +% } +% } + +

diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 6dcb602fe..53cda859e 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -64,26 +64,11 @@ my %communigate_fields = (

-<& /elements/table.html &> - >Exports - -% # exports -% foreach my $part_export (@part_export) { - - exportnum} ? 'CHECKED' : '' %>> - <% $part_export->label_html %> - -% $count++; -% if ( $count % $columns == 0 ) { - - -% } -% } - -

+%# include export selection +<& export_svc.html, + part_svc => $part_svc, + svcdb => $svcdb +&> For the selected table, you can give fields default or fixed (unchangeable) values, or select an inventory class to manually or automatically fill in that field. @@ -285,27 +270,18 @@ that field. <%init> my $svcdb = shift; my %opt = @_; -my $columns = 3; my $count = 0; my $communigate = 0; my $conf = FS::Conf->new; my $part_svc = $opt{'part_svc'} || FS::part_svc->new; -my @part_export; -my $export_info = FS::part_export::export_info($svcdb); -foreach (keys %{ $export_info }) { - push @part_export, qsearch('part_export', { exporttype => $_ }); +# see if there are communigate exports configured +if ( exists $communigate_fields{$svcdb} ) { + $communigate = FS::part_export->count("exporttype like 'communigate%'"); } -$communigate = scalar(grep {$_->exporttype =~ /^communigate/} @part_export); my $svcpart = $opt{'clone'} || $part_svc->svcpart; -my %has_export_svc; -if ( $svcpart ) { - foreach (qsearch('export_svc', { svcpart => $svcpart })) { - $has_export_svc{$_->exportnum} = 1; - } -} my @fields; if ( defined( dbdef->table($svcdb) ) ) { # when is it ever not defined? diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 2ec024269..47b020c5a 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -31,6 +31,9 @@ font-size: smaller; font-style: italic; } +.selectrole { + font-size: small +}