[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, support-coreroles-and-customroles, repushed

Craig Kaiser craig at bestpractical.com
Mon Feb 11 16:46:59 EST 2019


The branch support-coreroles-and-customroles was deleted and repushed:
       was 83fd70ae03355f8e63f6ef9cbc6c1ffe313236a5
       now aa9d73c31f72b13a9f2fefb8e315a35769060af0

1:  79207b3 ! 1:  961c148 Support customroles for mandatoryontransition conditions
    @@ -4,6 +4,29 @@
         
         Use the syntax 'CustomRole.MyRole' to set mandatory conditions for
         customrole values.
    +
    +diff --git a/README b/README
    +--- a/README
    ++++ b/README
    +@@
    + 
    +         Set( %MandatoryOnTransition,
    +             'QueueName' => {
    +-                'from -> to' => [ 'BasicField', 'CF.MyField', ],
    ++                'from -> to' => [ 'BasicField', 'CF.MyField', 'CustomRole.MyRole' ],
    +             },
    +         );
    + 
    +@@
    + 
    +         Set( %MandatoryOnTransition,
    +             Helpdesk => {
    +-                '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
    ++                '* -> resolved'      => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    ++                'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
    +             },
    +             '*' => {
    +                 '* -> resolved' => ['CF.Category'],
     
     diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
     --- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
    @@ -105,14 +128,11 @@
          Set( %MandatoryOnTransition,
              Helpdesk => {
     -            '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
    -+            '* -> resolved' => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    ++            '* -> resolved'      => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    ++            'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
              },
              '*' => {
                  '* -> resolved' => ['CF.Category'],
    -+            'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
    -         },
    -     );
    - 
     @@
          my %config = ();
          %config = $self->Config($args{Queue});
    @@ -177,24 +197,11 @@
     +
     +                $role_arg = 'RT::CustomRole-' . $role_object->Id;
     +
    -+                ( $ret, $msg ) = $role_values = $args{Ticket}->RoleGroup( $role_object->GroupType );
    -+                push @errors, $CurrentUser->loc("Could not load current user") unless $ret;
    ++                $role_values = $args{Ticket}->RoleGroup( $role_object->GroupType );
    ++                push @errors, $CurrentUser->loc("Could not load current user") unless $role_values;
     +            }
     +
    -+            my $role_object = RT::CustomRole->new($args{Ticket}->CurrentUser);
    -+
    -+            my ($ret, $msg) = $role_object->Load($role);
    -+            push @errors, $CurrentUser->loc("Failed to load custom role $role:  $msg") unless $ret;
    -+            return \@errors unless $ret;
    -+
    -+            $role_arg = 'RT::CustomRole-' . $role_object->Id;
    -+
    -+            ($ret, $msg) = $role_values = $args{Ticket}->RoleGroup($role_object->GroupType);
    -+            push @errors, $CurrentUser->loc("$msg") unless $ret;
    -+            return \@errors unless $ret;
    -+
     +            my @role_values;
    -+
     +            # Use this to keep track of input fields that use a count increment
     +            # example: WatcherAddressEmail1 or WatcherAddressEmail2
     +            my @row_input_num = grep $role_arg eq $ARGSRef->{$_}, keys %{$ARGSRef};
2:  2d47a6b ! 2:  ae1c71d Support all core role fields as mandatory on transition fields
    @@ -110,8 +110,8 @@
              # Do we have a value currently?
     @@
      
    -                 ( $ret, $msg ) = $role_values = $args{Ticket}->RoleGroup( $role_object->GroupType );
    -                 push @errors, $CurrentUser->loc("Could not load current user") unless $ret;
    +                 $role_values = $args{Ticket}->RoleGroup( $role_object->GroupType );
    +                 push @errors, $CurrentUser->loc("Could not load current user") unless $role_values;
     +            } elsif ( $role eq 'Owner' ) {
     +                # There are 2 Owner fields on Jumbo page, copied the same handling from it.
     +                if ( ref $ARGSRef->{$role} ) {
    @@ -133,31 +133,17 @@
     +                    push @errors, $CurrentUser->loc("Could not load user: $owner_value") unless $user->Id;
     +                    $role_values = $user->EmailAddress if $user->Id;
     +                }
    -             }
    ++            }
     +            else {
     +                $role_values = RT::Group->new( $args{Ticket}->CurrentUser );
     +                my ( $ret, $msg ) = $role_values->LoadRoleGroup(
     +                    Object => $args{Ticket},
     +                    Name   => $role
     +                );
    ++                push @errors, $CurrentUser->loc("Failed to load role $role for ticket: $msg") unless $ret;
    +             }
      
    --            my $role_object = RT::CustomRole->new($args{Ticket}->CurrentUser);
    --
    --            my ($ret, $msg) = $role_object->Load($role);
    --            push @errors, $CurrentUser->loc("Failed to load custom role $role:  $msg") unless $ret;
    --            return \@errors unless $ret;
    --
    --            $role_arg = 'RT::CustomRole-' . $role_object->Id;
    --
    --            ($ret, $msg) = $role_values = $args{Ticket}->RoleGroup($role_object->GroupType);
    --            push @errors, $CurrentUser->loc("$msg") unless $ret;
    --            return \@errors unless $ret;
    --
    -+                push @errors, $CurrentUser->loc("Failed to load role $role for ticket: $msg") unless $ret;
    -+            }
                  my @role_values;
    - 
    -             # Use this to keep track of input fields that use a count increment
     @@
                        }
                      map { $_ =~ /^WatcherTypeEmail(\d*)$/; $1 } @row_input_num;
3:  6ff371e ! 3:  93767e5 Support requiring a role to be a member of a group
    @@ -11,27 +11,13 @@
     --- a/README
     +++ b/README
     @@
    - 
    -         Set( %MandatoryOnTransition,
    -             'QueueName' => {
    --                'from -> to' => [ 'BasicField', 'CF.MyField', ],
    -+                'from -> to' => [ 'BasicField', 'CF.MyField', 'CustomRole.MyRole' ],
    -             },
    -         );
    - 
    -@@
    - 
    -         Set( %MandatoryOnTransition,
                  Helpdesk => {
    --                '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
    +                 '* -> resolved'      => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    +                 'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
     +                '* -> resolved' => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
                  },
                  '*' => {
                      '* -> resolved' => ['CF.Category'],
    -+                'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
    -             },
    -         );
    - 
     
     diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
     --- a/lib/RT/Extension/MandatoryOnTransition.pm
4:  273c7c4 = 4:  36a2c03 Create test file for roles
5:  83fd70a ! 5:  aa9d73c Update README and Changelog
    @@ -30,18 +30,14 @@
          you'd like to see additional fields added, please email your request to
          the bug address at the bottom of this documentation.
     @@
    - 
    -         Set( %MandatoryOnTransition,
                  Helpdesk => {
    +                 '* -> resolved'      => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    +                 'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
     -                '* -> resolved' => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    -+                '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
                  },
                  '*' => {
                      '* -> resolved' => ['CF.Category'],
    --                'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
    -             },
    -         );
    - 
    +@@
          The transition syntax is similar to that found in RT's Lifecycles. See
          perldoc /opt/rt4/etc/RT_Config.pm.
      
    @@ -85,18 +81,6 @@
      
      A larger set of basic fields may be supported in future releases.  If you'd
     @@
    - 
    -     Set( %MandatoryOnTransition,
    -         Helpdesk => {
    --            '* -> resolved' => ['TimeWorked', 'CF.Resolution', 'CustomRole.Analyst'],
    -+            '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
    -         },
    -         '*' => {
    -             '* -> resolved' => ['CF.Category'],
    --            'CustomRole.Analyst' => {transition => '* -> open', group => 'Engineering'},
    -         },
    -     );
    - 
      The transition syntax is similar to that found in RT's Lifecycles.  See
      C<perldoc /opt/rt4/etc/RT_Config.pm>.
      



More information about the Bps-public-commit mailing list