[Rt-devel] obscure stricture explosion
Nicholas Clark
nick at ccl4.org
Fri Jun 15 05:31:10 EDT 2007
On Thu, Jun 14, 2007 at 01:12:32PM -0400, Jesse Vincent wrote:
>
> On Jun 14, 2007, at 1:01 PM, Nicholas Clark wrote:
>
> >If I'm getting this error message:
> >
> >Can't locate object method "EmailAddress" via package "No object
> >mapping for field" (perhaps you forgot to load "No object mapping
> >for field"?) at lib/RT/Ticket_Overlay.pm line 1351.
> >
> >where the offending lines in 3.6.3's RT/Ticket_Overlay.pm are:
> >
> > if ( $self->CurrentUser->PrincipalId == ($args{'PrincipalId'}
> >|| 0)
> > or lc( $self->CurrentUser->UserObj->EmailAddress )
> > eq lc( RT::User::CanonicalizeEmailAddress(undef, $args
> >{'Email'}) || '' ) )
> > {
> >
> >and my calling code is
> >
> >$t->AddWatcher(Type => 'Cc', PrincipalId => $g->Id);
> >
>
> Can I see the initialization of $t? In RT, you should ~always be
> handing a currentuser to ->new().
The whole thing is appended.
Nicholas Clark
#!perl -w
# $Id$
use strict;
use Test::More 'no_plan';
use_ok('RT');
use_ok('RT::Ticket');
use_ok('RT::Queue');
RT::LoadConfig();
RT::Init();
use vars qw ($CO $CO_USER $V_USER $QUEUE_E $QUEUE_I);
$CO_USER='B1';
$V_USER='root';
$QUEUE_E='Systems Requests';
$QUEUE_I='Systems';
ok(my $co_user = RT::User->new($RT::SystemUser));
ok($co_user->Load($CO_USER), "Loaded user '$CO_USER'");
my $cf = $co_user->FirstCustomFieldValue('company group name');
ok(defined $cf);
my $g;
if (defined $cf) {
$g = RT::Group->new($co_user);
$g->LoadUserDefinedGroup($cf);
ok($g->Id);
}
my $queue_e = RT::Queue->new($co_user);
$queue_e->Load($QUEUE_E);
ok ($queue_e, "Loaded queue '$QUEUE_E'");
ok(my $t = RT::Ticket->new($co_user));
my ($id,$t_o,$msg) = $t->Create(Queue => $queue_e,
Subject => "External request (test $$)",
Owner => $co_user);
ok($id, "Created ticket");
diag($msg);
diag($t);
diag($g->Id);
$t->AddWatcher(Type => 'Cc', PrincipalId => $g->Id);
More information about the Rt-devel
mailing list