diff options
author | ivan <ivan> | 2007-12-05 20:47:51 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-12-05 20:47:51 +0000 |
commit | bdb4c91003d8f726c0d1379d3c77ac02e19945d6 (patch) | |
tree | 2fac5dbc5223699357d6b13377f07b574c6f26e0 /httemplate | |
parent | b9e20c41597c74f211902db75f6a06810f10aa46 (diff) |
show types in reason selection, order by type and reason
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/elements/tr-select-reason.html | 28 |
1 files changed, 16 insertions, 12 deletions
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 @@ <TD ALIGN="right">Reason</TD> <TD> <SELECT id="<% $name %>" name="<% $name %>" onFocus="sh_add<% $name %>()" onChange="sh_add<% $name %>()"> -% my @reasons = qsearch( { table =>'reason', -% hashref => {}, -% extra_sql => $extra_sql, -% addl_from => 'LEFT JOIN reason_type ON reason_type.typenum = reason.reason_type', -% }); <OPTION VALUE="" <% ($init_reason eq "") ? 'SELECTED' : '' %>>Select Reason...</OPTION> % foreach my $reason (@reasons) { - <OPTION VALUE="<% $reason->reasonnum %>" <% ($init_reason == $reason->reasonnum) ? 'SELECTED' : '' %>><% $reason->reason %></OPTION> + <OPTION VALUE="<% $reason->reasonnum %>" <% ($init_reason == $reason->reasonnum) ? 'SELECTED' : '' %>><% $reason->reasontype->type %> : <% $reason->reason %></OPTION> % } % if ($curuser->access_right($access_right)) { <OPTION VALUE="-1" <% ($init_reason == -1) ? 'SELECTED' : '' %>>Add new reason</OPTION> @@ -80,7 +75,7 @@ </TD> <TD> <SELECT id="new<% $name %>T" name="new<% $name %>T" disabled="<% $disabled %>" style="display:<% $display %>"> -% for my $type (@types){ +% for my $type (@types) { <OPTION VALUE="<% $type->typenum %>" <% ($init_type == $type->typenum) ? 'SELECTED' : '' %>><% $type->type %></OPTION> % } </SELECT> @@ -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)"; -</%init> +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; +</%init> |