[Rt-commit] rt branch, 5.0/create-tickets-skip-flag, repushed

Craig Kaiser craig at bestpractical.com
Thu Jun 3 17:12:37 EDT 2021


The branch 5.0/create-tickets-skip-flag was deleted and repushed:
       was f1f1aa1bd20a167b0c085984575ccfcfde8fa28d
       now b196bfe7f336b4568d9b41ab485f6f348abd2c7c

1: f1f1aa1bd2 ! 1: b196bfe7f3 Allow skipping of create ticket blocks through passing arg
    @@ -14,6 +14,22 @@
      
     +=head3 SkipCreate
     +
    ++This flag allows for ticket creation to be skipped programatically. For example, taking a looking at
    ++the example above. The template creates two different tickets, maybe a sexond approval ticket shouldn't
    ++be created if the tickets priority is low. Using Perl logic we can check some information about the
    ++ticket and decide using this flag if we should skip creating this ticket:
    ++
    ++ ===Create-Ticket: two
    ++ SkipCreate: {$Tickets{'TOP'}->Priority eq 'Low' ? 1 : 0}
    ++ Subject: Manager approval
    ++ Type: approval
    ++ Depended-On-By: TOP
    ++ Refers-To: {$Tickets{"create-approval"}->Id}
    ++ Queue: ___Approvals
    ++ Content-Type: text/plain
    ++ Content: Your approval is requred for this ticket, too.
    ++ ENDOFCONTENT
    ++
      =head2 Acceptable Fields
      
      A complete list of acceptable fields:
    @@ -27,17 +43,24 @@
      
      Fields marked with a C<+> may have multiple values, simply
     @@
    -         # Make sure we have at least the minimum set of
    -         # reasonable data and do our thang
    +         $T::ID    = $template_id;
    +         @T::AllID = @{ $self->{'create_tickets'} };
      
    ++        my (@links_local, @postponed_local);
    +         ( $T::Tickets{$template_id}, $ticketargs )
    +-            = $self->ParseLines( $template_id, \@links, \@postponed );
    ++            = $self->ParseLines( $template_id, \@links_local, \@postponed_local );
    ++
    ++
     +        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);
    ++        push @links, @links_local;
    ++        push @postponed, @postponed_local;
      
    +         # Now we have a %args to work with.
    +         # Make sure we have at least the minimum set of
     @@
              FinalPriority   => $args{'finalpriority'} || 0,
              SquelchMailTo   => $args{'squelchmailto'},



More information about the rt-commit mailing list