X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_Common.html;h=5949a4dc0fcaccdb75258ee532cfe55f1c654d7e;hp=9cf88612060a0e5e8c5797858de488d2a37c71b4;hb=ff27c3f36240aee48ed50153dd5d8fe3ac3f2443;hpb=5657663a43689787fdc3c5da73775502daecc588 diff --git a/httemplate/edit/svc_Common.html b/httemplate/edit/svc_Common.html index 9cf886120..5949a4dc0 100644 --- a/httemplate/edit/svc_Common.html +++ b/httemplate/edit/svc_Common.html @@ -1,6 +1,45 @@ <% include('elements/svc_Common.html', 'table' => $table, 'post_url' => popurl(1). "process/svc_Common.html", + %opt, ) %> -%# i don't think this is actuallly used by anything?? +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +# false laziness w/view/svc_Common.html + +$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb"; +my $table = $1; +require "FS/$table.pm"; + +my %opt; +if ( UNIVERSAL::can("FS::$table", 'table_info') ) { + $opt{'name'} = "FS::$table"->table_info->{'name'}; + + my $fields = "FS::$table"->table_info->{'fields'}; + + my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields; + $opt{'labels'} = \%labels; + + #transform FS::svc_* table_info's structure into one edit.html likes + delete $fields->{svcnum}; + $opt{'fields'} = [ map { ref $fields->{$_} + ? { field => $_, + %{ $fields->{$_} } + } + : $_ + } keys %$fields + ]; + + +} + +