event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / select-agent.html
index 009cc6e..54069a5 100644 (file)
@@ -1,13 +1,7 @@
-<%
-  my( $agentnum, %opt ) = @_;
-
-  $opt{'records'} = delete $opt{'agents'}
-    if $opt{'agents'};
-
-%><%= include( '/elements/select-table.html',
+<% include( '/elements/select-table.html',
                  'table'       => 'agent',
                  'name_col'    => 'agent',
-                 'value'       => $agentnum,
+                 'value'       => $agentnum || '',
                  'empty_label' => 'all',
                  'hashref'     => { 'disabled' => '' },
                  'extra_sql'   => ' AND '.
                  %opt,
              )
 %>
+<%init>
+
+my %opt = @_;
+my $agentnum = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'records'} = delete $opt{'agents'}
+  if $opt{'agents'};
+
+</%init>