X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-reason.html;h=4051e7d20d78bd9e3a9f5c16d8e2f94fe98c64a8;hb=1d920e3661c29398763d05c82bbe3a493a19fbae;hp=71997c22165a56f3381ca306fc7b48bdeb7ba2c0;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;p=freeside.git
diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html
index 71997c221..4051e7d20 100755
--- a/httemplate/elements/tr-select-reason.html
+++ b/httemplate/elements/tr-select-reason.html
@@ -36,11 +36,6 @@
Reason |
|
+% my @types = qsearch( 'reason_type', { 'class' => $class } );
+% if (scalar(@types) < 1) { # we should never reach this
+
+
+ No reason types. Go add some.
+ |
+
+% }elsif (scalar(@types) == 1) {
+
+
+ Reason Type
+ |
+
+ <% $types[0]->type %>
+
+ |
+
+
+% }else{
+
Reason Type
|
|
+% }
New Reason
|
- " style="display:<% $display %>"> |
+ " style="display:<% $display %>"> |
<%init>
@@ -94,6 +110,9 @@ if ($class eq 'C') {
} elsif ($class eq 'S') {
$access_right = 'Suspend customer package';
$add_access_right = 'Add on-the-fly suspend reason';
+} elsif ($class eq 'R') {
+ $access_right = 'Post credit';
+ $add_access_right = 'Add on-the-fly credit reason';
} else {
die "illegal class: $class";
}
@@ -113,7 +132,18 @@ if ($init_reason == -1 || ref($init_reason) ) {
}
-my $extra_sql = "WHERE class = '$class' ORDER BY reason_type";
+my $extra_sql =
+ "WHERE class = '$class' and (disabled = '' OR disabled is NULL)";
+
+my @reasons = qsearch({
+ table => 'reason',
+ hashref => {},
+ extra_sql => $extra_sql,
+ addl_from => 'LEFT JOIN reason_type '.
+ ' ON reason_type.typenum = reason.reason_type',
+ order_by => 'ORDER BY reason_type.type ASC, reason.reason ASC',
+});
+
my $curuser = $FS::CurrentUser::CurrentUser;
%init>