Possible bug in ExtractCustomFieldValues 2.99_01

I have been using ExtractCustomFieldValues 2.99_01 for a few months now
with RT 3.8.2 and it seemed to work well. Recently I added some new
global custom fields and then applied them to a new queue and I’ve been
getting errors unless I remove the new custom fields from the template
when emails are parsed.

[Wed May 27 19:26:51 2009] [debug]: Looking for CF Job Name
(/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/
RT/Action/ExtractCustomFieldValues.pm:105)
[Wed May 27 19:26:51 2009] [error]: Scrip Commit 15 died. - Can’t call
method “id” on an undefined value at
/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/R
T/Action/ExtractCustomFieldValues.pm line 119.

Stack:

[/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/
RT/Action/ExtractCustomFieldValues.pm:119]

[/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/
RT/Action/ExtractCustomFieldValues.pm:81]
[/usr/local/rt3/bin/…/lib/RT/ScripAction_Overlay.pm:238]
[/usr/local/rt3/bin/…/lib/RT/Scrip_Overlay.pm:464]
[/usr/local/rt3/bin/…/lib/RT/Scrips_Overlay.pm:196]
[/usr/local/rt3/bin/…/lib/RT/Transaction_Overlay.pm:188]
[/usr/local/rt3/bin/…/lib/RT/Record.pm:1456]
[/usr/local/rt3/bin/…/lib/RT/Ticket_Overlay.pm:648]
[/usr/local/rt3/bin/…/lib/RT/Interface/Email.pm:1357]
[/usr/local/rt3/share/html/REST/1.0/NoAuth/mail-gateway:61]
(/usr/local/rt3/bin/…/lib/RT/Scrip_Overlay.pm:472)

I believe it is because in this area of code it tries to see if a field
pertains to a queue or not and makes the assumtion that if it is global
it is in all queues or if it isn’t global it is there. We have global
custom fields that don’t apply to all queues.

101 sub LoadCF {
102 my $self = shift;
103 my %args = @_;
104 my $CustomFieldName = $args{Name};
105 $RT::Logger->debug( “Looking for CF $CustomFieldName”);
106
107 # We do this by hand instead of using LoadByNameAndQueue because
108 # that can find disabled queues
109 my $cfs = RT::CustomFields->new($RT::SystemUser);
110 $cfs->LimitToGlobalOrQueue($self->Queue);
111 $cfs->Limit(
112 FIELD => ‘Name’,
113 VALUE => $CustomFieldName,
114 CASESENSITIVE => 0
115 );
116 $cfs->RowsPerPage(1);
117
118 my $cf = $cfs->First;
119 if ( $cf->id ) {
120 $RT::Logger->debug( "Found CF id " . $cf->id );
121 } elsif ( not $args{Quiet} ) {
122 $RT::Logger->error( “Couldn’t load CF $CustomFieldName!”);
123 }
124
125 return $cf;

It would seem to me that the limit method isn’t limiting enough?
Meaning that it just checks if a custom field is global or not but
doesn’t seem to check if it is applied or not?? This is my first guess.
Any ideas on a resolution?

Thanks,
-Tim

I have been using ExtractCustomFieldValues 2.99_01 for a few months
now
with RT 3.8.2 and it seemed to work well. Recently I added some new
global custom fields and then applied them to a new queue and I’ve
been
getting errors unless I remove the new custom fields from the template
when emails are parsed.

I think you want:
http://svn.bestpractical.com/cgi-bin/index.cgi/bps/revision/?rev=19391

2.99_01 is a developer release, sounds like there needs to be
a 2.99_02

-kevin

Thanks Kevin I think that did the trick. I looked at the CPAN page for
this module and it referred to sales@bestpractical.com of all places.
I’ve never figured out that code checkout so far so I appreciate your
help.

-TimFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin
Falcone
Sent: Wednesday, May 27, 2009 4:08 PM
To: RT Users
Subject: Re: [rt-users] Possible bug in ExtractCustomFieldValues 2.99_01

I have been using ExtractCustomFieldValues 2.99_01 for a few months
now with RT 3.8.2 and it seemed to work well. Recently I added some
new global custom fields and then applied them to a new queue and I’ve

been getting errors unless I remove the new custom fields from the
template when emails are parsed.

I think you want:
http://svn.bestpractical.com/cgi-bin/index.cgi/bps/revision/?rev=19391

2.99_01 is a developer release, sounds like there needs to be a 2.99_02

-kevin

[Wed May 27 19:26:51 2009] [debug]: Looking for CF Job Name
(/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/
lib/
RT/Action/ExtractCustomFieldValues.pm:105)
[Wed May 27 19:26:51 2009] [error]: Scrip Commit 15 died. - Can’t call

method “id” on an undefined value at
/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/
lib/R
T/Action/ExtractCustomFieldValues.pm line 119.

Stack:

[/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/
lib/
RT/Action/ExtractCustomFieldValues.pm:119]

[/usr/local/rt3/local/plugins/RT-Extension-ExtractCustomFieldValues/
lib/
RT/Action/ExtractCustomFieldValues.pm:81]
[/usr/local/rt3/bin/…/lib/RT/ScripAction_Overlay.pm:238]
[/usr/local/rt3/bin/…/lib/RT/Scrip_Overlay.pm:464]
[/usr/local/rt3/bin/…/lib/RT/Scrips_Overlay.pm:196]
[/usr/local/rt3/bin/…/lib/RT/Transaction_Overlay.pm:188]
[/usr/local/rt3/bin/…/lib/RT/Record.pm:1456]
[/usr/local/rt3/bin/…/lib/RT/Ticket_Overlay.pm:648]
[/usr/local/rt3/bin/…/lib/RT/Interface/Email.pm:1357]
[/usr/local/rt3/share/html/REST/1.0/NoAuth/mail-gateway:61]
(/usr/local/rt3/bin/…/lib/RT/Scrip_Overlay.pm:472)

I believe it is because in this area of code it tries to see if a
field pertains to a queue or not and makes the assumtion that if it is

global it is in all queues or if it isn’t global it is there. We have

global custom fields that don’t apply to all queues.

101 sub LoadCF {
102 my $self = shift;
103 my %args = @_;
104 my $CustomFieldName = $args{Name};
105 $RT::Logger->debug( “Looking for CF $CustomFieldName”);
106
107 # We do this by hand instead of using LoadByNameAndQueue
because
108 # that can find disabled queues
109 my $cfs = RT::CustomFields->new($RT::SystemUser);
110 $cfs->LimitToGlobalOrQueue($self->Queue);
111 $cfs->Limit(
112 FIELD => ‘Name’,
113 VALUE => $CustomFieldName,
114 CASESENSITIVE => 0
115 );
116 $cfs->RowsPerPage(1);
117
118 my $cf = $cfs->First;
119 if ( $cf->id ) {
120 $RT::Logger->debug( "Found CF id " . $cf->id );
121 } elsif ( not $args{Quiet} ) {
122 $RT::Logger->error( “Couldn’t load CF $CustomFieldName!”);
123 }
124
125 return $cf;

It would seem to me that the limit method isn’t limiting enough?
Meaning that it just checks if a custom field is global or not but
doesn’t seem to check if it is applied or not?? This is my first
guess.
Any ideas on a resolution?

Thanks,
-Tim


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com