Created
December 26, 2010 00:13
-
-
Save sinkovsky/755118 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my $users_sth = $self->app->dbh->prepare("SELECT | |
| u.fullname, tu.user_type | |
| FROM | |
| report_template_users tu | |
| JOIN | |
| users u | |
| ON tu.user_id = u.id | |
| WHERE report_template_id = ?"); | |
| $users_sth->execute($row->{id}); | |
| my @users; | |
| while ( my $user_row = $users_sth->fetchrow_hashref ) { | |
| push @users, $user_row; | |
| } | |
| my @senders = map { $_->{fullname} } grep { $_->{user_type} eq 'sender' } @users; | |
| my @recipients = map { $_->{fullname} } grep { $_->{user_type} eq 'recipient' } @users; | |
| $row->{senders_str} = join ",", @senders; | |
| $row->{recipients_str} = join ",", @recipients; | |
| push @reports, $row; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment