Added ability to delete cases, runs and plans.

This commit is contained in:
ghendricks%novell.com 2006-10-13 23:10:03 +00:00
Родитель f7d4a5a20e
Коммит 065ff6bdd6
17 изменённых файлов: 495 добавлений и 45 удалений

Просмотреть файл

@ -311,10 +311,13 @@ safe way to do this.
sub obliterate {
my $self = shift;
my $dbh = Bugzilla->dbh;
return 0 unless $self->candelete;
$dbh->do("DELETE FROM test_attachment_data
WHERE attachment_id = ?", undef, $self->{'attachment_id'});
$dbh->do("DELETE FROM test_attachments
WHERE attachment_id = ?", undef, $self->{'attachment_id'});
return 1;
}
=head2 canview

Просмотреть файл

@ -570,6 +570,30 @@ Completely removes this environment from the database.
=cut
sub obliterate {
my $self = shift;
return 0 unless $self->candelete;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_environment_map WHERE environment_id = ?", undef, $self->id);
foreach my $obj (@{$self->runs}){
$obj->obliterate;
}
foreach my $obj (@{$self->caseruns}){
$obj->obliterate;
}
$dbh->do("DELETE FROM test_environments WHERE environment_id = ?", undef, $self->id);
return 1;
}
=head2 archive
Archives this environment.
=cut
sub archive {
my $self = shift;
my $dbh = Bugzilla->dbh;
@ -693,8 +717,53 @@ sub product {
}
=head1 TODO
=head2 runs
Returns a reference to a list of test runs useing this environment
=cut
sub runs {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
return $self->{'runs'} if exists $self->{'runs'};
my $runids = $dbh->selectcol_arrayref("SELECT run_id FROM test_runs
WHERE environment_id = ?",
undef, $self->id);
my @runs;
foreach my $id (@{$runids}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
}
$self->{'runs'} = \@runs;
return $self->{'runs'};
}
=head2 runs
Returns a reference to a list of test runs useing this environment
=cut
sub runs {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
return $self->{'caseruns'} if exists $self->{'caseruns'};
my $ids = $dbh->selectcol_arrayref("SELECT case_run_id FROM test_case_runs
WHERE environment_id = ?",
undef, $self->id);
my @caseruns;
foreach my $id (@{$ids}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@caseruns;
return $self->{'caseruns'};
}
=head1 TODO
=head1 SEE ALSO

Просмотреть файл

@ -406,9 +406,27 @@ sub init {
"ON case_plans.plan_id = test_plans.plan_id");
$f = "test_plans.plan_id";
},
"^plan_case_id," => sub {
push(@supptables,
"INNER JOIN test_case_plans AS case_plans " .
"ON test_plans.plan_id = case_plans.plan_id");
push(@supptables,
"INNER JOIN test_cases " .
"ON case_plans.case_id = test_cases.case_id");
$f = "test_cases.case_id";
},
"^run_plan_id," => sub {
$f = "test_runs.plan_id";
},
"^run_case_id," => sub {
push(@supptables,
"INNER JOIN test_case_runs AS case_runs " .
"ON test_runs.run_id = case_runs.run_id");
push(@supptables,
"INNER JOIN test_cases " .
"ON case_runs.case_id = test_cases.case_id");
$f = "test_cases.case_id";
},
"^case_prod," => sub {
push(@supptables,
"INNER JOIN test_case_plans AS case_plans " .
@ -537,7 +555,15 @@ sub init {
$type = $cgi->param('caseidtype')
}
}
push(@specialchart, ["case_id", $type, join(',', $cgi->param('case_id'))]);
if ($obj eq 'run'){
push(@specialchart, ["run_case_id", $type, join(',', $cgi->param('case_id'))]);
}
elsif ($obj eq 'plan'){
push(@specialchart, ["plan_case_id", $type, join(',', $cgi->param('case_id'))]);
}
else{
push(@specialchart, ["case_id", $type, join(',', $cgi->param('case_id'))]);
}
}
if ($cgi->param('run_id')) {
my $type = "anyexact";

Просмотреть файл

@ -1197,6 +1197,37 @@ sub can_unlink_plan {
return !$res;
}
=head2 obliterate
Removes this case and all things that reference it.
=cut
sub obliterate {
my $self = shift;
return 0 unless $self->candelete;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_case_texts WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_plans WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_components WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_tags WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_bugs WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_activity WHERE case_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_dependencies
WHERE dependson = ? OR blocked = ?", undef, ($self->id, $self->id));
foreach my $obj (@{$self->attachments}){
$obj->obliterate;
}
foreach my $obj (@{$self->caseruns}){
$obj->obliterate;
}
$dbh->do("DELETE FROM test_cases WHERE case_id = ?", undef, $self->id);
return 1;
}
=head2 canedit
Returns true if the logged in user has rights to edit this test case.
@ -1235,7 +1266,8 @@ Returns true if the logged in user has rights to delete this test case.
sub candelete {
my $self = shift;
return $self->canedit && Param("allow-test-deletion");
return $self->canedit && Param("allow-test-deletion")
&& (Bugzilla->user->id == $self->author->id || Bugzilla->user->in_group('admin'));
}
###############################
@ -1502,12 +1534,36 @@ sub bugs {
undef, $self->{'case_id'});
my @bugs;
foreach my $id (@{$ref}){
push @bugs, Bugzilla::Bug->new($id, Bugzilla->user->id);
push @bugs, Bugzilla::Bug->new($id, Bugzilla->user->id) if Bugzilla->user->can_see_bug($id);
}
$self->{'bugs'} = \@bugs;
return $self->{'bugs'};
}
=head2 bug_list
Returns a comma separated list of bug ids associated with this case
=cut
sub bug_list {
my $self = shift;
return $self->{'bug_list'} if exists $self->{'bug_list'};
my $dbh = Bugzilla->dbh;
my @bugs;
my $bugids = $dbh->selectcol_arrayref("SELECT bug_id
FROM test_case_bugs
WHERE case_id=?",
undef, $self->id);
my @visible;
foreach my $bugid (@{$bugids}){
push @visible, $bugid if Bugzilla->user->can_see_bug($bugid);
}
$self->{'bug_list'} = join(",", @$bugids);
return $self->{'bug_list'};
}
=head2 text
Returns a hash reference representing the action and effect of this
@ -1541,12 +1597,12 @@ sub runs {
my $self = shift;
my $dbh = Bugzilla->dbh;
return $self->{'runs'} if exists $self->{'runs'};
my $ref = $dbh->selectcol_arrayref("SELECT t.run_id
FROM test_runs t
INNER JOIN test_case_runs r
ON r.run_id = t.run_id
WHERE case_id = ?",
undef, $self->{'case_id'});
my $ref = $dbh->selectcol_arrayref(
"SELECT DISTINCT t.run_id
FROM test_runs t
INNER JOIN test_case_runs r ON r.run_id = t.run_id
WHERE case_id = ?",
undef, $self->{'case_id'});
my @runs;
foreach my $id (@{$ref}){
push @runs, Bugzilla::Testopia::TestRun->new($id);

Просмотреть файл

@ -781,9 +781,8 @@ sub bugs {
FROM test_case_bugs
WHERE case_run_id=?",
undef, $self->{'case_run_id'});
#TODO: Check that user can see bug
foreach my $bugid (@{$bugids}){
push @bugs, Bugzilla::Bug->new($bugid, Bugzilla->user->id);
push @bugs, Bugzilla::Bug->new($bugid, Bugzilla->user->id) if Bugzilla->user->can_see_bug($bugid);
}
$self->{'bugs'} = \@bugs; #join(",", @$bugids);
@ -798,16 +797,16 @@ Returns a comma separated list of bug ids associated with this case-run
sub bug_list {
my $self = shift;
#return $self->{'bug'} if exists $self->{'bug'};
return $self->{'bug_list'} if exists $self->{'bug_list'};
my $dbh = Bugzilla->dbh;
my @bugs;
my $bugids = $dbh->selectcol_arrayref("SELECT bug_id
FROM test_case_bugs
WHERE case_run_id=?",
undef, $self->{'case_run_id'});
#TODO: Check that user can see bug
undef, $self->id);
my @visible;
foreach my $bugid (@{$bugids}){
push @bugs, Bugzilla::Bug->new($bugid, Bugzilla->user->id);
push @visible, $bugid if Bugzilla->user->can_see_bug($bugid);
}
$self->{'bug_list'} = join(",", @$bugids);
@ -956,10 +955,20 @@ sub candelete {
&& $self->status eq 'IDLE');
}
sub do_delete {
=head2 obliterate
Removes this caserun and all things that reference it.
=cut
sub obliterate {
my $self = shift;
my $dbh = Bugzilla->dbh;
return 0 unless $self->candelete;
$dbh->do("DELETE FROM test_case_bugs WHERE case_run_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_runs WHERE case_run_id = ?", undef, $self->id);
return 1;
}
=head1 SEE ALSO

Просмотреть файл

@ -763,6 +763,39 @@ sub lookup_product_by_name {
return $value;
}
=head2 obliterate
Removes this plan and all things that reference it.
=cut
sub obliterate {
my $self = shift;
return 0 unless $self->candelete;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_plan_texts WHERE plan_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_plan_tags WHERE plan_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_plan_group_map WHERE plan_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_plan_activity WHERE plan_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_case_plans WHERE plan_id = ?", undef, $self->id);
foreach my $obj (@{$self->attachments}){
$obj->obliterate;
}
foreach my $obj (@{$self->test_runs}){
$obj->obliterate;
}
foreach my $obj (@{$self->test_cases}){
$obj->obliterate if (scalar @{$obj->plans} == 1);
}
$dbh->do("DELETE FROM test_plans WHERE plan_id = ?", undef, $self->id);
return 1;
}
=head2 canedit
Returns true if the logged in user has rights to edit this plan
@ -774,7 +807,7 @@ sub canedit {
return $self->canview && UserInGroup("managetestplans");
}
=head2 view
=head2 canview
Returns true if the logged in user has rights to view this plan
@ -786,7 +819,7 @@ sub canview {
return Bugzilla::Testopia::Util::can_view_product($self->product_id);
}
=head2 delete
=head2 candelete
Returns true if the logged in user has rights to delete this plan
@ -794,7 +827,8 @@ Returns true if the logged in user has rights to delete this plan
sub candelete {
my $self = shift;
return $self->canedit && Param("allow-test-deletion");
return $self->canedit && Param("allow-test-deletion")
&& (Bugzilla->user->id == $self->author->id || Bugzilla->user->in_group('admin'));
}

Просмотреть файл

@ -403,6 +403,28 @@ sub history {
return $ref;
}
=head2 obliterate
Removes this run and all things that reference it.
=cut
sub obliterate {
my $self = shift;
return 0 unless $self->candelete;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_run_cc WHERE run_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_run_tags WHERE run_id = ?", undef, $self->id);
$dbh->do("DELETE FROM test_run_activity WHERE run_id = ?", undef, $self->id);
foreach my $obj (@{$self->caseruns}){
$obj->obliterate;
}
$dbh->do("DELETE FROM test_runs WHERE run_id = ?", undef, $self->id);
return 1;
}
=head2 Check_case
@ -708,7 +730,8 @@ Returns true if the logged in user has rights to delete this test run.
sub candelete {
my $self = shift;
return $self->canedit && Param('allow-test-deletion');
return $self->canedit && Param('allow-test-deletion')
&& (Bugzilla->user->id == $self->manager->id || Bugzilla->user->in_group('admin'));
}
###############################
@ -1134,6 +1157,29 @@ sub current_caseruns {
return $self->{'current_caseruns'};
}
=head2 caseruns
Returns a reference to a list of TestCaseRun objects that belong
to this run
=cut
sub caseruns {
my $self = shift;
my $dbh = Bugzilla->dbh;
return $self->{'caseruns'} if exists $self->{'caseruns'};
my $ref = $dbh->selectcol_arrayref(
"SELECT case_run_id FROM test_case_runs
WHERE run_id=?", undef, $self->{'run_id'});
my @caseruns;
foreach my $id (@{$ref}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@caseruns;
return $self->{'caseruns'};
}
=head2 case_id_list
Returns a list of case_id's from the current case runs.

Просмотреть файл

@ -0,0 +1,65 @@
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[%# INTERFACE:
# ...
#%]
[%############################################################################%]
[%# Template Initialization #%]
[%############################################################################%]
[% PROCESS global/variables.none.tmpl %]
[%############################################################################%]
[%# Page Header #%]
[%############################################################################%]
[% PROCESS global/header.html.tmpl
title = "Delete Test Case: $case.summary"
%]
[% IF NOT deleted %]
You are about to permanently delete this test case with all its history.
<br>
This test case is used in <a href="tr_list_runs.cgi?case_id=[% case.id FILTER none %]">[% runcount FILTER none %] run(s)</a>
in <a href="tr_list_plans.cgi?case_id=[% case.id FILTER none %]">[% plancount FILTER none %] plan(s)</a><br/>
[% IF bugcount %]
This case has <a href="buglist.cgi?bug_id=[% case.bug_list FILTER none %]">[% bugcount FILTER none %]&nbsp;[% terms.bugs %]</a> linked to it.<br/>
[% END %]
<span style="font-size:12pt; font-weight:bold; color:#cc0000;">Warning: This action cannot be undone</span>
<br>
<br>
<form action="tr_show_case.cgi">
<input type="hidden" name="case_id" value="[% case.id FILTER none %]" />
<input type="hidden" name="action" value="do_delete" />
<input type="submit" value="Delete This Test Case" />
</form>
<a href="tr_show_case.cgi?case_id=[% case.id FILTER none %]">Go back</a>
[% ELSE %]
Test case deleted.
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -169,6 +169,9 @@
<input type="submit" name="action" value="Commit">
<input type="submit" name="action" value="History">
<input type="submit" name="action" value="Clone">
[% IF case.candelete %]
<input type="submit" name="action" value="Delete">
[% END %]
</div></td>
</tr>
</tbody>

Просмотреть файл

@ -18,28 +18,46 @@
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS global/header.html.tmpl
title = title
%]
[%# INTERFACE:
# ...
#%]
<p>
<FORM METHOD="POST" ACTION="tr_testplan_form.cgi" name="form">
[%############################################################################%]
[%# Template Initialization #%]
[%############################################################################%]
<p>You are about to delete test plan <b>'[% plan_name FILTER html %]'</b>
for product <b>'[% product_name FILTER html %]'</b></p>
<p>If you click on 'delete' the test plan together with all its test cases and test runs
will be deleted and will not be able to be recovered.</p>
<p>This test plan has currently [% runs FILTER html %] run(s) and
[% cases FILTER html %] case(s) defined</p>
[% PROCESS global/variables.none.tmpl %]
[%############################################################################%]
[%# Page Header #%]
[%############################################################################%]
[% PROCESS global/header.html.tmpl
title = "Delete Test plan: $plan.name"
%]
[% IF NOT deleted %]
You are about to permanently delete this test plan with all its history.
<br>
This test plan is used by <a href="tr_list_runs.cgi?plan_id=[% plan.id FILTER none %]">[% plan.test_run_count FILTER none %] run(s)</a> which will also be deleted.<br/>
There are <a href="tr_list_cases.cgi?plan_id=[% plan.id FILTER none %]">[% plan.test_case_count FILTER none %] cases(s)</a> in this plan.
<b>Any test case that is not linked to another test plan will also be deleted!</b><br/>
<span style="font-size:12pt; font-weight:bold; color:#cc0000;">Warning: This action cannot be undone</span>
<br>
<br>
<form action="tr_show_plan.cgi">
<input type="hidden" name="plan_id" value="[% plan.id FILTER none %]" />
<input type="hidden" name="action" value="do_delete" />
<input type="submit" value="Delete This Test Plan" />
</form>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Go back</a>
[% ELSE %]
Test plan deleted.
[% END %]
<INPUT TYPE="HIDDEN" NAME="form_action" VALUE="">
<INPUT TYPE="HIDDEN" NAME="plan_id" VALUE="[% plan_id FILTER html %]">
<INPUT TYPE="BUTTON" VALUE="Delete" onClick="form.form_action.value='do_delete';form.action='tr_edittestplans.cgi';submit();">
&nbsp;&nbsp;
<INPUT TYPE="SUBMIT" VALUE="Cancel">
</FORM>
</p>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -160,6 +160,9 @@
<input type="submit" name="action" value="History">
<input type="submit" name="action" value="Clone">
<input type="submit" name="action" value="Print">
[% IF plan.candelete %]
<input type="submit" name="action" value="Delete">
[% END %]
</div></td>
</tr>
</tbody>

Просмотреть файл

@ -0,0 +1,60 @@
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[%# INTERFACE:
# ...
#%]
[%############################################################################%]
[%# Template Initialization #%]
[%############################################################################%]
[% PROCESS global/variables.none.tmpl %]
[%############################################################################%]
[%# Page Header #%]
[%############################################################################%]
[% PROCESS global/header.html.tmpl
title = "Delete Test Run: $run.summary"
%]
[% IF NOT deleted %]
You are about to permananty delete this test run with all its history.
<br>
<span style="font-size:12pt; font-weight:bold; color:#cc0000;">Warning: This action cannot be undone</span>
<br>
<br>
<form action="tr_show_run.cgi">
<input type="hidden" name="run_id" value="[% run.id FILTER none %]" />
<input type="hidden" name="action" value="do_delete" />
<input type="submit" value="Delete This Test Run" />
</form>
<a href="tr_show_run.cgi?run_id=[%run.id FILTER none %]">Go back</a>
[% ELSE %]
Test run deleted.
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -270,12 +270,12 @@
<tr>
<!--
<td><a href="tr_testrun_regression.cgi?run_id=[% run.id FILTER none %]">Create regression test cases</a></td> -->
<td><input type="submit" name="action" value="History"></td>
<td><input type="submit" name="action" value="Clone"></td>
[% IF run.candelete %]
<td><input type="submit" name="action" value="Delete"></td>
[% END %]
<td><input type="submit" name="action" value="Clone"></td>
</tr>
</table>
</div>

Просмотреть файл

@ -219,7 +219,27 @@ elsif ($action eq 'detach_bug'){
}
display(Bugzilla::Testopia::TestCase->new($case_id));
}
elsif ($action eq 'Delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->candelete;
$vars->{'case'} = $case;
$vars->{'runcount'} = scalar @{$case->runs};
$vars->{'plancount'} = scalar @{$case->plans};
$vars->{'bugcount'} = scalar @{$case->bugs};
$template->process("testopia/case/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->candelete;
$case->obliterate;
$vars->{'deleted'} = 1;
$template->process("testopia/case/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
####################
### Ajax Actions ###
####################

Просмотреть файл

@ -142,7 +142,7 @@ elsif ($action eq 'delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
$caserun->do_delete;
$caserun->obliterate;
$cgi->delete_all;
$cgi->param('current_tab', 'case_run');
$cgi->param('run_id', $caserun->run->id);

Просмотреть файл

@ -208,6 +208,24 @@ elsif ($action eq 'Attach'){
#TODO: Import plans
elsif ($action eq 'import'){
}
elsif ($action eq 'Delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->candelete;
$vars->{'plan'} = $plan;
$template->process("testopia/plan/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->candelete;
$plan->obliterate;
$vars->{'deleted'} = 1;
$template->process("testopia/plan/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
####################
### Ajax Actions ###

Просмотреть файл

@ -185,6 +185,26 @@ elsif ($action eq 'removecc'){
my $cc = get_cc_xml($run);
print $cc;
}
elsif ($action eq 'Delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->candelete;
$vars->{'run'} = $run;
$template->process("testopia/run/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->candelete;
$run->obliterate;
$vars->{'deleted'} = 1;
$template->process("testopia/run/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
####################
### Just show it ###
####################