[Rt-commit] rt branch, 4.4/setinitialcf-multi, created. rt-4.4.1-216-g7937948
Shawn Moore
shawn at bestpractical.com
Thu Dec 29 12:49:30 EST 2016
The branch, 4.4/setinitialcf-multi has been created
at 79379485599ab6a58497c12039d34774ca25f507 (commit)
- Log -----------------------------------------------------------------
commit e74c13f57c7377d166136b7bdd1d429eeb56a0e3
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu Dec 29 17:45:51 2016 +0000
Add failing test for SetInitialCF on multivalue CFs
diff --git a/t/web/cf_set_initial.t b/t/web/cf_set_initial.t
index 2bf81d9..f267bed 100644
--- a/t/web/cf_set_initial.t
+++ b/t/web/cf_set_initial.t
@@ -13,6 +13,13 @@ my ($cfid, $msg) = $cf->Create(
Type => 'FreeformSingle',
);
+my $multi_cf = RT::CustomField->new( RT->SystemUser );
+my ($multi_cfid) = $multi_cf->Create(
+ Name => 'Multi Set Initial CF',
+ Queue => '0',
+ Type => 'FreeformMultiple',
+);
+
my $tester = RT::Test->load_or_create_user( Name => 'tester', Password => '123456' );
RT::Test->set_rights(
{ Principal => $tester->PrincipalObj,
@@ -21,7 +28,7 @@ RT::Test->set_rights(
);
ok $m->login( $tester->Name, 123456, logout => 1), 'logged in';
-diag "check that we have no CF on the create"
+diag "check that we have no CFs on the create"
." ticket page when user has no SetInitialCustomField right";
{
$m->submit_form(
@@ -29,10 +36,13 @@ diag "check that we have no CF on the create"
fields => { Queue => 'General' },
);
$m->content_lacks('Test Set Initial CF', 'has no CF input');
+ $m->content_lacks('Multi Set Initial CF', 'has no CF input');
my $form = $m->form_name("TicketCreate");
my $edit_field = "Object-RT::Ticket--CustomField-$cfid-Value";
ok !$form->find_input( $edit_field ), 'no form field on the page';
+ my $multi_field = "Object-RT::Ticket--CustomField-$multi_cfid-Values";
+ ok !$form->find_input( $multi_field ), 'no form field on the page';
$m->submit_form(
form_name => "TicketCreate",
@@ -41,8 +51,10 @@ diag "check that we have no CF on the create"
$m->content_like(qr/Ticket \d+ created/, "a ticket is created succesfully");
$m->content_lacks('Test Set Initial CF', 'has no CF on the page');
+ $m->content_lacks('Multi Set Initial CF', 'has no CF on the page');
$m->follow_link( text => 'Custom Fields');
$m->content_lacks('Test Set Initial CF', 'has no CF field');
+ $m->content_lacks('Multi Set Initial CF', 'has no CF field');
}
RT::Test->set_rights(
@@ -59,15 +71,19 @@ diag "check that we have the CF on the create"
fields => { Queue => 'General' },
);
$m->content_contains('Test Set Initial CF', 'has CF input');
+ $m->content_contains('Multi Set Initial CF', 'has CF input');
my $form = $m->form_name("TicketCreate");
my $edit_field = "Object-RT::Ticket--CustomField-$cfid-Value";
ok $form->find_input( $edit_field ), 'has form field on the page';
+ my $multi_field = "Object-RT::Ticket--CustomField-$multi_cfid-Values";
+ ok $form->find_input( $multi_field ), 'has form field on the page';
$m->submit_form(
form_name => "TicketCreate",
fields => {
$edit_field => 'yatta',
+ $multi_field => 'hiro',
Subject => 'test 2',
},
);
@@ -78,11 +94,14 @@ diag "check that we have the CF on the create"
ok($ok, "loaded ticket $id");
is($ticket->Subject, 'test 2', 'subject is correct');
is($ticket->FirstCustomFieldValue('Test Set Initial CF'), 'yatta', 'CF was set correctly');
+ is($ticket->FirstCustomFieldValue('Multi Set Initial CF'), 'hiro', 'CF was set correctly');
}
$m->content_lacks('Test Set Initial CF', 'has no CF on the page');
+ $m->content_lacks('Multi Set Initial CF', 'has no CF on the page');
$m->follow_link( text => 'Custom Fields');
$m->content_lacks('Test Set Initial CF', 'has no CF edit field');
+ $m->content_lacks('Multi Set Initial CF', 'has no CF edit field');
}
undef $m;
commit 79379485599ab6a58497c12039d34774ca25f507
Author: Gérald SÉDRATI-DINET <gibus at easter-eggs.com>
Date: Thu Dec 29 17:48:41 2016 +0000
Fix SetInitialCustomField support for multi-valued CFs
Fixes: I#32491
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 6d24385..23fbc97 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2091,6 +2091,7 @@ sub _AddCustomFieldValue {
Content => $args{'Value'},
LargeContent => $args{'LargeContent'},
ContentType => $args{'ContentType'},
+ ForCreation => $args{'ForCreation'},
);
unless ( $new_value_id ) {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list