[rt-users] Circular scrip calls...
Cerion Armour-Brown
cerion at terpsichore.ws
Fri Feb 27 09:01:18 EST 2004
I get this error when I run the ExtractCustomFieldValues scrip...
[Fri Feb 27 11:48:07 2004] [error]: Scrip 15 died. - Can't call method
"Content" on an undefined value at /opt/rt3/lib/RT/Action/
ExtractCustomFieldValues.pm line 47.
I took a look at the code, and understand why it's happening, and also that RT
protects itself against scrip failures, so it's not a stability problem...
But its messy, and I was wondering re the best way to fix it.
The problem is the circular nature of adding custom fields...
- Scan the msg (first attachment) of a new transaction
- if found a match, we add field value to the relevant custom field
- create a new transaction to say just that...
- ...which is then scanned for custom fields...
- ... except in this case the first attachment is scanned, and since it
doesn't exist, it fails.
Somehow, any scrip that creates a new transaction should not be allowed to run
on that transaction...
A 'quick fix' for this particular one is:
ExtractCustomFieldValues.pm :
sub Commit {
+ unless ( $Transaction->Attachments->First ) { return 1; }
But this should be made more general, yes?
I found the 'ActivateScrips' functionality in Transaction_overlay.pm
I could do something like:
$Ticket->AddCustomFieldValue (Field => $cf, Value => $_, Activate_Scrips=0);
and pass it through all the way to
Transaction_Overlay.pm sub Create...
But that kinda limits scrips... perhaps some pathological case wants to run a
different scrip on a transaction generated by a previous scrip?
So what's the thinking on this one?
Cerion
More information about the rt-users
mailing list