[Rt-commit] rt branch, 4.2/move-open-on-setstarted-to-scrip, created. rt-4.1.8-514-gd2c465b

Todd Wade todd at bestpractical.com
Thu May 30 05:38:19 EDT 2013


The branch, 4.2/move-open-on-setstarted-to-scrip has been created
        at  d2c465bd9fe08bbee38cd7ed77f389216bc18584 (commit)

- Log -----------------------------------------------------------------
commit d2c465bd9fe08bbee38cd7ed77f389216bc18584
Author: Todd Wade <todd at bestpractical.com>
Date:   Thu May 30 00:06:49 2013 -0400

    Move the code that opens a ticket on SetStarted to a Scrip
    
    This commit resolves a TODO from RT::Ticket that moves code that
    sets a ticket status to open to a Scrip for upgrading users. The
    functionality is removed for new installs.
    
    See issues#17474

diff --git a/docs/UPGRADING-4.2 b/docs/UPGRADING-4.2
index 2a5bc12..405ced9 100644
--- a/docs/UPGRADING-4.2
+++ b/docs/UPGRADING-4.2
@@ -129,3 +129,7 @@ UPGRADING FROM RT 4.0.0 and greater
   and granting Everyone the OwnTicket right is a common cause of
   performance problems.  Unprivileged Owners (if they exist) may still
   be set using the Autocompleter.
+
+* The functionality that changed the ticket status to Open when the Started
+  date is set has been moved to a Scrip called 'On SetStarted Open Ticket'.
+  If you do not depend on this functionality, the Scrip can be deleted.
diff --git a/etc/upgrade/4.1.14/content b/etc/upgrade/4.1.14/content
new file mode 100644
index 0000000..68a5b3a
--- /dev/null
+++ b/etc/upgrade/4.1.14/content
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+
+our @Scrips = ({
+    Description            => 'On SetStarted Open Ticket',
+    ScripCondition         => 'User Defined',
+    ScripAction            => 'User Defined',
+    Template               => 'Blank',
+
+    CustomIsApplicableCode => <<'    END_OF_CUSTOMISAPPLICABLECODE',
+return 0 unless $self->TransactionObj->Type eq "Set";
+return 0 unless $self->TransactionObj->Field eq "Started";
+return 1;
+    END_OF_CUSTOMISAPPLICABLECODE
+
+    CustomPrepareCode      => <<'    END_OF_CUSTOMPREPARECODE',
+my $ticket = $self->TicketObj;
+
+# We need $TicketAsSystem, in case the current user doesn't have ShowTicket
+my $TicketAsSystem = RT::Ticket->new(RT->SystemUser);
+$TicketAsSystem->Load( $ticket->Id );
+# Now that we're starting, open this ticket
+my $next = $TicketAsSystem->FirstActiveStatus;
+
+$ticket->SetStatus( $next ) if defined $next;
+
+return 1;
+    END_OF_CUSTOMPREPARECODE
+
+});
+
+1;
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index bcfcfcbe..50a6f8d 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1345,16 +1345,6 @@ sub SetStarted {
         $time_obj->SetToNow();
     }
 
-    # We need $TicketAsSystem, in case the current user doesn't have
-    # ShowTicket
-    my $TicketAsSystem = RT::Ticket->new(RT->SystemUser);
-    $TicketAsSystem->Load( $self->Id );
-    # Now that we're starting, open this ticket
-    # TODO: do we really want to force this as policy? it should be a scrip
-    my $next = $TicketAsSystem->FirstActiveStatus;
-
-    $self->SetStatus( $next ) if defined $next;
-
     return ( $self->_Set( Field => 'Started', Value => $time_obj->ISO ) );
 
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list