[Rt-commit] rt branch, 4.4/add-groups-users-cf-filter, created. rt-4.4.3-25-ga38a701ed

Maureen Mirville maureen at bestpractical.com
Fri Jul 27 11:49:24 EDT 2018


The branch, 4.4/add-groups-users-cf-filter has been created
        at  a38a701ed00728f12feb61d51af48295a5be1c46 (commit)

- Log -----------------------------------------------------------------
commit 97a1108d505fceeaa2731fa7713f736d6e3b5cf1
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Jul 25 09:49:42 2018 -0400

    Add more filtering to Groups search on Admin>Groups>select

diff --git a/share/html/Admin/Groups/index.html b/share/html/Admin/Groups/index.html
index 416bd5dd8..0a2f2a919 100644
--- a/share/html/Admin/Groups/index.html
+++ b/share/html/Admin/Groups/index.html
@@ -64,11 +64,13 @@ jQuery(function(){
 </script>
 </form>
 
-<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html">
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html" name="Admin_Groups">
 <&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br />
+<&|/l&>And groups whose</&> <& /Elements/SelectGroups2 &><br />
+<&|/l&>And groups whose</&> <& /Elements/SelectGroups3 &><br />
 <input type="checkbox" class="checkbox" id="FindDisabledGroups" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> />
 <label for="FindDisabledGroups"><&|/l&>Include disabled groups in listing.</&></label><br />
-<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> 
+<div align="right"><input type="submit" class="button" name="Go" value="<&|/l&>Go!</&>" /></div>
 </form>
 
 % unless ( $Groups->Count ) {
@@ -84,7 +86,7 @@ jQuery(function(){
     Format => $Format,
     Collection => $Groups,
     AllowSorting => 1,
-    PassArguments => [qw(Format Rows Page Order OrderBy GroupString GroupOp GroupField FindDisabledGroups)],
+    PassArguments => [qw(Format Rows Page Order OrderBy GroupString GroupOp GroupField GroupString2 GroupOp2 GroupField2 GroupString3 GroupOp3 GroupField3 FindDisabledGroups)],
 &>
 % }
 
@@ -100,20 +102,32 @@ if ($FindDisabledGroups) {
 
 if (length $GroupString) {
     $caption = loc("Groups matching search criteria");
-    if ($GroupField =~ /^CustomField-(\d+)/) {
-        $Groups->LimitCustomField(
-            CUSTOMFIELD => $1,
-            OPERATOR => $GroupOp,
-            VALUE => $GroupString,
-        );
-    }
-    else {
-        $Groups->Limit(
-            FIELD => $GroupField,
-            OPERATOR => $GroupOp,
-            VALUE => $GroupString,
-            CASESENSITIVE => 0
-        );
+    my %group1 = ( field => $GroupField, op => $GroupOp, string => $GroupString );
+    my %group2 = ( field => $GroupField2, op => $GroupOp2, string => $GroupString2 );
+    my %group3 = ( field => $GroupField3, op => $GroupOp3, string => $GroupString3 );
+    my @groups = ( \%group1 );
+
+    push ( @groups, \%group2 ) if length $GroupString2;
+    push ( @groups, \%group3 ) if length $GroupString3;
+
+    foreach my $group ( @groups ) {
+        if ( $group->{'field'} =~ /^CustomField-(\d+)/ ) {
+            $Groups->LimitCustomField(
+                CUSTOMFIELD => $1,
+                OPERATOR => $group->{'op'},
+                VALUE => $group->{'string'},
+                ENTRYAGGREGATOR => 'AND',
+            );
+        }
+        else {
+            $Groups->Limit(
+                FIELD => $group->{'field'},
+                OPERATOR => $group->{'op'},
+                VALUE => $group->{'string'},
+                CASESENSITIVE => 0,
+                ENTRYAGGREGATOR => 'AND',
+            );
+        }
     }
     RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Groups/Modify.html?id=".$Groups->First->id)
           if $Groups->Count == 1 and $Groups->First;
@@ -132,5 +146,11 @@ $Format => undef,
 $GroupString => '' unless defined $GroupString
 $GroupOp => '='
 $GroupField => 'Name'
+$GroupString2 => '' unless defined $GroupString2
+$GroupOp2 => '='
+$GroupField2 => 'Name'
+$GroupString3 => '' unless defined $GroupString3
+$GroupOp3 => '='
+$GroupField3 => 'Name'
 $FindDisabledGroups => 0
 </%ARGS>
diff --git a/share/html/Elements/SelectGroups2 b/share/html/Elements/SelectGroups2
new file mode 100644
index 000000000..057735b70
--- /dev/null
+++ b/share/html/Elements/SelectGroups2
@@ -0,0 +1,68 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="GroupField2">
+% foreach my $col (RT::Group->BasicColumns) {
+<option <% ($GroupField2 eq $col->[0]) ? 'selected="selected"' : '' %> value="<% $col->[0] %>"><% loc($col->[1]) %></option>
+% }
+% while (my $CF = $CFs->Next) {
+%   my $val = "CustomField-" . $CF->Id;
+<option <% ($GroupField2 eq $val) ? 'selected="selected"' : '' %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option>
+% }
+</select>
+<& /Elements/SelectMatch, Name => 'GroupOp2', Default => $GroupOp2 &>
+<input size="8" name="GroupString2" value="<% $GroupString2 %>" />
+<%INIT>
+my $CFs = RT::CustomFields->new($session{'CurrentUser'});
+$CFs->LimitToChildType('RT::Group');
+$CFs->OrderBy( FIELD => 'Name' );
+</%INIT>
+<%ARGS>
+$GroupField2  => ''
+$GroupOp2     => ''
+$GroupString2 => ''
+</%ARGS>
diff --git a/share/html/Elements/SelectGroups3 b/share/html/Elements/SelectGroups3
new file mode 100644
index 000000000..73e3bac90
--- /dev/null
+++ b/share/html/Elements/SelectGroups3
@@ -0,0 +1,68 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="GroupField3">
+% foreach my $col (RT::Group->BasicColumns) {
+<option <% ($GroupField3 eq $col->[0]) ? 'selected="selected"' : '' %> value="<% $col->[0] %>"><% loc($col->[1]) %></option>
+% }
+% while (my $CF = $CFs->Next) {
+%   my $val = "CustomField-" . $CF->Id;
+<option <% ($GroupField3 eq $val) ? 'selected="selected"' : '' %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option>
+% }
+</select>
+<& /Elements/SelectMatch, Name => 'GroupOp3', Default => $GroupOp3 &>
+<input size="8" name="GroupString3" value="<% $GroupString3 %>" />
+<%INIT>
+my $CFs = RT::CustomFields->new($session{'CurrentUser'});
+$CFs->LimitToChildType('RT::Group');
+$CFs->OrderBy( FIELD => 'Name' );
+</%INIT>
+<%ARGS>
+$GroupField3  => ''
+$GroupOp3     => ''
+$GroupString3 => ''
+</%ARGS>

commit ae4abb80dd7b793770031caa2d1e6a5ba73cda2b
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Fri Jul 27 11:46:48 2018 -0400

    Add tests for filtering Groups search on Admin>Groups>select

diff --git a/t/web/admin_groups.t b/t/web/admin_groups.t
index 075fb6282..501be5bc2 100644
--- a/t/web/admin_groups.t
+++ b/t/web/admin_groups.t
@@ -1,11 +1,11 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 26;
+use RT::Test tests => undef;
 
 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' );
@@ -55,4 +55,68 @@ ok( $m->login(), 'logged in' );
     $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
+{
+use Data::Printer colored => 1;
+
+    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(
+            Name => $cf_name,
+            TypeComposite => 'Freeform-1',
+            LookupType => RT::Group->CustomFieldLookupType,
+        ) );
+        isnt ( $id, 0, $msg.': '.$cf_name );
+        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  );
+    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 ) );
+        isnt ( $id, 0, $msg.': '.$group_name );
+        push ( @groups, $group );
+    }
+    my $group_1 = $groups[0];
+    $group_1->AddCustomFieldValue( Field => $cf_1->id, Value => 'one' );
+
+    my $group_2 = $groups[1];
+    $group_2->AddCustomFieldValue( Field => $cf_1->id, Value => 'one' );
+    $group_2->AddCustomFieldValue( Field => $cf_2->id, Value => 'two' );
+
+    my $group_3 = $groups[2];
+    $group_3->AddCustomFieldValue( Field => $cf_1->id, Value => 'one' );
+    $group_3->AddCustomFieldValue( Field => $cf_2->id, Value => 'two' );
+    $group_3->AddCustomFieldValue( Field => $cf_3->id, Value => 'three' );
+
+    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";
+    $m->get_ok( $url . '/Admin/Groups/index.html' );
+    ok ( $m->form_name( 'Admin_Groups' ) );
+    $m->select( GroupField => 'Name', GroupOp => 'LIKE' );
+    $m->field( GroupString => 'Group' );
+    $m->select( GroupField2 => 'CustomField: '.$cf_1->Name, GroupOp2 => 'LIKE' );
+    $m->field( GroupString2 => 'one' );
+    $m->select( GroupField3 => 'CustomField: '.$cf_2->Name, GroupOp3 => 'LIKE' );
+    $m->field( GroupString3 => 'two' );
+    $m->click( 'Go' );
+$m->save_content('example2.html');
+
+}
+
 
+done_testing;

commit a38a701ed00728f12feb61d51af48295a5be1c46
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Jul 25 12:04:43 2018 -0400

    Add more filtering to Users search on Admin>Users>select

diff --git a/share/html/Admin/Users/index.html b/share/html/Admin/Users/index.html
index f3f4d7b2b..62fb0bded 100644
--- a/share/html/Admin/Users/index.html
+++ b/share/html/Admin/Users/index.html
@@ -75,6 +75,8 @@ jQuery(function(){
 <input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
 % }
 <&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &><br />
+<&|/l&>And all users whose</&> <& /Elements/SelectUsers2, %ARGS, Fields => \@fields &><br />
+<&|/l&>And all users whose</&> <& /Elements/SelectUsers3, %ARGS, Fields => \@fields &><br />
 <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 />
@@ -94,7 +96,7 @@ jQuery(function(){
     Format => $Format,
     Collection => $users,
     AllowSorting => 1,
-    PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField IdLike EmailLike FindDisabledUsers)],
+    PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField UserString2 UserOp2 UserField2 UserString3 UserOp3 UserField3 IdLike EmailLike FindDisabledUsers)],
 &>
 
 % }
@@ -106,19 +108,30 @@ $users->FindAllRows if $FindDisabledUsers;
 
 if ( defined($UserString) && length $UserString ) {
     $caption = loc("Users matching search criteria");
-    if ( $UserField =~ /^CustomField-(\d+)/ ) {
-        $users->LimitCustomField(
-            CUSTOMFIELD => $1,
-            OPERATOR => $UserOp,
-            VALUE => $UserString,
-        ); 
-    }
-    else {
-        $users->Limit(
-            FIELD => $UserField,
-            OPERATOR => $UserOp,
-            VALUE => $UserString,
-        ); 
+    my %user1 = ( field => $UserField, op => $UserOp, string => $UserString );
+    my %user2 = ( field => $UserField2, op => $UserOp2, string => $UserString2 );
+    my %user3 = ( field => $UserField3, op => $UserOp3, string => $UserString3 );
+    my @users_queries = ( \%user1 );
+
+    push ( @users_queries, \%user2 ) if length $UserString2;
+    push ( @users_queries, \%user3 ) if length $UserString3;
+    foreach my $user ( @users_queries ) {
+        if ( $UserField =~ /^CustomField-(\d+)/ ) {
+            $users->LimitCustomField(
+                CUSTOMFIELD => $1,
+                OPERATOR => $user->{'op'},
+                VALUE => $user->{'string'},
+                ENTRYAGGREGATOR => 'AND',
+            );
+        }
+        else {
+            $users->Limit(
+                FIELD => $user->{'field'},
+                OPERATOR => $user->{'op'},
+                VALUE => $user->{'string'},
+                ENTRYAGGREGATOR => 'AND',
+            );
+        }
     }
     RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Users/Modify.html?id=".$users->First->id)
           if $users->Count == 1;
@@ -161,6 +174,12 @@ $Format => undef,
 $UserString => undef
 $UserOp => '='
 $UserField => 'Name'
+$UserString2 => undef
+$UserOp2 => '='
+$UserField2 => 'Name'
+$UserString3 => undef
+$UserOp3 => '='
+$UserField3 => 'Name'
 $IdLike => undef
 $EmailLike => undef
 
diff --git a/share/html/Elements/SelectUsers2 b/share/html/Elements/SelectUsers2
new file mode 100644
index 000000000..e598c8315
--- /dev/null
+++ b/share/html/Elements/SelectUsers2
@@ -0,0 +1,81 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="UserField2">
+% foreach my $col (@fields) {
+<option <% ($UserField2 eq $col->[0]) ? 'selected="selected"' : '' |n %> value="<% $col->[0] %>"><% loc($col->[1]) %></option>
+% }
+% while (my $CF = $CFs->Next) {
+%   my $val = "CustomField-" . $CF->Id;
+<option <% ($UserField2 eq $val) ? 'selected="selected"' : '' |n %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option>
+% }
+</select>
+<& /Elements/SelectMatch, Name => 'UserOp2', Default => $UserOp2 &>
+<input size="8" name="UserString2" value="<% $UserString2 %>" />
+<%INIT>
+my $CFs = RT::CustomFields->new($session{'CurrentUser'});
+$CFs->LimitToChildType('RT::User');
+$CFs->OrderBy( FIELD => 'Name' );
+
+my @fields = RT::User->BasicColumns;
+
+if ( $Fields and ref $Fields eq 'ARRAY' ) {
+    if ( ref $Fields->[0] eq 'ARRAY' ) {
+        @fields = @$Fields;
+    }
+    else {
+        # make the name equal the label
+        @fields = [ @$Fields, @$Fields ];
+    }
+}
+</%INIT>
+<%ARGS>
+$UserField2  => ''
+$UserOp2     => ''
+$UserString2 => ''
+$Fields     => undef
+</%ARGS>
diff --git a/share/html/Elements/SelectUsers3 b/share/html/Elements/SelectUsers3
new file mode 100644
index 000000000..e7c84c4c0
--- /dev/null
+++ b/share/html/Elements/SelectUsers3
@@ -0,0 +1,81 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="UserField3">
+% foreach my $col (@fields) {
+<option <% ($UserField3 eq $col->[0]) ? 'selected="selected"' : '' |n %> value="<% $col->[0] %>"><% loc($col->[1]) %></option>
+% }
+% while (my $CF = $CFs->Next) {
+%   my $val = "CustomField-" . $CF->Id;
+<option <% ($UserField3 eq $val) ? 'selected="selected"' : '' |n %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option>
+% }
+</select>
+<& /Elements/SelectMatch, Name => 'UserOp3', Default => $UserOp3 &>
+<input size="8" name="UserString3" value="<% $UserString3 %>" />
+<%INIT>
+my $CFs = RT::CustomFields->new($session{'CurrentUser'});
+$CFs->LimitToChildType('RT::User');
+$CFs->OrderBy( FIELD => 'Name' );
+
+my @fields = RT::User->BasicColumns;
+
+if ( $Fields and ref $Fields eq 'ARRAY' ) {
+    if ( ref $Fields->[0] eq 'ARRAY' ) {
+        @fields = @$Fields;
+    }
+    else {
+        # make the name equal the label
+        @fields = [ @$Fields, @$Fields ];
+    }
+}
+</%INIT>
+<%ARGS>
+$UserField3  => ''
+$UserOp3     => ''
+$UserString3 => ''
+$Fields     => undef
+</%ARGS>

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


More information about the rt-commit mailing list