From e6145df5caafbf72e50d6f27b0efb73ab27a06ac Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Thu, 26 Oct 2006 23:45:18 +0000 Subject: [PATCH] Added the ability to choose any component from any product for your test case. git-svn-id: svn://10.0.0.236/trunk@214208 18797224-902f-48f8-a5cc-f745e15eee43 --- .../testopia/Bugzilla/Testopia/TestCase.pm | 28 ++++++- .../en/default/testopia/case/show.html.tmpl | 82 ++++++++++++------- mozilla/webtools/testopia/tr_show_case.cgi | 52 ++++++------ 3 files changed, 106 insertions(+), 56 deletions(-) diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm index 229cbd4e50d..e8c5b65d7a9 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm @@ -236,6 +236,31 @@ sub get_selectable_components { return \@comps; } +=head2 get_product_components + +Returns a list of components divided by product + +=cut + +sub get_product_components { + my $self = shift; + my $dbh = Bugzilla->dbh; + my @exclusions; + my $products = $dbh->selectall_arrayref( + "SELECT id,name FROM products ORDER BY name",{'Slice' => {}}); + my %prods; + foreach my $p (@$products){ + my $comps = $dbh->selectall_arrayref( + "SELECT id,name FROM components + WHERE product_id = ? + ORDER BY name", + {'Slice' => {}},$p->{'id'}); + + $prods{$p->{'name'}} = $comps; + } + return \%prods; +} + =head2 get_available_components Returns a list of all user visible components for use in searches @@ -514,7 +539,8 @@ sub add_component { my $dbh = Bugzilla->dbh; #TODO: Check for existing component $dbh->do("INSERT INTO test_case_components (case_id, component_id) - VALUES (?,?)",undef, $self->{'case_id'}, $comp_id); + VALUES (?,?)",undef, $self->{'case_id'}, $comp_id); + delete $self->{'components'}; } =head2 remove_component diff --git a/mozilla/webtools/testopia/template/en/default/testopia/case/show.html.tmpl b/mozilla/webtools/testopia/template/en/default/testopia/case/show.html.tmpl index b036ccdd4fc..2db28f6d634 100644 --- a/mozilla/webtools/testopia/template/en/default/testopia/case/show.html.tmpl +++ b/mozilla/webtools/testopia/template/en/default/testopia/case/show.html.tmpl @@ -50,32 +50,6 @@