X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-user.html;h=e77788f61431a178e78665f3f63913499baf9134;hp=6264398e2efa0b7950b99a629de2e12106332145;hb=b71b1576c68bc40ad26592b354feace37a029f0e;hpb=80f722b82cb92fa49ee172230be3c61f72e56f41 diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html index 6264398e2..e77788f61 100644 --- a/httemplate/elements/select-user.html +++ b/httemplate/elements/select-user.html @@ -4,7 +4,10 @@ % } -% foreach my $usernum ( keys %{ $opt{'access_user'} } ) { +% foreach my $usernum ( +% sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} } +% keys %{ $opt{'access_user'} } +% ) { % } @@ -14,20 +17,6 @@ my %opt = @_; -unless ( $opt{'access_user'} ) { - - tie %{ $opt{'access_user'} }, 'Tie::IxHash'; - - my $sth = dbh->prepare(" - SELECT usernum, username FROM access_user - WHERE disabled = '' or disabled IS NULL - ORDER BY username - ") or die dbh->errstr; - $sth->execute or die $sth->errstr; - while ( my $row = $sth->fetchrow_arrayref ) { - $opt{'access_user'}->{$row->[0]} = $row->[1]; - } - -} +$opt{'access_user'} ||= $FS::CurrentUser::CurrentUser->access_users_hashref();