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