[rt-users] getting username from id
Ruslan Zakirov
ruslan.zakirov at gmail.com
Fri Mar 30 11:02:53 EDT 2007
On 3/30/07, Ruslan Zakirov <ruslan.zakirov at gmail.com> wrote:
> On 3/29/07, Stephen Turner <sturner at mit.edu> wrote:
> > At Thursday 3/29/2007 04:28 AM, Mathew Snyder wrote:
> > > while (my $user = $users->Next) {
> > > if ($user = $transaction->Creator) {
also here ^^^^
you use '=' which equality operator not a '==' boolean operator which
compares numeric values, so you overwrite value in $user variable. you
need the following condition:
if ( $user->id == $transaction->Creator ) {
...
> > > $timeworked{$user} += $transaction->TimeTaken;
> > > }
> > > $environment{$environment}{$user->Name} = $timeworked{$user};
> > > }
> >
> > In the if statement, you are setting $user to $transaction->Creator,
> > which is an integer. So $user is no longer a User object and hence no
> > Name method.
> However, there is $transaction->CreatorObj method that returns user's object.
>
> >
> > Also, a comment - in looking at the code I did get confused by the
> > dual use of "environment" to represent a scalar variable and a hash -
> > might be better for code maintenance to choose different names.
> >
> > Steve
> >
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Community help: http://wiki.bestpractical.com
> > Commercial support: sales at bestpractical.com
> >
> >
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> > Buy a copy at http://rtbook.bestpractical.com
> >
>
>
> --
> Best regards, Ruslan.
>
--
Best regards, Ruslan.
More information about the rt-users
mailing list