[WTF CVS] wtf/lib/WTF/Pages Input.pm,1.4,1.5
Brought to you by:
gryphonshafer
|
From: Gryphon S. <gry...@us...> - 2006-11-18 21:15:31
|
Update of /cvsroot/wtf-tracker/wtf/lib/WTF/Pages In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23902/lib/WTF/Pages Modified Files: Input.pm Log Message: If the user isn't assigned to a company functional area, then the user will see all tasks. The solution requires two DB queries, but this should be OK because it should be very rare (and indicative of a problem) if a user isn't assigned to a company functional area. Index: Input.pm =================================================================== RCS file: /cvsroot/wtf-tracker/wtf/lib/WTF/Pages/Input.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Input.pm 7 Nov 2006 16:49:10 -0000 1.4 --- Input.pm 18 Nov 2006 21:15:23 -0000 1.5 *************** *** 68,73 **** $sth->{'tasks'}->execute( $r->pnotes('user_id') ) or die $dbh->errstr(); my ( $indent, $last_task_id, @tasks ) = ( 0, 0 ); ! while ( $_ = $sth->{'tasks'}->fetchrow_hashref() ) { # if the task_id doesn't exist or if it does but it's not the same --- 68,79 ---- $sth->{'tasks'}->execute( $r->pnotes('user_id') ) or die $dbh->errstr(); + my $tasks_from_db = $sth->{'tasks'}->fetchall_arrayref({}) or die $dbh->errstr(); + if ( not @{$tasks_from_db} ) { + $sth->{'all_tasks'}->execute() or die $dbh->errstr(); + $tasks_from_db = $sth->{'all_tasks'}->fetchall_arrayref({}) or die $dbh->errstr(); + } + my ( $indent, $last_task_id, @tasks ) = ( 0, 0 ); ! for ( @{$tasks_from_db} ) { # if the task_id doesn't exist or if it does but it's not the same |