virtualize referrals on customer addition
[freeside.git] / httemplate / elements / select-agent.html
index aa480a5..009cc6e 100644 (file)
@@ -1,8 +1,7 @@
 <%
   my( $agentnum, %opt ) = @_;
 
-  my %select_opt = ();
-  $select_opt{'records'} = $opt{'agents'}
+  $opt{'records'} = delete $opt{'agents'}
     if $opt{'agents'};
 
 %><%= include( '/elements/select-table.html',
@@ -11,6 +10,9 @@
                  'value'       => $agentnum,
                  'empty_label' => 'all',
                  'hashref'     => { 'disabled' => '' },
-                 %select_opt,
+                 'extra_sql'   => ' AND '.
+                                  $FS::CurrentUser::CurrentUser->agentnums_sql.
+                                  ' ORDER BY agent',
+                 %opt,
              )
 %>