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);
where $g->Id is 55, and $t is a valid RT::Ticket object
then, where do I start looking to work out what my bug is?
My script (it’s trying to be a regression test) started with:
use_ok(‘RT’);
use_ok(‘RT::Ticket’);
use_ok(‘RT::Queue’);
RT::LoadConfig();
RT::Init();
And I’d not set CurrentUser. Is that my problem?
Nicholas Clark
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().
PGP.sig (186 Bytes)
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().
Code is at work, so I can’t get to it from here, but (from memory) it was
$t = RT::Ticket->new($co_user);
where $co_user was a user retrieved by name
$t->Create(…)
where a ticket is successfully created. (because it shows up)
I can give you the verbatim code by my tomorrow (by which time you’ll be
asleep)
Nicholas Clark
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);