
alexmv at bestpractical
Mar 20, 2012, 11:39 AM
Post #1 of 1
(85 views)
Permalink
|
|
rt branch, 4.2/dry-run-ticket-create, created. rt-4.0.5-83-g23cc1a3
|
|
The branch, 4.2/dry-run-ticket-create has been created at 23cc1a30802570f200cd0a0827191215841f8693 (commit) - Log ----------------------------------------------------------------- commit e5e601e86f281828f0cbdb89203ed6c4e7be521a Author: Alex Vandiver <alexmv [at] bestpractical> 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 23cc1a30802570f200cd0a0827191215841f8693 Author: Alex Vandiver <alexmv [at] bestpractical> Date: Tue Mar 13 13:47:13 2012 -0400 Allow explicit addresses to skip, in addition the SkipNotification sets RTIR uses the SkipNotification argument to Create (added in 7e0e0a5) to squelch whole classes of users at create time. 2047c32 added a TransSquelchTo argument to RT::Ticket->Create to implement this create-time squelching, but didn't allow explicit control of individual addresses at the level of the CreateTicket API. Add the same TransSquelchTo argument to RT::Interface::Email's CreateTicket, which allows an explicit additional set of addresses to squelch, in addition to those that SkipNotification adds. 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'} ) { ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|