[Rt-commit] rt branch, 4.0/preserve-ticket-basics, created. rt-4.0.1-223-g1492b7a
Jason May
jasonmay at bestpractical.com
Thu Nov 3 18:28:25 EDT 2011
The branch, 4.0/preserve-ticket-basics has been created
at 1492b7ab42b76e0d817745c3873ee16c9a79c66f (commit)
- Log -----------------------------------------------------------------
commit 1492b7ab42b76e0d817745c3873ee16c9a79c66f
Author: Jason May <jasonmay at bestpractical.com>
Date: Thu Nov 3 18:21:59 2011 -0400
Preserve the rest of the ticket basics in Jumbo
When AddMoreAttach is clicked in Jumbo, Status, Subject, Owner, and
others are preserved.
Also, Owner is now disambiguated whether AddMoreAttach is clicked or
not. This was needed, because an owner needs to be passed the preserved
arg into the owner field component.
diff --git a/share/html/Ticket/ModifyAll.html b/share/html/Ticket/ModifyAll.html
index 3562486..83c7ca0 100755
--- a/share/html/Ticket/ModifyAll.html
+++ b/share/html/Ticket/ModifyAll.html
@@ -57,7 +57,9 @@
<&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &>
% my @preserve_fields = qw(
+% Status Subject Owner
% TimeWorked TimeEstimated TimeLeft
+% Priority FinalPriority
% );
<& Elements/EditBasics,
TicketObj => $Ticket,
@@ -187,7 +189,7 @@ unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
$m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS );
my @results;
-unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) {
+unless ($OnlySearchForPeople or $OnlySearchForGroup ) {
# There might be two owners.
if ( ref ($ARGS{'Owner'} )) {
my @owners =@{$ARGS{'Owner'}};
@@ -198,18 +200,20 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} )
}
- push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
- push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
- push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
-
- # Add session attachments if any to be processed by ProcessUpdateMessage
- $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
- push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
- # Cleanup WebUI
- delete $session{'Attachments'};
+ unless ( $ARGS{'AddMoreAttach'} ) {
+ push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
+
+ # Add session attachments if any to be processed by ProcessUpdateMessage
+ $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} );
+ push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
+ # Cleanup WebUI
+ delete $session{'Attachments'};
- push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
- push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ }
}
$Ticket->ApplyTransactionBatch;
diff --git a/t/web/ticket_basics.t b/t/web/ticket_basics.t
index ea3045f..6d01770 100644
--- a/t/web/ticket_basics.t
+++ b/t/web/ticket_basics.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 59;
+use RT::Test tests => 77;
my $ticket = RT::Test->create_ticket(
Subject => 'test ticket basics',
@@ -11,40 +11,51 @@ my $ticket = RT::Test->create_ticket(
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login, 'logged in' );
+my $change_to_owner = do {
+ $m->get( $url . "/Ticket/ModifyAll.html?id=" . $ticket->id );
+ my $form = $m->form_name('ModifyTicket');
+ my @values = $form->find_input('Owner')->possible_values;
+ $values[-1];
+};
# Failing test where the time units are not preserved when you
# click 'Add more files' on Display
my @form_tries = (
- {TimeEstimated => undef},
- {TimeEstimated => "1"},
- {TimeWorked => undef},
- {TimeWorked => "1"},
- {TimeLeft => undef},
- {TimeLeft => "1"},
+ {Subject => "hello rt"},
+ {Status => "open"},
+ {Owner => $change_to_owner},
+
+ (
+ map +{
+ "Time$_" => undef,
+ "Time$_-TimeUnits" => 'hours',
+ }, qw/Estimated Worked Left/
+ ),
+ (
+ map +{
+ "Time$_" => '1',
+ "Time$_-TimeUnits" => 'hours',
+ }, qw/Estimated Worked Left/
+ ),
+
+ {InitialPriority => "10"},
+ {FinalPriority => "10"},
);
+
for my $try (@form_tries) {
$m->goto_create_ticket(1);
$m->form_name('TicketCreate');
+ $m->set_fields(%$try);
+ $m->click('AddMoreAttach');
+ $m->form_name('TicketCreate');
for my $field (keys %$try) {
- $m->select("${field}-TimeUnits" => 'hours');
- $m->field($field => $try->{$field}) if defined $try->{$field};
- $m->click('AddMoreAttach');
- $m->form_name('TicketCreate');
- is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
is(
$m->value($field),
defined($try->{$field}) ? $try->{$field} : '',
- 'time value is the same after the form was submitted'
+ "field $field is the same after the form was submitted"
);
}
}
-$m->goto_update_ticket(ticket => $ticket, action => 'Respond');
-$m->form_name('TicketUpdate');
-$m->select("UpdateTimeWorked-TimeUnits" => 'hours');
-$m->click('AddMoreAttach');
-$m->form_name('TicketUpdate');
-is($m->value("UpdateTimeWorked-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
-
my $cf = RT::Test->load_or_create_custom_field(
Name => 'CF1',
Type => 'Freeform',
@@ -76,19 +87,20 @@ for my $try (@form_tries) {
Queue => 1,
);
- $m->get_ok( $url . "/Ticket/ModifyAll.html?id=" . $jumbo_ticket->id );
+ local($try->{Priority}) = delete local($try->{InitialPriority})
+ if exists $try->{InitialPriority};
+ $m->get( $url . "/Ticket/ModifyAll.html?id=" . $jumbo_ticket->id );
+ $m->form_name('ModifyTicket');
+ $m->set_fields(%$try);
+ $m->click('AddMoreAttach');
+ $m->form_name('ModifyTicket');
for my $field (keys %$try) {
- $m->form_name('ModifyTicket');
- $m->field($field => $try->{$field}) if defined $try->{$field};
- $m->select("${field}-TimeUnits" => 'hours');
- $m->click('AddMoreAttach');
- $m->form_name('ModifyTicket');
- is($m->value("${field}-TimeUnits"), 'hours', 'time units stayed to "hours" after the form was submitted');
is(
$m->value($field),
defined($try->{$field}) ? $try->{$field} : '',
- 'time value is the same after the form was submitted'
+ "field $field is the same after the Jumbo form was submitted"
);
}
}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list