+$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
+my $class=$1;
+
+my $classname = ucfirst($FS::reason_type::class_name{$class});
+
+my (@types) = qsearch( 'reason_type', { 'class' => $class } );
+
+unless (scalar(@types)) {
+ print $cgi->redirect( "reason_type.html?class=$class" );
+}
+
+my @fields = (
+ { 'field' => 'reason_type',
+ 'type' => 'select-table',
+ 'table' => 'reason_type',
+ 'name_col' => 'type',
+ 'value_col' => 'typenum',
+ 'hashref' => { 'class' => $class },
+ 'disable_empty' => 1,
+# #then fix tr-select.html
+#
+# 'value' => { 'vcolumn' => 'typenum',
+# 'ccolumn' => 'type',
+# 'values' => \@types,
+# },
+# # that wasn't so hard...did this do something else that I'm missing?
+ },
+ 'reason',
+ { 'field' => 'class',
+ 'type' => 'hidden',
+ 'value' => $class,
+ },
+ { 'field' => 'disabled',
+ 'type' => 'checkbox',
+ 'value' => 'Y'
+ },
+);
+
+if ( $class eq 'S' or $class eq 'C' ) {
+ push @fields,
+ { 'field' => 'unused_credit',
+ 'type' => 'checkbox',
+ 'value' => 'Y',
+ };
+}
+if ( $class eq 'S' ) {
+ { 'type' => 'tablebreak-tr-title' },
+ { 'field' => 'feepart',
+ 'type' => 'select-table',
+ 'table' => 'part_fee',
+ 'hashref' => { disabled => '' },
+ 'name_col' => 'itemdesc',
+ 'value_col' => 'feepart',
+ 'empty_label' => 'none',
+ },
+ { 'field' => 'fee_on_unsuspend',
+ 'type' => 'select',
+ 'options' => [ '', 'Y' ],
+ 'labels' => { '' => 'suspended', 'Y' => 'unsuspended' },
+ },
+ { 'field' => 'fee_hold',
+ 'type' => 'checkbox',
+ 'value' => 'Y',
+ },
+ { 'field' => 'unsuspend_pkgpart',
+ 'type' => 'select-part_pkg',
+ 'hashref' => { 'disabled' => '',
+ 'freq' => 0 }, # one-time charges only
+ },
+ { 'field' => 'unsuspend_hold',
+ 'type' => 'checkbox',
+ 'value' => 'Y',
+ },
+ ;
+}
+