[Rt-commit] rt branch, 5.0/create-tickets-skip-flag, created. rt-5.0.1-427-gf1f1aa1bd2

Craig Kaiser craig at bestpractical.com
Thu Jun 3 14:00:00 EDT 2021


The branch, 5.0/create-tickets-skip-flag has been created
        at  f1f1aa1bd20a167b0c085984575ccfcfde8fa28d (commit)

- Log -----------------------------------------------------------------
commit f1f1aa1bd20a167b0c085984575ccfcfde8fa28d
Author: craig kaiser <craig at bestpractical.com>
Date:   Wed Jun 2 09:36:40 2021 -0400

    Allow skipping of create ticket blocks through passing arg
    
    This allows for logic to be placed inside of the '===' create ticket
    blocks to decide if a ticket should be created or not.

diff --git a/lib/RT/Action/CreateTickets.pm b/lib/RT/Action/CreateTickets.pm
index af3d9d0779..be89c0cd1d 100644
--- a/lib/RT/Action/CreateTickets.pm
+++ b/lib/RT/Action/CreateTickets.pm
@@ -176,6 +176,8 @@ template section after the block, you must scope it with C<our> rather
 than C<my>. Just as with other RT templates, you can also include
 Perl code in the template sections using C<{}>.
 
+=head3 SkipCreate
+
 =head2 Acceptable Fields
 
 A complete list of acceptable fields:
@@ -223,6 +225,8 @@ A complete list of acceptable fields:
        CF-name           => custom field value
        CustomField-name  => custom field value
 
+       SkipCreate        => 0/1, if true, skip this create ticket block
+
 Fields marked with an C<*> are required.
 
 Fields marked with a C<+> may have multiple values, simply
@@ -325,6 +329,11 @@ sub CreateByTemplate {
         # Make sure we have at least the minimum set of
         # reasonable data and do our thang
 
+        if ( $ticketargs->{'SkipCreate'} ) {
+            RT::Logger->debug( "Skip flag found for template $template_id, skipping" );
+            next;
+        }
+
         my ( $id, $transid, $msg )
             = $T::Tickets{$template_id}->Create(%$ticketargs);
 
@@ -733,6 +742,7 @@ sub ParseLines {
         FinalPriority   => $args{'finalpriority'} || 0,
         SquelchMailTo   => $args{'squelchmailto'},
         Type            => $args{'type'},
+        SkipCreate      => $args{'skipcreate'} || 0,
     );
 
     if ( $args{content} ) {

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


More information about the rt-commit mailing list