1 <% include( 'elements/browse.html',
2 'title' => ucfirst($classname) . ' Reasons',
3 'menubar' => [ ucfirst($classname).' Reason Types' =>
4 $p."browse/reason_type.html?class=$class"
6 'html_init' => $html_init,
7 'name' => $classname . ' reasons',
9 'disabled_statuspos' => 3,
10 'query' => { 'table' => 'reason',
12 'extra_sql' => $where_clause.
13 ' ORDER BY reason_type',
14 'addl_from' => 'LEFT JOIN reason_type ON reason_type.typenum = reason.reason_type',
16 'count_query' => $count_query,
18 ucfirst($classname) . ' Reason Type',
19 ucfirst($classname) . ' Reason',
20 ($class eq 'S' ? 'Unsuspension Fee' : ()),
22 'fields' => [ 'reasonnum',
23 sub { shift->reasontype->type },
25 $unsuspend_pkg_comment,
37 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
39 $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
42 my $classname = $FS::reason_type::class_name{$class};
43 my $classpurpose = $FS::reason_type::class_purpose{$class};
45 my $html_init = ucfirst($classname). " reasons $classpurpose.<BR><BR>".
46 qq!<A HREF="${p}edit/reason.html?class=$class">!.
47 "<I>Add a $classname reason</I></A><BR><BR>";
49 my $where_clause = " WHERE class='$class' ";
51 my $count_query = 'SELECT COUNT(*) FROM reason LEFT JOIN reason_type on ' .
52 'reason_type.typenum = reason.reason_type ' . $where_clause;
54 my $link = [ $p."edit/reason.html?class=$class&reasonnum=", 'reasonnum' ];
56 my ($unsuspend_pkg_comment, $unsuspend_pkg_link);
57 if ( $class eq 'S' ) {
58 $unsuspend_pkg_comment = sub {
59 my $pkgpart = shift->unsuspend_pkgpart or return '';
60 my $part_pkg = FS::part_pkg->by_key($pkgpart) or return '';
61 $part_pkg->pkg_comment;
64 my $unsuspend_pkg_link = sub {
65 my $pkgpart = shift->unsuspend_pkgpart or return '';
66 [ $p."edit/part_pkg.cgi?", $pkgpart ];