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
50
|
%
% $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
% my $class=$1;
%
% my $classname = $FS::reason_type::class_name{$class};
%
% my (@types) = qsearch( 'reason_type', { 'class' => $class } );
%
% unless (scalar(@types)) {
% print $cgi->redirect( "reason_type.html?class=$class" );
% }
<% include( 'elements/edit.html',
'name' => ucfirst($classname) . ' Reason',
'table' => 'reason',
'labels' => {
'reasonnum' => ucfirst($classname) . ' Reason',
'reason_type' => ucfirst($classname) . ' Reason type',
'reason' => ucfirst($classname) . ' Reason',
'disabled' => 'Disabled',
'class' => '',
},
'fields' => [
{ 'field' => 'reason_type',
'type' => 'select',
#XXX use something more sane than a hashref
#then fix tr-select.html
'value' => { 'vcolumn' => 'typenum',
'ccolumn' => 'type',
'values' => \@types,
},
},
'reason',
{ 'field' => 'class',
'type' => 'hidden',
'value' => $class,
},
{ 'field' => 'disabled',
'type' => 'checkbox',
'value' => 'Y'
},
],
'viewall_url' => $p . "browse/reason.html?class=$class",
)
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
</%init>
|