From 80f722b82cb92fa49ee172230be3c61f72e56f41 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Aug 2010 06:21:06 +0000 Subject: fix payment and refund searches by otaker (now usernum), RT#9555 --- httemplate/elements/select-user.html | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'httemplate/elements/select-user.html') diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html index bdb92e70f..6264398e2 100644 --- a/httemplate/elements/select-user.html +++ b/httemplate/elements/select-user.html @@ -4,8 +4,8 @@ % } -% foreach my $otaker ( @{ $opt{'otakers'} } ) { - +% foreach my $usernum ( keys %{ $opt{'access_user'} } ) { + % } @@ -14,15 +14,18 @@ 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; + 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; - 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]; } } -- cgit v1.2.1