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,
26 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
28 $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
31 my $classname = $FS::reason_type::class_name{$class};
32 my $classpurpose = $FS::reason_type::class_purpose{$class};
34 my $html_init = ucfirst($classname). " reasons $classpurpose.<BR><BR>".
35 qq!<A HREF="${p}edit/reason.html?class=$class">!.
36 "<I>Add a $classname reason</I></A><BR><BR>";
38 my $where_clause = " WHERE class='$class' ";
40 my $count_query = 'SELECT COUNT(*) FROM reason LEFT JOIN reason_type on ' .
41 'reason_type.typenum = reason.reason_type ' . $where_clause;
43 my $link = [ $p."edit/reason.html?class=$class&reasonnum=", 'reasonnum' ];
47 ucfirst($classname) . ' reason type',
48 ucfirst($classname) . ' reason',
53 sub { shift->reasontype->type },
65 if ( $class eq 'S' ) {
67 'Credit unused service',
73 if ( $reason->unused_credit ) {
74 return '<SPAN STYLE="background-color:#00ff00">YES</SPAN>';
76 return '<SPAN STYLE="background-color:#ff0000">NO</SPAN>';
81 my $pkgpart = $reason->unsuspend_pkgpart or return '';
82 my $part_pkg = FS::part_pkg->by_key($pkgpart) or return '';
83 my $text = $part_pkg->pkg_comment;
84 my $href = $p."edit/part_pkg.cgi?$pkgpart";
85 $text = qq!<A HREF="$href">! . encode_entities($text) . "</A>".
87 if ( $reason->unsuspend_hold ) {
88 $text .= ' (on next bill)'
90 $text .= ' (immediately)'