my $transactiontime = "
CASE Transactions.Type WHEN 'Set'
- THEN (TO_NUMBER(NewValue,'999999')-TO_NUMBER(OldValue, '999999')) * 60
+ THEN ( CASE WHEN NewValue = '' THEN 0 ELSE TO_NUMBER(NewValue,'999999') END
+ -TO_NUMBER(OldValue, '999999')
+ ) * 60
ELSE TimeTaken*60
END
";
-push @groupby, qw( transactions.type newvalue oldvalue timetaken );
+push @groupby, qw( Transactions.Type NewValue OldValue TimeTaken );
my $appliedtimeclause = "COALESCE (SUM(acct_rt_transaction.seconds), 0)";
my $where = "
WHERE ObjectType='RT::Ticket'
AND ( ( Transactions.Type='Set' AND Field='TimeWorked' )
- OR Transactions.Type='Create'
- OR Transactions.Type='Comment'
- OR Transactions.Type='Correspond'
+ OR Transactions.Type IN ( 'Create', 'Comment', 'Correspond', 'Touch' )
)
AND $wheretimeleft
";