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