package contract end date field, RT#9918
[freeside.git] / httemplate / edit / reason.html
1 %
2 % $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
3 % my $class=$1;
4 %
5 % my $classname = $FS::reason_type::class_name{$class};
6 %
7 % my (@types) = qsearch( 'reason_type', { 'class' => $class } );
8 %
9 % unless (scalar(@types)) {
10 %   print $cgi->redirect( "reason_type.html?class=$class" );
11 % }
12 <% include( 'elements/edit.html',
13                  'name'   => ucfirst($classname) . ' Reason',
14                  'table'  => 'reason',
15                  'labels' => { 
16                                'reasonnum'   => ucfirst($classname) .  ' Reason',
17                                'reason_type' => ucfirst($classname) . ' Reason type',
18                                'reason'      => ucfirst($classname) . ' Reason',
19                                'disabled'    => 'Disabled',
20                                'class'       => '',
21                              },
22                  'fields' => [
23                                { 'field' => 'reason_type',
24                                  'type'  => 'select',
25                                  #XXX use something more sane than a hashref
26                                  #then fix tr-select.html
27                                  'value' => { 'vcolumn' => 'typenum',
28                                               'ccolumn' => 'type',
29                                               'values'  => \@types,
30                                             },
31                                },
32                                'reason',
33                                { 'field' => 'class',
34                                  'type'  => 'hidden',
35                                  'value' => $class,
36                                },
37                                { 'field' => 'disabled',
38                                  'type'  => 'checkbox',
39                                  'value' => 'Y'
40                                },
41                              ],
42                  'viewall_url' => $p . "browse/reason.html?class=$class",
43            )
44 %>
45 <%init>
46
47 die "access denied"
48   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
49
50 </%init>