Allow user to add a new case to a list of runs or an existing case from within show_case

git-svn-id: svn://10.0.0.236/trunk@216316 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com 2006-12-02 00:32:10 +00:00
parent b49bae56c0
commit 498e1254af
3 changed files with 20 additions and 1 deletions

View File

@ -97,7 +97,9 @@
<td align="right"><b>Arguments:</b></td>
<td><input name="arguments" id="arguments" value="[% case.arguments FILTER none %]"></td>
</tr>
<tr>
<th align="right">Add to Runs</th><td colspan="3"><input name="addruns" size="30"></td>
</tr>
</table>
</td>
[% IF action == "Add" %]

View File

@ -125,6 +125,11 @@ if ($action eq 'Add'){
validate_selection($id, 'id', 'components');
push @components, $id;
}
my @runs;
foreach my $runid (split(/[\s,]+/, $cgi->param('addruns'))){
validate_test_id($runid, 'run');
push @runs, Bugzilla::Testopia::TestRun->new($runid);
}
my $case = Bugzilla::Testopia::TestCase->new({
'alias' => $alias || undef,
@ -179,6 +184,9 @@ if ($action eq 'Add'){
$case->add_tag($tag_id);
}
}
foreach my $run (@runs){
$run->add_case_run($case->id);
}
$vars->{'action'} = "Commit";
$vars->{'form_action'} = "tr_show_case.cgi";

View File

@ -349,6 +349,11 @@ sub do_update{
ValidateBugID($bug);
push @buglist, $bug;
}
my @runs;
foreach my $runid (split(/[\s,]+/, $cgi->param('addruns'))){
validate_test_id($runid, 'run');
push @runs, Bugzilla::Testopia::TestRun->new($runid);
}
ThrowUserError('testiopia-alias-exists',
{'alias' => $alias}) if $case->check_alias($alias);
@ -385,6 +390,10 @@ sub do_update{
foreach my $bug (@buglist){
$case->attach_bug($bug);
}
# Add to runs
foreach my $run (@runs){
$run->add_case_run($case->id);
}
$cgi->delete_all;
$cgi->param('case_id', $case->id);
}