[Rt-commit] rt branch, 4.6/queue-input-in-ticket-create, created. rt-4.4.4-727-gf72a29438c

? sunnavy sunnavy at bestpractical.com
Wed Feb 5 17:58:49 EST 2020


The branch, 4.6/queue-input-in-ticket-create has been created
        at  f72a29438c449616b8cf932a2bf9074ce39e062e (commit)

- Log -----------------------------------------------------------------
commit 36a2941b1b8af805b2cf2a8ea254f7c851819641
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Tue Jan 7 20:07:58 2020 +0000

    Select Queue in Ticket Create page
    
    Allow Queue to be selected in the create ticket page, using defaults
    from configuration if none provided. Existing urls for queue creation
    will still work.

diff --git a/share/html/Elements/SelectQueue b/share/html/Elements/SelectQueue
index 412f95e2f5..c23bb459d1 100644
--- a/share/html/Elements/SelectQueue
+++ b/share/html/Elements/SelectQueue
@@ -62,5 +62,6 @@ $ShowAllQueues   => 1
 $AutoSubmit      => 0
 </%args>
 <%init>
-$ARGS{OnChange} = "jQuery(this).closest('form').submit();" if $AutoSubmit;
+$ARGS{OnChange} = "jQuery(this).closest('form').find('input[name=QueueChanged]').val(1);";
+$ARGS{OnChange} .= "jQuery(this).closest('form').submit();" if $AutoSubmit;
 </%init>
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 1e2de412da..992f4af435 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -56,6 +56,7 @@
   <input type="submit" name="SubmitTicket" value="Create" style="display:none">
   <input type="hidden" class="hidden" name="id" value="new" />
   <input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
+  <input type="hidden" name="QueueChanged" value="0" />
 
 % if ( $ARGS{'AddGroupCc'} ){
 <input type="hidden" class="hidden" name="AddGroupCc" value="<% $ARGS{'AddGroupCc'} %>" />
@@ -72,7 +73,6 @@
 
 <div id="ticket-create-metadata">
     <&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &>
-    <input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" />
     <div>
     <& /Ticket/Elements/EditBasics,
         InTable => 1,
@@ -80,10 +80,12 @@
         defaults => \%ARGS,
         fields  => [
             {   name => 'Queue',
-                comp => '/Ticket/Elements/ShowQueue',
+                comp => '/Elements/SelectQueue',
                 args => {
-                    QueueObj => $QueueObj,
-                    Wrap => 1,
+                    Name           => 'Queue',
+                    Default        => $Queue,
+                    ShowNullOption => 0,
+                    AutoSubmit     => 1,
                 },
             },
             {   name => 'Status',
@@ -326,6 +328,30 @@
 <%INIT>
 $m->callback( CallbackName => "Init", ARGSRef => \%ARGS );
 my $Queue = $ARGS{Queue};
+
+# Use default queue from config site or user prefs if none provided
+unless ($Queue) {
+    if ( $session{'DefaultQueue'} && RT->Config->Get( "RememberDefaultQueue", $session{'CurrentUser'} ) ) {
+        $Queue = $session{'DefaultQueue'};
+    }
+    else {
+        $Queue = RT->Config->Get( "DefaultQueue", $session{'CurrentUser'} );
+    }
+}
+
+# pick first in list in normal order unless queue provided from form/url/defaults
+unless ($Queue) {
+    my $cache_key = SetObjectSessionCache(
+        ObjectType       => 'Queue',
+        CheckRight       => 'CreateTicket',
+        CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate,
+    );
+
+    $Queue = $session{$cache_key}{objects}[0]->{Id};
+}
+
+Abort( loc( "Permission Denied" ) ) unless $Queue;
+
 $session{DefaultQueue} = $Queue;
 
 my $current_user = $session{'CurrentUser'};
@@ -473,7 +499,7 @@ $m->comp( '/Articles/Elements/CheckSkipCreate', ARGSRef => \%ARGS, skip_create =
               checks_failure => $checks_failure, results => \@results );
 
 if ((!exists $ARGS{'AddMoreAttach'}) and (!exists $ARGS{'Go'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket?
-    if ( !$checks_failure && !$skip_create ) {
+    if ( !$checks_failure && !$skip_create && !$ARGS{'QueueChanged'} ) {
         $m->comp('Display.html', %ARGS);
         $RT::Logger->crit("After display call; error is $@");
         $m->abort();
diff --git a/share/static/js/autocomplete.js b/share/static/js/autocomplete.js
index c4362edb16..e7cfaea82c 100644
--- a/share/static/js/autocomplete.js
+++ b/share/static/js/autocomplete.js
@@ -81,7 +81,11 @@ window.RT.Autocomplete.bind = function(from) {
         if (input.attr("data-autocomplete-autosubmit")) {
             options.select = function( event, ui ) {
                 jQuery(event.target).val(ui.item.value);
-                jQuery(event.target).closest("form").submit();
+                var form = jQuery(event.target).closest("form");
+                if ( what === 'Queues' ) {
+                    form.find('input[name=QueueChanged]').val(1);
+                }
+                form.submit();
             };
         }
 

commit d9b8b909b45d292e030526c9bfc03686141cab33
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Tue Jan 7 20:09:07 2020 +0000

    Test queue select on ticket create page
    
    Added new tests for creating tickets with custom fields and lifecycles,
    and with or without queue specified.

diff --git a/t/web/csrf.t b/t/web/csrf.t
index 4abfb4d14d..ce27c54d2e 100644
--- a/t/web/csrf.t
+++ b/t/web/csrf.t
@@ -143,14 +143,12 @@ $m->content_contains("your browser did not supply a Referrer header");
 $m->title_is('Possible cross-site request forgery');
 
 # Sending a wrong CSRF is just a normal request.  We'll make a request
-# with just an invalid token, which means no Queue=, which means
-# Create.html errors out.
+# with just an invalid token, which means no Queue=x so default queue used
 my $link = $m->find_link(text_regex => qr{resume your request});
 (my $broken_url = $link->url) =~ s/(CSRF_Token)=\w+/$1=crud/;
 $m->get($broken_url);
-$m->content_like(qr/Queue\s+could not be loaded/);
-$m->title_is('RT Error');
-$m->warning_like(qr/Queue\s+could not be loaded/);
+$m->content_like(qr/Create\sa\snew\sticket\sin\sGeneral/);
+$m->title_is('Create a new ticket in General');
 
 # The token doesn't work for other pages, or other arguments to the same page.
 $m->add_header(Referer => undef);
@@ -173,8 +171,7 @@ $m->title_is('Configuration for queue test');
 $m->get_ok("/Ticket/Create.html?Queue=$other_queue_id&CSRF_Token=$token");
 $m->content_lacks("Possible cross-site request forgery");
 $m->title_is('Create a new ticket in General');
-$m->text_unlike(qr/Queue:\s*Other queue/);
-$m->text_like(qr/Queue:\s*General/);
+is($m->form_name('TicketCreate')->value('Queue'), 1, 'Queue selection dropdown populated and pre-selected');
 
 # Ensure that file uploads work across the interstitial
 $m->delete_header('Referer');
diff --git a/t/web/ticket_create.t b/t/web/ticket_create.t
new file mode 100644
index 0000000000..d579c8a377
--- /dev/null
+++ b/t/web/ticket_create.t
@@ -0,0 +1,80 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+use RT::Lifecycle;
+
+# populate lifecycles
+my $lifecycles = RT->Config->Get('Lifecycles');
+RT->Config->Set(
+    Lifecycles => %{$lifecycles},
+    foo        => {
+        initial  => ['initial'],
+        active   => ['open'],
+        inactive => ['resolved'],
+    }
+);
+RT::Lifecycle->FillCache();
+
+# populate test queues and test user
+my $queue1 = RT::Test->load_or_create_queue( Name => 'General' );
+my $queue2 = RT::Test->load_or_create_queue( Name => 'Another queue' );
+my $user   = RT::Test->load_or_create_user(
+    Name     => 'user',
+    Password => 'password',
+);
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+
+#set up lifecycle for one of the queues
+ok $m->login;
+$m->get_ok( '/Admin/Queues/Modify.html?id=' . $queue1->id );
+$m->form_name('ModifyQueue');
+$m->submit_form( fields => { Lifecycle => 'foo' } );
+
+# set up custom field
+my $cf = RT::Test->load_or_create_custom_field( Name => 'test_cf', Queue => $queue1->Name, Type => 'FreeformSingle' );
+my $cf_form_id    = 'Object-RT::Ticket--CustomField-' . $cf->Id . '-Value';
+my $cf_test_value = "some string for test_cf $$";
+
+# load initial ticket create page without specifying queue
+# should have default queue with no custom fields
+note('load create ticket page with defaults');
+$m->get_ok('/');
+$m->submit_form( form_name => "CreateTicketInQueue", );
+
+ok( !$m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field not present' );
+is( $m->form_name('TicketCreate')->value('Queue'), $queue2->id, 'Queue selection dropdown populated and pre-selected' );
+is( $m->form_name('TicketCreate')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected' );
+
+$m->get_ok( '/Ticket/Create.html', 'go to ticket create page with no queue id' );
+ok( !$m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field not present' );
+is( $m->form_name('TicketCreate')->value('Queue'), $queue2->id, 'Queue selection dropdown populated and pre-selected' );
+is( $m->form_name('TicketCreate')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected' );
+
+# test ticket creation on reload from selected queue, specifying queue with custom fields
+note('reload ticket create page with selected queue');
+$m->get_ok( '/Ticket/Create.html?Queue=' . $queue1->id, 'go to ticket create page' );
+
+is( $m->form_name('TicketCreate')->value('Queue'), $queue1->id, 'Queue selection dropdown populated and pre-selected' );
+ok( $m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field present' );
+is( $m->form_name('TicketCreate')->value($cf_form_id), '', 'custom field present and empty' );
+
+my $form         = $m->form_name('TicketCreate');
+my $status_input = $form->find_input('Status');
+is_deeply(
+    [ $status_input->possible_values ],
+    [ 'initial', 'open', 'resolved' ],
+    'status selectbox shows custom lifecycle for queue'
+);
+
+note('submit populated form');
+$m->submit_form( fields => { Subject => 'ticket foo', 'Queue' => $queue1->id, $cf_form_id => $cf_test_value } );
+$m->text_contains( 'test_cf',      'custom field populated in display' );
+$m->text_contains( $cf_test_value, 'custom field populated in display' );
+
+my $ticket = RT::Test->last_ticket;
+ok( $ticket->id, 'ticket is created' );
+is( $ticket->QueueObj->id, $queue1->id, 'Ticket created with correct queue' );
+
+done_testing();

commit 7d1281060d61974f610695abbb4516c3555248e0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 6 04:57:28 2020 +0800

    Drop queue select modal stuff
    
    As we have queue select on ticket create page, the "select queue in
    advance" thing is not necessary any more.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 41b6b4c2c3..5ce829c461 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -88,7 +88,7 @@ sub BuildMainNav {
         $widgets->child( create_article => raw_html => $HTML::Mason::Commands::m->scomp('/Articles/Elements/CreateArticleButton') );
     } else {
         $widgets->child( simple_search => raw_html => $HTML::Mason::Commands::m->scomp('SimpleSearch', Placeholder => loc('Search Tickets')) );
-        $widgets->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket', ButtonOnly => 1) );
+        $widgets->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket') );
     }
 
     my $home = $top->child( home => title => loc('Homepage'), path => '/' );
diff --git a/share/html/Elements/CreateInQueue b/share/html/Elements/CreateInQueue
deleted file mode 100644
index fc0540e0e5..0000000000
--- a/share/html/Elements/CreateInQueue
+++ /dev/null
@@ -1,62 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2019 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 }}}
-<form action="<% RT->Config->Get("WebPath") %>/Ticket/Create.html" id="TicketCreateInQueue">
-  <div class="form-row">
-    <div class="col-md-12 text-center">
-      <&|/l&>Select a queue for your new ticket.</&>
-      <div class="d-inline-block">
-        <& /Elements/SelectQueue, Name => 'Queue', ShowNullOption => 0, AutoSubmit => 1 &>
-      </div>
-    </div>
-  </div>
-  <div class="form-row">
-    <div class="col-md-12">
-      <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to the Create Ticket page.") &>
-    </div>
-  </div>
-</form>
diff --git a/share/html/Elements/CreateTicket b/share/html/Elements/CreateTicket
index 22a2e45937..e488c572c6 100644
--- a/share/html/Elements/CreateTicket
+++ b/share/html/Elements/CreateTicket
@@ -54,36 +54,22 @@
 % }
 
 % my $button_start = '<input type="submit" class="button btn btn-primary form-control" value="';
-% my $button_start_modal = '<input type="submit" class="button btn btn-primary form-control ticket-create-modal" value="';
-% my $button_only_start_modal = '<input type="submit" class="btn btn-primary ticket-create-modal" value="';
 % my $button_end = '" />';
 % my $queue_selector = $m->scomp('/Elements/SelectNewTicketQueue', AutoSubmit => 1, SendTo => $SendTo, Placeholder => loc('Queue'), Hyperlink => $Hyperlink );
 
 % if ($Hyperlink) {
 <% $queue_selector |n %>
 % }
-% elsif ($ButtonOnly) {
-<div class="create-wide">
-<&|/l_unsafe, $button_only_start_modal, $button_end &>[_1]Create new ticket[_2]</&>
-</div>
-<div class="create-medium">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]Create[_2]</&>
-</div>
-<div class="create-narrow">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]+[_2]</&>
-</div>
-% }
-% else {
+
 <div class="create-wide">
-<&|/l_unsafe, $button_start, $button_end, $queue_selector &>[_1]New ticket in[_2] [_3]</&>
+<&|/l_unsafe, $button_start, $button_end &>[_1]Create new ticket[_2]</&>
 </div>
 <div class="create-medium">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]New ticket[_2]</&>
+<&|/l_unsafe, $button_start, $button_end &>[_1]Create[_2]</&>
 </div>
 <div class="create-narrow">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]+[_2]</&>
+<&|/l_unsafe, $button_start, $button_end &>[_1]+[_2]</&>
 </div>
-% }
 
 % $m->callback(CallbackName => 'BeforeFormEnd');
 
@@ -92,5 +78,4 @@
 $SendTo => '/Ticket/Create.html',
 $IncludeExplanation => 0
 $Hyperlink => undef
-$ButtonOnly => undef
 </%ARGS>
diff --git a/share/html/Helpers/CreateInQueue b/share/html/Helpers/CreateInQueue
deleted file mode 100644
index b1ab4b8f46..0000000000
--- a/share/html/Helpers/CreateInQueue
+++ /dev/null
@@ -1,61 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2016 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 }}}
-<div class="modal-dialog modal-dialog-centered" role="document">
-  <div class="modal-content">
-    <div class="modal-header">
-      <h5 class="modal-title"><&|/l&>Select Queue</&></h5>
-      <a href="javascript:void(0)" class="close" data-dismiss="modal" aria-label="Close">
-        <span aria-hidden="true">×</span>
-      </a>
-    </div>
-    <div class="modal-body">
-      <& /Elements/CreateInQueue &>
-    </div>
-  </div>
-</div>
-% $m->abort;
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 2092d7200b..507a497008 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -621,14 +621,6 @@ jQuery(function() {
         return false;
     });
 
-    jQuery(".ticket-create-modal").click(function(ev){
-        ev.preventDefault();
-        jQuery.get(
-            RT.Config.WebHomePath + "/Helpers/CreateInQueue",
-            showModal
-        );
-    });
-
     jQuery("#articles-create, .article-create-modal").click(function(ev){
         ev.preventDefault();
         jQuery.get(

commit f72a29438c449616b8cf932a2bf9074ce39e062e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 6 06:34:21 2020 +0800

    Tweak tests as top ticket create form doesn't have Queue input any more
    
    Tests could pass even without the changes in this commit because
    mechanize allows to submit extra fields, but it's better to be
    consistent with real forms.

diff --git a/t/customfields/access_via_queue.t b/t/customfields/access_via_queue.t
index 300e777b8b..97a0732d66 100644
--- a/t/customfields/access_via_queue.t
+++ b/t/customfields/access_via_queue.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test nodata => 1, tests => 47;
+use RT::Test nodata => 1, tests => undef;
 use RT::Ticket;
 use RT::CustomField;
 
@@ -96,10 +96,7 @@ ok $m->login( tester => 'password' ), 'logged in';
 
 diag "check that we don't have the cf on create";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => $queue->Name },
-    );
+    $m->get_ok( '/Ticket/Create.html?Queue=' . $queue->id, 'go to ticket create page with queue id' );
 
     my $form = $m->form_name("TicketCreate");
     my $cf_field = "Object-RT::Ticket--CustomField-". $cf->id ."-Value";
@@ -181,3 +178,4 @@ note 'make sure CF is not reset to no value';
     is $t->FirstCustomFieldValue($cf_name), '2012-02-12';
 }
 
+done_testing;
diff --git a/t/customfields/sort_order.t b/t/customfields/sort_order.t
index 4a84ec5955..0db4beae4a 100644
--- a/t/customfields/sort_order.t
+++ b/t/customfields/sort_order.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 20;
+use RT::Test tests => undef;
 use RT::Ticket;
 use RT::CustomField;
 
@@ -64,10 +64,7 @@ diag "reorder CFs: C, A and B";
 
 diag "check ticket create, display and edit pages";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => $queue->Name },
-    );
+    $m->get_ok( '/Ticket/Create.html?Queue=' . $queue->id, 'go to ticket create page with queue id' );
 
     my @tmp = ($m->content =~ /(CF [ABC])/g);
     is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
@@ -89,3 +86,4 @@ diag "check ticket create, display and edit pages";
     is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
 }
 
+done_testing;
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index aa707f5dc6..c55a50bdd0 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -126,10 +126,7 @@ ok $m->login( $tester->Name, 123456, logout => 1), 'logged in';
 diag "check that we have no the CF on the create"
     ." ticket page when user has no SeeCustomField right";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_lacks('Upload multiple images', 'has no upload image field');
 
     my $form = $m->form_name("TicketCreate");
@@ -156,10 +153,7 @@ RT::Test->set_rights(
 diag "check that we have no the CF on the create"
     ." ticket page when user has no ModifyCustomField right";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_lacks('Upload multiple images', 'has no upload image field');
 
     my $form = $m->form_name("TicketCreate");
@@ -188,10 +182,8 @@ RT::Test->set_rights(
 
 diag "create a ticket with an image";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('Upload multiple images', 'has a upload image field');
 
     $cf =~ /(\d+)$/ or die "Hey this is impossible dude";
diff --git a/t/web/cf_date.t b/t/web/cf_date.t
index b3b7dcc288..c31f280f9c 100644
--- a/t/web/cf_date.t
+++ b/t/web/cf_date.t
@@ -54,10 +54,7 @@ diag 'check valid inputs with various timezones in ticket create page';
 {
     my ( $ticket, $id );
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields    => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('Select date', 'has cf field' );
 
     $m->submit_form(
@@ -165,10 +162,7 @@ diag 'check search build page';
 
 diag 'check invalid inputs';
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields    => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     my $form = $m->form_name("TicketCreate");
 
     $m->submit_form(
@@ -212,10 +206,7 @@ diag 'retain values when adding attachments';
     $txn_cf->AddToObject(RT::Queue->new(RT->SystemUser));
     my $txn_cfid = $txn_cf->id;
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields    => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('test cf date', 'has cf' );
     $m->content_contains('test txn cf date', 'has txn cf' );
 
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 044555358a..947b0cf29d 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -62,10 +62,7 @@ diag 'check valid inputs with various timezones in ticket create page';
 {
     my ( $ticket, $id );
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('Select datetime', 'has cf field');
 
     $m->submit_form(
@@ -103,10 +100,7 @@ diag 'check valid inputs with various timezones in ticket create page';
             'cf datetime value respects user timezone' );
     }
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->submit_form(
         form_name => "TicketCreate",
         fields    => {
@@ -192,10 +186,7 @@ diag 'check search build page';
 
 diag 'check invalid inputs';
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     my $form = $m->form_name("TicketCreate");
 
     $m->submit_form(
@@ -238,10 +229,7 @@ diag 'retain values when adding attachments';
     $txn_cf->AddToObject(RT::Queue->new(RT->SystemUser));
     my $txn_cfid = $txn_cf->id;
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields    => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('test cf datetime', 'has cf' );
     $m->content_contains('test txn cf datetime', 'has txn cf' );
 
diff --git a/t/web/cf_image.t b/t/web/cf_image.t
index 7c294b8479..ef46b25c43 100644
--- a/t/web/cf_image.t
+++ b/t/web/cf_image.t
@@ -26,10 +26,7 @@ $m->click_ok( "UpdateObjs" );
 $m->content_contains("Globally added custom field Images");
 
 
-$m->submit_form_ok({
-    form_name => "CreateTicketInQueue",
-    fields    => { Queue => 'General' },
-});
+$m->submit_form( form_name => "CreateTicketInQueue" );
 $m->content_contains("Upload one image");
 $m->submit_form_ok({
     form_name => "TicketCreate",
diff --git a/t/web/cf_set_initial.t b/t/web/cf_set_initial.t
index 0cf4f68b3c..00ec53af59 100644
--- a/t/web/cf_set_initial.t
+++ b/t/web/cf_set_initial.t
@@ -31,10 +31,7 @@ ok $m->login( $tester->Name, 123456, logout => 1), 'logged in';
 diag "check that we have no CFs on the create"
     ." ticket page when user has no SetInitialCustomField right";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_lacks('Test Set Initial CF', 'has no CF input');
     $m->content_lacks('Multi Set Initial CF', 'has no CF input');
 
@@ -66,10 +63,7 @@ RT::Test->set_rights(
 diag "check that we have the CF on the create"
     ." ticket page when user has SetInitialCustomField but no SeeCustomField";
 {
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains('Test Set Initial CF', 'has CF input');
     $m->content_contains('Multi Set Initial CF', 'has CF input');
 
diff --git a/t/web/ticket_txn_cf.t b/t/web/ticket_txn_cf.t
index 42a37720ad..8595156b66 100644
--- a/t/web/ticket_txn_cf.t
+++ b/t/web/ticket_txn_cf.t
@@ -52,10 +52,7 @@ my ( $ticket, $id );
 diag 'submit value on ticket create page';
 {
 
-    $m->submit_form(
-        form_name => "CreateTicketInQueue",
-        fields    => { Queue => 'General' },
-    );
+    $m->submit_form( form_name => "CreateTicketInQueue" );
     $m->content_contains($cf_name, 'has cf field' );
 
     $m->submit_form(

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


More information about the rt-commit mailing list