1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<% include( 'edit.html',
'fields' => $fields,
'labels' => {
'classnum' => 'Class number',
'classname' => 'Class name',
'categorynum' => 'Category',
'disabled' => 'Disable class',
%addl_labels,
},
'viewall_dir' => 'browse',
%opt,
)
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my %opt = @_;
my $table = $opt{'table'};
my @category;
my $category_table;
unless ( $opt{'nocat'} ) {
( $category_table = $table ) =~ s/class/category/ or die;
@category = qsearch($category_table, { 'disabled' => '' });
}
my $fields = [ 'classname',
(scalar(@category)
? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>$category_table, 'name_col'=>'categoryname' }
: { field=>'categorynum', type=>'hidden' }
),
{ field=>'disabled', type=>'checkbox', value=>'Y', },
];
push @$fields, @{ $opt{'addl_fields'} } if $opt{'addl_fields'};
my %addl_labels = ();
%addl_labels = %{ $opt{'addl_labels'} } if $opt{'addl_labels'};
</%init>
|