From bdb4c91003d8f726c0d1379d3c77ac02e19945d6 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 5 Dec 2007 20:47:51 +0000 Subject: show types in reason selection, order by type and reason --- httemplate/elements/tr-select-reason.html | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index 371f384be..9684f37a2 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -37,14 +37,9 @@ Reason -% for my $type (@types){ +% for my $type (@types) { % } @@ -97,7 +92,7 @@ <%init> my($name, $class, $init_reason, $init_type, $init_newreason, $controlledbutton) = @_; -my($extra_sql, $curuser, $access_right, $display, $disabled); +my($access_right, $display, $disabled); if ($class eq 'C') { $access_right='Add on-the-fly cancel reason'; @@ -117,9 +112,18 @@ if ($init_reason == -1){ $disabled = 'true'; } -$extra_sql = "WHERE class = '$class' and (disabled = '' OR disabled is NULL) ". - "ORDER BY reason_type"; -$curuser = $FS::CurrentUser::CurrentUser; +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 => 'reason_type.type ASC, reason.reason ASC', +}); + +my $curuser = $FS::CurrentUser::CurrentUser; + -- cgit v1.2.1