[Rt-commit] r6098 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Sep 28 19:42:57 EDT 2006


Author: ruz
Date: Thu Sep 28 19:42:57 2006
New Revision: 6098

Added:
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/CloseTicket.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/ReopenTicket.pm
Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)

Log:
 r3902 at cubic-pc:  cubic | 2006-09-29 03:52:45 +0400
 * RT/Condition/ReopenTicket.pm
 * RT/Condition/CloseTicket.pm


Added: rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/CloseTicket.pm
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/CloseTicket.pm	Thu Sep 28 19:42:57 2006
@@ -0,0 +1,36 @@
+package RT::Condition::CloseTicket;
+
+use strict;
+use warnings;
+
+use base 'RT::Condition::Generic';
+
+
+=head2 IsApplicable
+
+If the ticket was closed, ie status was changed from any active status to
+an inactive. See F<RT_Config.pm> for C<ActiveStatuses> and C<InactiveStatuses>
+options.
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+
+    my $txn = $self->TransactionObj;
+    return 0 unless $txn->Type eq "Status" ||
+        ( $txn->Type eq "Set" && $txn->Field eq "Status" );
+
+    my $queue = $self->TicketObj->QueueObj;
+    return 0 unless $queue->IsActiveStatus( $txn->OldValue );
+    return 0 unless $queue->IsInactiveStatus( $txn->NewValue );
+
+    return 1;
+}
+
+eval "require RT::Condition::CloseTicket_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/CloseTicket_Vendor.pm});
+eval "require RT::Condition::CloseTicket_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/CloseTicket_Local.pm});
+
+1;

Added: rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/ReopenTicket.pm
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Condition/ReopenTicket.pm	Thu Sep 28 19:42:57 2006
@@ -0,0 +1,41 @@
+package RT::Condition::ReopenTicket;
+
+use strict;
+use warnings;
+
+use base 'RT::Condition::Generic';
+
+
+=head2 IsApplicable
+
+If the ticket was repopened, ie status was changed from any inactive status to
+an active. See F<RT_Config.pm> for C<ActiveStatuses> and C<InactiveStatuses>
+options.
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+
+    my $txn = $self->TransactionObj;
+    return 0 unless $txn->Type eq "Status" ||
+        ( $txn->Type eq "Set" && $txn->Field eq "Status" );
+
+    my $queue = $self->TicketObj->QueueObj;
+    return 0 unless $queue->IsInactiveStatus( $txn->OldValue );
+    return 0 unless $queue->IsActiveStatus( $txn->NewValue );
+
+    $RT::Logger->debug("Condition 'On Reopen' triggered "
+        ."for ticket #". $self->TicketObj->id
+        ." transaction #". $txn->id
+    );
+
+    return 1;
+}
+
+eval "require RT::Condition::ReopenTicket_Vendor";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/ReopenTicket_Vendor.pm});
+eval "require RT::Condition::ReopenTicket_Local";
+die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/ReopenTicket_Local.pm});
+
+1;


More information about the Rt-commit mailing list