summaryrefslogtreecommitdiff
path: root/httemplate/edit/elements/class_Common.html
blob: 723227f23b77d8d5342ccee4a3075056dc1f32bd (plain)
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
44
45
46
47
48
49
<% 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',
              table       => $category_table,
              hashref     => { 'disabled' => '' },
              name_col    => 'categoryname',
              empty_label => '(none)',
            }
          : { 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>