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',
21 'fields' => [ 'reasonnum',
22 sub { shift->reasontype->type },
34 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
36 $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
39 my $classname = $FS::reason_type::class_name{$class};
40 my $classpurpose = $FS::reason_type::class_purpose{$class};
42 my $html_init = ucfirst($classname). " reasons $classpurpose.<BR><BR>".
43 qq!<A HREF="${p}edit/reason.html?class=$class">!.
44 "<I>Add a $classname reason</I></A><BR><BR>";
46 my $where_clause = " WHERE class='$class' ";
48 my $count_query = 'SELECT COUNT(*) FROM reason LEFT JOIN reason_type on ' .
49 'reason_type.typenum = reason.reason_type ' . $where_clause;
51 my $link = [ $p."edit/reason.html?class=$class&reasonnum=", 'reasonnum' ];