78d044755648d1c930b11324621bb3f9e6d48a12
[freeside.git] / httemplate / edit / reason.html
1 <& elements/edit.html,
2   'menubar'=> [ "View all $classname Reasons" => 
3                   $p.'browse/reason.html?class='.$class,
4                 "View $classname Reason Types" =>
5                   $p.'browse/reason_type.html?class='.$class,
6               ],
7   'name'   => ucfirst($classname) . ' Reason',
8   
9   'table'  => 'reason',
10   'labels' => { 
11                 'reasonnum'   => $classname .  ' Reason',
12                 'reason_type' => $classname . ' Reason type',
13                 'reason'      => $classname . ' Reason',
14                 'disabled'    => 'Disabled',
15                 'class'       => '',
16                 'unsuspend_pkgpart' => 'Unsuspension fee',
17                 'unsuspend_hold'    => 'Delay until next bill',
18               },
19   'fields' => \@fields,
20 &>
21 <%init>
22
23 die "access denied"
24   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
25
26 $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
27 my $class=$1;
28
29 my $classname = ucfirst($FS::reason_type::class_name{$class});
30
31 my (@types) = qsearch( 'reason_type', { 'class' => $class } );
32
33 unless (scalar(@types)) {
34   print $cgi->redirect( "reason_type.html?class=$class" );
35 }
36
37 my @fields = (
38   { 'field' => 'reason_type',
39     'type'  => 'select-table',
40     'table' => 'reason_type',
41     'name_col'  => 'type',
42     'value_col' => 'typenum',
43     'hashref'   => { 'class' => $class },
44     'disable_empty' => 1,
45 #     #then fix tr-select.html
46 #
47 #    'value' => { 'vcolumn' => 'typenum',
48 #                 'ccolumn' => 'type',
49 #             'values'  => \@types,
50 #           },
51 #     # that wasn't so hard...did this do something else that I'm missing?
52   },
53   'reason',
54   { 'field' => 'class',
55     'type'  => 'hidden',
56     'value' => $class,
57   },
58   { 'field' => 'disabled',
59     'type'  => 'checkbox',
60     'value' => 'Y'
61   },
62 );
63
64 push @fields,
65   { 'field'     => 'unsuspend_pkgpart',
66     'type'      => 'select-part_pkg',
67     'hashref'   => { 'disabled' => '',
68                      'freq'     => 0 }, # one-time charges only
69   },
70   { 'field'     => 'unsuspend_hold',
71     'type'      => 'checkbox',
72     'value'     => 'Y',
73   },
74   if ( $class eq 'S' );
75   
76
77
78 </%init>