[Rt-commit] rt branch, 4.4/add-groups-users-cf-filter, repushed

Maureen Mirville maureen at bestpractical.com
Fri Jul 27 16:43:15 EDT 2018


The branch 4.4/add-groups-users-cf-filter was deleted and repushed:
       was a38a701ed00728f12feb61d51af48295a5be1c46
       now 5e61b8fbe838aa8e5dcced638478a034c8afe407

1: 97a1108d5 = 1: 97a1108d5 Add more filtering to Groups search on Admin>Groups>select
2: ae4abb80d ! 2: af2303e90 Add tests for filtering Groups search on Admin>Groups>select
    @@ -14,44 +14,39 @@
      
      my ( $url, $m ) = RT::Test->started_ok;
      ok( $m->login(), 'logged in' );
    --
    -+=pod
    - {
    -     diag "test creating a group" if $ENV{TEST_VERBOSE};
    -     $m->get_ok( $url . '/Admin/Groups/Modify.html?Create=1' );
     @@
    -     $m->content_contains('Illegal value for Name', 'found error message');
          $m->content_contains('test group', 'did not find new name');
      }
    -+=cut
    -+
    -+# testing groups search filtering
    + 
    ++diag "# Test /Admin/Groups/index.html search filtering";
     +{
    -+use Data::Printer colored => 1;
    -+
    -+    diag "create group customfields";
    -+    my @cf_names = qw(  CF1 CF2 CF3  );
    ++    diag "Create group CustomFields";
    ++    my @cf_names = qw( CF1 CF2 CF3 );
     +    my @cfs = ();
     +    foreach my $cf_name ( @cf_names ) {
    -+        ok( my $cf = RT::CustomField->new( RT->SystemUser ) );
    -+        ok( my ( $id, $msg ) = $cf->Create(
    ++        my $cf = RT::CustomField->new( RT->SystemUser );
    ++        my ( $id, $msg ) = $cf->Create(
     +            Name => $cf_name,
     +            TypeComposite => 'Freeform-1',
     +            LookupType => RT::Group->CustomFieldLookupType,
    -+        ) );
    -+        isnt ( $id, 0, $msg.': '.$cf_name );
    ++        );
    ++        ok( $id, $msg );
    ++        # Create a global ObjectCustomField record
    ++        my $object = $cf->RecordClassFromLookupType->new( RT->SystemUser );
    ++        ( $id, $msg ) = $cf->AddToObject( $object );
    ++        ok( $id, $msg );
     +        push ( @cfs, $cf );
     +    }
     +    my $cf_1 = $cfs[0];
     +    my $cf_2 = $cfs[1];
     +    my $cf_3 = $cfs[2];
     +
    -+    diag "create groups and add cf values";
    -+    my @group_names = qw(  Group1 Group2 Group3 Group4  );
    ++    diag "Create groups and add some CustomField values";
    ++    my @group_names = qw( Group1 Group2 Group3 Group4 );
     +    my @groups = ();
     +    foreach my $group_name ( @group_names ) {
    -+        ok ( my $group = RT::Group->new( RT->SystemUser ) );
    -+        ok ( my ( $id, $msg ) = $group->CreateUserDefinedGroup( Name => $group_name ) );
    ++        my $group = RT::Group->new( RT->SystemUser );
    ++        my ( $id, $msg ) = $group->CreateUserDefinedGroup( Name => $group_name );
     +        isnt ( $id, 0, $msg.': '.$group_name );
     +        push ( @groups, $group );
     +    }
    @@ -69,12 +64,9 @@
     +
     +    my $group_4 = $groups[3];
     +
    -+$m->get_ok( $url . '/Admin/Groups/Modify.html?id='.$group_2->id );
    -+$m->save_content('example.html'); #cfs are not showing up on group modify page
    -+
    -+    diag "filter groups on Admin>Groups>select";
    ++    diag "Filter groups search on Admin > Groups > select page";
     +    $m->get_ok( $url . '/Admin/Groups/index.html' );
    -+    ok ( $m->form_name( 'Admin_Groups' ) );
    ++    ok( $m->form_name( 'Admin_Groups' ), 'found the filter admin groups form');
     +    $m->select( GroupField => 'Name', GroupOp => 'LIKE' );
     +    $m->field( GroupString => 'Group' );
     +    $m->select( GroupField2 => 'CustomField: '.$cf_1->Name, GroupOp2 => 'LIKE' );
    @@ -82,10 +74,14 @@
     +    $m->select( GroupField3 => 'CustomField: '.$cf_2->Name, GroupOp3 => 'LIKE' );
     +    $m->field( GroupString3 => 'two' );
     +    $m->click( 'Go' );
    -+$m->save_content('example2.html');
     +
    ++    diag "Verify results contain Groups 2 & 3, but not 1 & 4";
    ++    $m->content_contains( $group_2->Name );
    ++    $m->content_contains( $group_3->Name );
    ++    $m->content_lacks( $group_1->Name );
    ++    $m->content_lacks( $group_4->Name );
     +}
     +
    - 
    ++
     +done_testing;
     
3: a38a701ed ! 3: de4654541 Add more filtering to Users search on Admin>Users>select
    @@ -6,6 +6,13 @@
     --- a/share/html/Admin/Users/index.html
     +++ b/share/html/Admin/Users/index.html
     @@
    + </script>
    + </form>
    + 
    +-<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
    ++<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html" name="Admin_Users">
    + % foreach my $field( qw(Format Rows Page Order OrderBy) ) {
    + %     next unless defined $ARGS{ $field } && length $ARGS{ $field };
      <input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
      % }
      <&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &><br />
    @@ -14,6 +21,11 @@
      <input type="checkbox" class="checkbox" id="FindDisabledUsers" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> />
      <label for="FindDisabledUsers"><&|/l&>Include disabled users in search.</&></label>
      <br />
    +-<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> 
    ++<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" name="Go" /></div> 
    + </form>
    + 
    + % unless ( $users->Count ) {
     @@
          Format => $Format,
          Collection => $users,
    @@ -47,8 +59,9 @@
     +
     +    push ( @users_queries, \%user2 ) if length $UserString2;
     +    push ( @users_queries, \%user3 ) if length $UserString3;
    ++
     +    foreach my $user ( @users_queries ) {
    -+        if ( $UserField =~ /^CustomField-(\d+)/ ) {
    ++        if ( $user->{'field'} =~ /^CustomField-(\d+)/ ) {
     +            $users->LimitCustomField(
     +                CUSTOMFIELD => $1,
     +                OPERATOR => $user->{'op'},
    @@ -254,3 +267,4 @@
     +$UserString3 => ''
     +$Fields     => undef
     +</%ARGS>
    +
-:  ------- > 4: 5e61b8fbe Add tests for filtering Users search on Admin>Users>select



More information about the rt-commit mailing list