import torrus 1.0.9
[freeside.git] / httemplate / edit / svc_Common.html
1 <% include('elements/svc_Common.html',
2              'table'        => $table,
3              'post_url'     => popurl(1). "process/svc_Common.html",
4              %opt,
5           )
6 %>
7 <%init>
8
9 die "access denied"
10   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
11
12 # false laziness w/view/svc_Common.html
13
14 $cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb";
15 my $table = $1;
16 require "FS/$table.pm";
17
18 my %opt;
19 if ( UNIVERSAL::can("FS::$table", 'table_info') ) {
20   $opt{'name'}   = "FS::$table"->table_info->{'name'};
21
22   my $fields = "FS::$table"->table_info->{'fields'};
23   my %labels = map { $_ => ( ref($fields->{$_})
24                                ? $fields->{$_}{'label'}
25                                : $fields->{$_}
26                            );
27                    }
28                keys %$fields;
29   $opt{'labels'} = \%labels;
30
31 }
32
33 </%init>