X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Felements%2Fsvc_Common.html;h=504ded031a35ace2b8a8bb853b8543540db9712f;hp=06f4c00b1d278972a47603d86b297acb31bc57f7;hb=fe58901b811f0ab26e8f93a9563fb93bc98e4c19;hpb=35b1ca7d644c773f4e0aebf6d8798c93f76a7cd8 diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 06f4c00b1..504ded031 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 { $_ => scalar($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 ]); + } + (); +}; +