[Rt-commit] rt branch, 4.2/retain-default-cf-value-on-refresh, created. rt-4.1.6-384-g88905be
Jim Brandt
jbrandt at bestpractical.com
Thu Apr 4 15:37:08 EDT 2013
The branch, 4.2/retain-default-cf-value-on-refresh has been created
at 88905be4861dba535c38573cb18a3080f7d9f235 (commit)
- Log -----------------------------------------------------------------
commit 90827a113dbbbebdb8dee1aafe004ed76b65369c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Feb 28 15:32:11 2013 -0500
Test showing cf value is lost on refresh to add attachment
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index 92fcf53..36e6b7a 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 45;
+use RT::Test tests => undef;
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
@@ -151,3 +151,32 @@ diag "check that we can set empty value when the current is 0";
undef, 'API returns correct value';
}
+diag 'retain selected cf values when adding attachments';
+{
+ my ( $ticket, $id );
+ $m->submit_form(
+ form_name => "CreateTicketInQueue",
+ fields => { Queue => 'General' },
+ );
+ $m->content_contains($cf_name, 'Found cf field' );
+
+ $m->submit_form_ok(
+ { form_name => "TicketCreate",
+ fields => {
+ Subject => 'test defaults',
+ Content => 'test',
+ "Object-RT::Ticket--CustomField-$cfid-Values" => 'qwe',
+ },
+ button => 'AddMoreAttach',
+ },
+ 'Add an attachment on create'
+ );
+
+ $m->form_name("TicketCreate");
+ is($m->value("Object-RT::Ticket--CustomField-$cfid-Values"),
+ "qwe",
+ "Selected value still on form" );
+}
+
+undef $m;
+done_testing;
commit 9fa03d289c716482f377941bf0e19de4cd693b68
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Mar 1 08:58:30 2013 -0500
Allow default CF arguments to re-populate create ticket form
As shown in the tests added in 90827a1, setting DefaultsFromTopArguments
to false blocks the reseting of supplied values when the page is
re-rendered after adding an attachment. This value was likely set in
error initially. Removing it allows the default DefaultsFromTopArguments => 1
setting which provides the correct behavior.
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 1c78de4..e4711c4 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -114,7 +114,6 @@
%ARGS,
Object => $ticket,
CustomFieldGenerator => sub { $QueueObj->TicketCustomFields },
- DefaultsFromTopArguments => 0,
&>
</div>
commit 88905be4861dba535c38573cb18a3080f7d9f235
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Mar 28 15:50:47 2013 -0400
On Modify, MaybeRedirectForResults rather than DefaultsFromTopArguments
Remove DefaultsFromTopArguments => 0 and always take defaults from
%ARGS. To handle the case of values like CFs changing based on a scrip
firing, call MaybeRedirectForResults if the ticket is updated. This will
ensure that %ARGS is cleared if things changed in the backend.
diff --git a/share/html/Ticket/Modify.html b/share/html/Ticket/Modify.html
index cb3de87..e9ef761 100644
--- a/share/html/Ticket/Modify.html
+++ b/share/html/Ticket/Modify.html
@@ -57,11 +57,11 @@
<&| /Widgets/TitleBox, title => loc('Modify ticket #[_1]',$TicketObj->Id), class=>'ticket-info-basics' &>
<& Elements/EditBasics, TicketObj => $TicketObj, defaults => \%ARGS &>
-<& /Elements/EditCustomFields, Object => $TicketObj, DefaultsFromTopArguments => 0, Grouping => 'Basics' &>
+<& /Elements/EditCustomFields, Object => $TicketObj, Grouping => 'Basics' &>
</&>
% $m->callback( CallbackName => 'AfterBasics', Ticket => $TicketObj );
-<& /Elements/EditCustomFieldCustomGroupings, Object => $TicketObj, DefaultsFromTopArguments => 0 &>
+<& /Elements/EditCustomFieldCustomGroupings, Object => $TicketObj &>
<& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#993333" &>
</form>
@@ -96,6 +96,12 @@ unless ($skip_update) {
ARGSRef => \%ARGS, Results => \@results );
$TicketObj->ApplyTransactionBatch;
+
+ MaybeRedirectForResults(
+ Actions => \@results,
+ Path => "/Ticket/Modify.html",
+ Arguments => { id => $TicketObj->id },
+ );
}
unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list