[Rt-commit] rt branch, 4.2/dry-run-ticket-create, created. rt-4.0.5-84-g24d19fb

Alex Vandiver alexmv at bestpractical.com
Fri Mar 16 12:57:09 EDT 2012


The branch, 4.2/dry-run-ticket-create has been created
        at  24d19fb9a8d171d8ad9351baf09a977d4e0028aa (commit)

- Log -----------------------------------------------------------------
commit e5e601e86f281828f0cbdb89203ed6c4e7be521a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 13:45:33 2012 -0400

    Allow DryRun => 1 to CreateTicket, which returns the txn
    
    This can hence he used to implement PreviewScrips, at the cost of losing some ticket numbers.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 39c0c8c..20f35ba 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1378,13 +1378,21 @@ sub CreateTicket {
         MIMEObj         => $MIMEObj
     );
 
-    my @txn_squelch;
-    foreach my $type (qw(Requestor Cc AdminCc)) {
-        push @txn_squelch, map $_->address, Email::Address->parse( $create_args{$type} )
-            if grep $_ eq $type || $_ eq ( $type . 's' ), @{ $ARGS{'SkipNotification'} || [] };
+    if ($ARGS{'DryRun'}) {
+        $create_args{DryRun} = 1;
+        $create_args{Owner}     ||= $RT::Nobody->Id;
+        $create_args{Requestor} ||= $session{CurrentUser}->EmailAddress;
+        $create_args{Subject}   ||= '';
+        $create_args{Status}    ||= $QueueObj->Lifecycle->DefaultOnCreate,
+    } else {
+        my @txn_squelch;
+        foreach my $type (qw(Requestor Cc AdminCc)) {
+            push @txn_squelch, map $_->address, Email::Address->parse( $create_args{$type} )
+                if grep $_ eq $type || $_ eq ( $type . 's' ), @{ $ARGS{'SkipNotification'} || [] };
+        }
+        $create_args{TransSquelchMailTo} = \@txn_squelch
+            if @txn_squelch;
     }
-    $create_args{TransSquelchMailTo} = \@txn_squelch
-        if @txn_squelch;
 
     if ( $ARGS{'AttachTickets'} ) {
         require RT::Action::SendEmail;
@@ -1456,6 +1464,8 @@ sub CreateTicket {
     }
 
     my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
+    return $Trans if $ARGS{DryRun};
+
     unless ($id) {
         Abort($ErrMsg);
     }

commit d767b3ee58c074619abac0021af89dcc91a22276
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 13:47:13 2012 -0400

    Allow passing an explicit set of addresses to skip, in addition to the general SkipNotification

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 20f35ba..fef65fd 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1375,7 +1375,8 @@ sub CreateTicket {
         Status          => $ARGS{'Status'},
         Due             => $due ? $due->ISO : undef,
         Starts          => $starts ? $starts->ISO : undef,
-        MIMEObj         => $MIMEObj
+        MIMEObj         => $MIMEObj,
+        TransSquelchMailTo => $ARGS{'TransSquelchMailTo'},
     );
 
     if ($ARGS{'DryRun'}) {
@@ -1390,8 +1391,7 @@ sub CreateTicket {
             push @txn_squelch, map $_->address, Email::Address->parse( $create_args{$type} )
                 if grep $_ eq $type || $_ eq ( $type . 's' ), @{ $ARGS{'SkipNotification'} || [] };
         }
-        $create_args{TransSquelchMailTo} = \@txn_squelch
-            if @txn_squelch;
+        push @{$create_args{TransSquelchMailTo}}, @txn_squelch;
     }
 
     if ( $ARGS{'AttachTickets'} ) {

commit 24d19fb9a8d171d8ad9351baf09a977d4e0028aa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 13:47:36 2012 -0400

    Provide more context to the AfterBasics callback

diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index ba607b1..fcd34b1 100755
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -105,7 +105,7 @@
       <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1 &>
     </table>
   </&>
-% $m->callback( CallbackName => 'AfterBasics', QueueObj => $QueueObj );
+% $m->callback( CallbackName => 'AfterBasics', QueueObj => $QueueObj, ARGSRef => \%ARGS );
 </div>
 
 <div id="ticket-create-message">

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


More information about the Rt-commit mailing list