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 From 55476aa0484f5ebada5f36e1407722d84609bd34 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Aug 2010 07:00:21 +0000 Subject: additional by-otaker searches fixed for the brave new world of usernum, RT#9555 --- httemplate/elements/select-user.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate/elements/select-user.html') diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html index 6264398e2..ec2341be6 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'} } +% ) { % } @@ -16,12 +19,9 @@ 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 ) { -- cgit v1.2.1