X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Felements%2Fsvc_Common.html;h=ca336a1261c9700d533315f065f859b9ba748217;hb=10614457fd7db63cbcc0bf9bfeebbbb99258eaa3;hp=06f4c00b1d278972a47603d86b297acb31bc57f7;hpb=c2e126583354b58ef54ffa7f580b115b8eed1dd3;p=freeside.git diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 06f4c00b1..ca336a126 100644 --- a/httemplate/edit/process/elements/svc_Common.html +++ b/httemplate/edit/process/elements/svc_Common.html @@ -1,6 +1,7 @@ <% include( 'process.html', 'edit_ext' => 'cgi', 'redirect' => popurl(3)."view/$table.cgi?", + 'args_callback' => $args_callback, %opt, ) %> @@ -10,10 +11,31 @@ my %opt = @_; my $table = $opt{'table'}; $opt{'fields'} ||= [ fields($table) ]; push @{ $opt{'fields'} }, qw( pkgnum svcpart ); +push @{ $opt{'fields'} }, @{ "FS::$table"->table_info->{'addl_process_fields'} } + if UNIVERSAL::can("FS::$table", 'table_info') + && "FS::$table"->table_info->{'addl_process_fields'}; foreach (fields($table)) { if ( $cgi->param($_.'_classnum') ) { push @{ $opt{'fields'} }, $_.'_classnum'; } } +my $args_callback = sub { + my ($cgi, $svc) = @_; + my $part_svc = FS::part_svc->by_key($cgi->param('svcpart')) + or die "svcpart required"; + if ( $part_svc->has_router ) { + my $router = FS::router->new({ + map { $_ => $cgi->param("router_$_") } + qw( routernum routername blocknum ) + }); + if ($router->blocknum and length($router->routername) == 0) { + #sensible default + $router->set('routername', $svc->label); + } + return (child_objects => [ $router ]); + } + (); +}; +