From e9e4b2ac3345781fa9831c2bc84d28056ff98496 Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Thu, 11 Jan 2007 20:16:34 +0000 Subject: [PATCH] Cloning plans with cases linked to other products does not include categories from those products. --- webtools/testopia/Bugzilla/Testopia/TestPlan.pm | 16 +++++++++++++++- .../en/default/testopia/plan/clone.html.tmpl | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/webtools/testopia/Bugzilla/Testopia/TestPlan.pm b/webtools/testopia/Bugzilla/Testopia/TestPlan.pm index a5db08edb435..ffbaa56a654b 100644 --- a/webtools/testopia/Bugzilla/Testopia/TestPlan.pm +++ b/webtools/testopia/Bugzilla/Testopia/TestPlan.pm @@ -480,7 +480,21 @@ sub get_product_environments { return $ref; } - +sub get_used_categories { + my $self = shift; + my $dbh = Bugzilla->dbh; + my $ref = $dbh->selectall_arrayref( + "SELECT DISTINCT test_case_categories.category_id AS id, name + FROM test_case_categories + JOIN test_cases ON test_cases.category_id = test_case_categories.category_id + JOIN test_case_plans ON test_cases.case_id = test_case_plans.case_id + WHERE plan_id = ? + ORDER BY name", + {'Slice'=>{}}, $self->id); + + return $ref; + +} =head2 get_case_ids_by_category Returns a list of case_ids in this plan from the selected categories. diff --git a/webtools/testopia/template/en/default/testopia/plan/clone.html.tmpl b/webtools/testopia/template/en/default/testopia/plan/clone.html.tmpl index 091cbf777369..94f9745dabdf 100644 --- a/webtools/testopia/template/en/default/testopia/plan/clone.html.tmpl +++ b/webtools/testopia/template/en/default/testopia/plan/clone.html.tmpl @@ -109,7 +109,7 @@ categories only: [% PROCESS select sel = { name => 'clone_categories', - list => plan.product.categories + list => plan.get_used_categories accesskey => 'c' mult => 1 elements => 5