1 package RT::Action::Accumulate;
8 RT::Action::Accumulate - Accumulate a running total in a ticket custom field.
10 This action requires a transaction and ticket custom field with the same name.
11 When a transaction is submitted with a numeric value in that field, the field
12 value for the ticket will be incremented by that amount. Use this to create
13 custom fields that behave like the "TimeWorked" field.
15 Best used with an "On Update" condition that triggers on any transaction. The
16 ticket custom field update itself does not a create a transaction.
18 The argument to this action is the name of the custom field. They must have
19 the same name, and should be single-valued fields.
25 my $cfname = $self->Argument or return 0;
26 $self->{'inc_by'} = $self->TransactionObj->FirstCustomFieldValue($cfname);
27 return ( $self->{'inc_by'} =~ /^(\d+)$/ );
32 my $cfname = $self->Argument;
33 my $newval = $self->{'inc_by'} +
34 ($self->TicketObj->FirstCustomFieldValue($cfname) || 0);
35 my ($val) = $self->TicketObj->AddCustomFieldValue(
36 Field => 'Support time',
38 RecordTransaction => 0,