summaryrefslogtreecommitdiff
path: root/httemplate/edit/elements/svc_Common.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
committerMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
commit1af8ff7f48f7259fc99f090c301c84b9680fdb4d (patch)
treee21d72df5e6dd2eddebc8debc3b954bf2e0830e8 /httemplate/edit/elements/svc_Common.html
parent0f0bc1ef7aafc6b3869c0f71ee2528c1c9897ce6 (diff)
svc_circuit, #23879, #25933, #30830
Diffstat (limited to 'httemplate/edit/elements/svc_Common.html')
-rw-r--r--httemplate/edit/elements/svc_Common.html46
1 files changed, 38 insertions, 8 deletions
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,