diff options
author | Christopher Burger <burgerc@freeside.biz> | 2017-12-01 17:11:10 -0500 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2017-12-01 17:11:10 -0500 |
commit | 51383e090e0e49c31a0f4a942a10f242b4061be2 (patch) | |
tree | 326f356d0c98d9d1d26f793d69b64d6608ca269d /rt/lib | |
parent | ba58657e5c3de57db339a9a97f9cea26af341077 (diff) | |
parent | 197f613bac6c3f9a4bd7d1ea5fbf4769aea4ce1a (diff) |
Merge branch 'master' of ssh://git.freeside.biz/home/git/freeside
Diffstat (limited to 'rt/lib')
-rw-r--r-- | rt/lib/RT/Condition/StatusChangeQuietResolve.pm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/rt/lib/RT/Condition/StatusChangeQuietResolve.pm b/rt/lib/RT/Condition/StatusChangeQuietResolve.pm new file mode 100644 index 000000000..842614182 --- /dev/null +++ b/rt/lib/RT/Condition/StatusChangeQuietResolve.pm @@ -0,0 +1,48 @@ +package RT::Condition::StatusChangeQuietResolve; +use base 'RT::Condition'; +use strict; +use warnings; + +=head2 DESCRIPTION + +This condition allows for muting of resolution notifications when +combined with the ticket status 'resolved_quiet' + +If status has been updated as 'resolved_quiet', this condition +will block notification, and update ticket status to 'resolved' + +If status has been updated as 'resolved', this condition +will block notification only if the previous ticket status +had been 'resolved_quiet' + +=cut + +sub IsApplicable { + my $self = shift; + my $txn = $self->TransactionObj; + my ($type, $field) = ($txn->Type, $txn->Field); + + return 0 + unless $type eq 'Status' + || ($type eq 'Set' && $field eq 'Status'); + + return 0 + unless $txn->NewValue eq 'resolved' + || $txn->NewValue eq 'resolved_quiet'; + + my $ticket = $self->TicketObj; + + if ($txn->NewValue eq 'resolved_quiet') { + $ticket->SetStatus('resolved'); + return 0; + } + elsif ($txn->NewValue eq 'resolved' && $txn->OldValue eq 'resolved_quiet') { + return 0; + } + + return 1; +} + +RT::Base->_ImportOverlays(); + +1; |