summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-agent.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/elements/select-agent.html')
-rw-r--r--httemplate/elements/select-agent.html32
1 files changed, 12 insertions, 20 deletions
diff --git a/httemplate/elements/select-agent.html b/httemplate/elements/select-agent.html
index c2a5e4bde..aa480a54b 100644
--- a/httemplate/elements/select-agent.html
+++ b/httemplate/elements/select-agent.html
@@ -1,24 +1,16 @@
<%
my( $agentnum, %opt ) = @_;
- my @agents;
- if ( $opt{'agents'} ) {
- @agents = @{ $opt{'agents'} };
- } else {
- @agents = qsearch( 'agent', { disabled=>'' } );
- }
-
+ my %select_opt = ();
+ $select_opt{'records'} = $opt{'agents'}
+ if $opt{'agents'};
+
+%><%= include( '/elements/select-table.html',
+ 'table' => 'agent',
+ 'name_col' => 'agent',
+ 'value' => $agentnum,
+ 'empty_label' => 'all',
+ 'hashref' => { 'disabled' => '' },
+ %select_opt,
+ )
%>
-
-<SELECT NAME="agentnum">
-
- <OPTION VALUE="">all</OPTION>
-
- <% foreach my $agent ( sort { $a->agent cmp $b->agent } @agents ) { %>
-
- <OPTION VALUE="<%= $agent->agentnum %>"<%= $agentnum == $agent->agentnum ? ' SELECTED' : '' %>><%= $agent->agent %>
-
- <% } %>
-
-</SELECT>
-