diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/circuit_provider.html | 21 | ||||
-rw-r--r-- | httemplate/edit/circuit_termination.html | 21 | ||||
-rw-r--r-- | httemplate/edit/circuit_type.html | 21 | ||||
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 5 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 46 | ||||
-rw-r--r-- | httemplate/edit/process/circuit_provider.html | 11 | ||||
-rw-r--r-- | httemplate/edit/process/circuit_termination.html | 11 | ||||
-rw-r--r-- | httemplate/edit/process/circuit_type.html | 11 | ||||
-rw-r--r-- | httemplate/edit/process/elements/svc_Common.html | 2 | ||||
-rw-r--r-- | httemplate/edit/process/svc_circuit.html | 11 | ||||
-rw-r--r-- | httemplate/edit/svc_circuit.cgi | 54 | ||||
-rw-r--r-- | httemplate/edit/svc_phone.cgi | 36 |
12 files changed, 228 insertions, 22 deletions
diff --git a/httemplate/edit/circuit_provider.html b/httemplate/edit/circuit_provider.html new file mode 100644 index 000000000..6c8dcedac --- /dev/null +++ b/httemplate/edit/circuit_provider.html @@ -0,0 +1,21 @@ +<& elements/edit.html, + 'popup' => 1, + 'table' => 'circuit_provider', + 'name_singular' => 'provider', + 'labels' => \%labels, + 'fields' => \@fields, +&> +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my @fields = ( + 'provider', + { field => 'disabled', type => 'checkbox', value => 'Y' } +); +my %labels = ( + 'providernum' => '', + 'provider' => 'Provider name', + 'disabled' => 'Disabled' +); +</%init> diff --git a/httemplate/edit/circuit_termination.html b/httemplate/edit/circuit_termination.html new file mode 100644 index 000000000..0317bced5 --- /dev/null +++ b/httemplate/edit/circuit_termination.html @@ -0,0 +1,21 @@ +<& elements/edit.html, + 'popup' => 1, + 'table' => 'circuit_termination', + 'name_singular' => 'termination type', + 'labels' => \%labels, + 'fields' => \@fields, +&> +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my @fields = ( + 'termination', + { field => 'disabled', type => 'checkbox', value => 'Y' } +); +my %labels = ( + 'termnum' => '', + 'termination' => 'Termination type', + 'disabled' => 'Disabled' +); +</%init> diff --git a/httemplate/edit/circuit_type.html b/httemplate/edit/circuit_type.html new file mode 100644 index 000000000..897758897 --- /dev/null +++ b/httemplate/edit/circuit_type.html @@ -0,0 +1,21 @@ +<& elements/edit.html, + 'popup' => 1, + 'table' => 'circuit_type', + 'name_singular' => 'circuit type', + 'labels' => \%labels, + 'fields' => \@fields, +&> +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my @fields = ( + 'typename', + { field => 'disabled', type => 'checkbox', value => 'Y' } +); +my %labels = ( + 'typenum' => '', + 'typename' => 'Circuit type', + 'disabled' => 'Disabled' +); +</%init> diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 64901a80f..6dcb602fe 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -249,7 +249,10 @@ that field. </TR> % } % # special case: services with attached routers (false laziness...) -% if ( $svcdb eq 'svc_acct' or $svcdb eq 'svc_broadband' or $svcdb eq 'svc_dsl' ) { +% if ( $svcdb eq 'svc_acct' +% or $svcdb eq 'svc_broadband' +% or $svcdb eq 'svc_dsl' +% or $svcdb eq 'svc_circuit' ) { % push @fields, 'has_router'; <TR> <TD COLSPAN=3 ALIGN="right"> diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index fc29327ae..97b630f76 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -103,10 +103,42 @@ my $flag = $columndef->columnflag; if ( $flag eq 'F' ) { #fixed - $f->{'type'} = length($columndef->columnvalue) - ? 'fixed' - : 'hidden'; $f->{'value'} = $columndef->columnvalue; + if (length($columndef->columnvalue)) { + + if ( $f->{'type'} =~ /^select-?(.*)/ ) { + # try to display this in a user-friendly manner + if ( $f->{'table'} ) { # find matching records + $f->{'value_col'} ||= + dbdef->table($f->{'table'})->primary_key; + + my @values = split(',', $f->{'value'}); + my @recs; + foreach (@values) { + push @recs, qsearchs( $f->{'table'}, + { $f->{'value_col'} => $_ } + ); + } + if ( @recs ) { + my $method = $f->{'name_col'}; + if ( $f->{'multiple'} ) { + $f->{'formatted_value'} = [ + map { $_->method } @recs + ]; + } else { # there shouldn't be more than one... + $f->{'formatted_value'} = $recs[0]->$method; + } + } # if not, then just let tr-fixed display the + # values as-is + + } # other select types probably don't matter + } # if it's a select + + $f->{'type'} = 'fixed'; + + } else { # fixed, null + $f->{'type'} = 'hidden'; + } } elsif ( $flag eq 'A' ) { #auto assign from inventory $f->{'type'} = 'hidden'; @@ -127,16 +159,14 @@ }; } elsif ( $flag eq 'S' #selectable choice - && $f->{type} !~ /^select-svc(-domain|_pbx)$/ ) { + && $f->{type} !~ /^select-svc/ ) { $f->{type} = 'select'; $f->{options} = [ split( /\s*,\s*/, $columndef->columnvalue) ]; - } + } # shouldn't this be enforced for all 'S' fields? - if ( $f->{'type'} eq 'select-svc_pbx' - || $f->{'type'} eq 'select-svc-domain' - ) + if ( $f->{'type'} =~ /^select-svc/ ) { $f->{'include_opt_callback'} = sub { ( 'pkgnum' => $pkgnum, diff --git a/httemplate/edit/process/circuit_provider.html b/httemplate/edit/process/circuit_provider.html new file mode 100644 index 000000000..0a91a178d --- /dev/null +++ b/httemplate/edit/process/circuit_provider.html @@ -0,0 +1,11 @@ +<& elements/process.html, + 'table' => 'circuit_provider', + 'viewall_dir' => 'browse', + 'popup_reload' => 'Updating', +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/process/circuit_termination.html b/httemplate/edit/process/circuit_termination.html new file mode 100644 index 000000000..94d29c05c --- /dev/null +++ b/httemplate/edit/process/circuit_termination.html @@ -0,0 +1,11 @@ +<& elements/process.html, + 'table' => 'circuit_termination', + 'viewall_dir' => 'browse', + 'popup_reload' => 'Updating', +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/process/circuit_type.html b/httemplate/edit/process/circuit_type.html new file mode 100644 index 000000000..58f461e2c --- /dev/null +++ b/httemplate/edit/process/circuit_type.html @@ -0,0 +1,11 @@ +<& elements/process.html, + 'table' => 'circuit_type', + 'viewall_dir' => 'browse', + 'popup_reload' => 'Updating', +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 55ecc5f79..ca336a126 100644 --- a/httemplate/edit/process/elements/svc_Common.html +++ b/httemplate/edit/process/elements/svc_Common.html @@ -29,7 +29,7 @@ my $args_callback = sub { map { $_ => $cgi->param("router_$_") } qw( routernum routername blocknum ) }); - if (length($router->routername) == 0) { + if ($router->blocknum and length($router->routername) == 0) { #sensible default $router->set('routername', $svc->label); } diff --git a/httemplate/edit/process/svc_circuit.html b/httemplate/edit/process/svc_circuit.html new file mode 100644 index 000000000..d28f91329 --- /dev/null +++ b/httemplate/edit/process/svc_circuit.html @@ -0,0 +1,11 @@ +<& elements/svc_Common.html, + table => 'svc_circuit', + edit_ext => 'html', + redirect => popurl(3)."view/svc_circuit.html?", +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +</%init> diff --git a/httemplate/edit/svc_circuit.cgi b/httemplate/edit/svc_circuit.cgi new file mode 100644 index 000000000..3f9bad5b1 --- /dev/null +++ b/httemplate/edit/svc_circuit.cgi @@ -0,0 +1,54 @@ +<& elements/svc_Common.html, + 'table' => 'svc_circuit', + 'fields' => \@fields, +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my @fields = ( + { field => 'providernum', + type => 'select-table', + table => 'circuit_provider', + name_col => 'provider', + disable_empty => 1, + }, + { field => 'typenum', + type => 'select-table', + table => 'circuit_type', + name_col => 'typename', + disable_empty => 1, + }, + { field => 'termnum', + type => 'select-table', + table => 'circuit_termination', + name_col => 'termination', + disable_empty => 1, + }, + { field => 'circuit_id', + size => 40, + }, + { field => 'desired_due_date', + type => 'input-date-field', + }, + { field => 'due_date', + type => 'input-date-field', + }, + 'vendor_order_id', + 'vendor_qual_id', + 'vendor_order_status', + 'endpoint_ip_addr', + { field => 'endpoint_mac_addr', + type => 'input-mac_addr', + }, +); + +# needed: a new_callback to migrate vendor quals over to circuits + +#my ($svc_new_callback, $svc_edit_callback, $svc_error_callback); + +</%init> diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi index f8582057e..f9c0d4005 100644 --- a/httemplate/edit/svc_phone.cgi +++ b/httemplate/edit/svc_phone.cgi @@ -2,17 +2,12 @@ 'table' => 'svc_phone', 'fields' => [], 'begin_callback' => $begin_callback, - 'svc_new_callback' => sub { - my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_; - $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg; - }, - 'svc_edit_callback' => sub { - my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_; - my $conf = new FS::Conf; - $svc_x->sip_password('*HIDDEN*') unless $conf->exists('showpasswords'); - }, + 'svc_new_callback' => $svc_callback, + 'svc_edit_callback' => $svc_callback, + 'svc_error_callback' => $svc_callback, &> <%init> +my $conf = new FS::Conf; my $begin_callback = sub { my( $cgi, $fields, $opt ) = @_; @@ -25,8 +20,6 @@ my $begin_callback = sub { die "access denied" unless $FS::CurrentUser::CurrentUser->access_right($right); - my $conf = new FS::Conf; - push @$fields, 'countrycode', { field => 'phonenum', @@ -149,7 +142,26 @@ my $begin_callback = sub { } -}; +}; # begin_callback +# svc_edit_callback / svc_new_callback +my $svc_callback = sub { + my ($cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_; + push @$fields, { + field => 'circuit_svcnum', + type => 'select-svc_circuit', + cust_pkg => $cust_pkg, + part_svc => $part_svc, + }; + + if ( $cust_pkg and not $svc_x->svcnum ) { + # new service, default to package location + $svc_x->set('locationnum', $cust_pkg->locationnum); + } + + if ( not $conf->exists('showpasswords') and $svc_x->svcnum ) { + $svc_x->sip_password('*HIDDEN*'); + } +}; </%init> |