X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-user.html;h=ec2341be68d6a91806c66c94096dfceb02ba16c7;hb=ea3ce8d7f076e7fecff4be7ae63bc413adb0adf5;hp=bdb92e70f7d29cd4894d0f07d4fd125bea103fd0;hpb=c1e2f536974812f05b8d3534ad2bf9c9ba40c24d;p=freeside.git diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html index bdb92e70f..ec2341be6 100644 --- a/httemplate/elements/select-user.html +++ b/httemplate/elements/select-user.html @@ -4,8 +4,11 @@ % } -% foreach my $otaker ( @{ $opt{'otakers'} } ) { - +% foreach my $usernum ( +% sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} } +% keys %{ $opt{'access_user'} } +% ) { + % } @@ -14,15 +17,15 @@ my %opt = @_; -unless ( $opt{'otakers'} ) { +unless ( $opt{'access_user'} ) { - my $sth = dbh->prepare("SELECT username,usernum FROM access_user". - " WHERE disabled = '' or disabled IS NULL") - or die dbh->errstr; + my $sth = dbh->prepare(" + SELECT usernum, username FROM access_user + WHERE disabled = '' or disabled IS NULL + ") or die dbh->errstr; $sth->execute or die $sth->errstr; - for($sth->fetchall_arrayref) { - $opt{'otakers'} = [ map { $_->[0] } @$_ ]; - $opt{'usernums'} = [ map { $_->[1] } @$_ ]; + while ( my $row = $sth->fetchrow_arrayref ) { + $opt{'access_user'}->{$row->[0]} = $row->[1]; } }