summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%kerio.com <>2006-03-03 08:50:13 +0100
committermkanat%kerio.com <>2006-03-03 08:50:13 +0100
commit6c16eddbad9bcef7d7b2d51dc274451a152524fe (patch)
tree7a153e2f238420fc777d5f7d13cad910f5f54742 /Bugzilla
parent975b2688b862a89f302a77b9a42c8f794fed13a8 (diff)
downloadbugzilla-6c16eddbad9bcef7d7b2d51dc274451a152524fe.tar.gz
bugzilla-6c16eddbad9bcef7d7b2d51dc274451a152524fe.tar.xz
Bug 328602: Eliminate %::versions and @::legal_versions
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm6
-rw-r--r--Bugzilla/Version.pm18
2 files changed, 22 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index e2222ccb7..f297ec681 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -32,7 +32,7 @@ use strict;
use vars qw($legal_keywords @legal_platform
@legal_priority @legal_severity @legal_opsys @legal_bug_status
- @settable_resolution %components %versions %target_milestone
+ @settable_resolution %components %target_milestone
@enterable_products %milestoneurl %prodmaxvotes);
use CGI::Carp qw(fatalsToBrowser);
@@ -46,6 +46,7 @@ use Bugzilla::FlagType;
use Bugzilla::User;
use Bugzilla::Util;
use Bugzilla::Error;
+use Bugzilla::Product;
use base qw(Exporter);
@Bugzilla::Bug::EXPORT = qw(
@@ -641,6 +642,7 @@ sub choices {
&::GetVersionTable();
$self->{'choices'} = {};
+ $self->{prod_obj} ||= new Bugzilla::Product({name => $self->{product}});
# Fiddle the product list.
my $seen_curr_prod;
@@ -686,7 +688,7 @@ sub choices {
'bug_status' => \@::legal_bug_status,
'resolution' => \@res,
'component' => $::components{$self->{product}},
- 'version' => $::versions{$self->{product}},
+ 'version' => [map($_->name, @{$self->{prod_obj}->versions})],
'target_milestone' => $::target_milestone{$self->{product}},
};
diff --git a/Bugzilla/Version.pm b/Bugzilla/Version.pm
index 9492e8135..53bf9a678 100644
--- a/Bugzilla/Version.pm
+++ b/Bugzilla/Version.pm
@@ -109,6 +109,13 @@ sub check_version {
return $version;
}
+sub distinct_names {
+ my $dbh = Bugzilla->dbh;
+ my $names = $dbh->selectcol_arrayref(
+ 'SELECT DISTINCT value FROM versions ORDER BY value');
+ return @$names;
+}
+
1;
__END__
@@ -172,6 +179,17 @@ Version.pm represents a Product Version object.
Returns: Bugzilla::Version object.
+=item C<distinct_names()>
+
+ Description: A utility function for getting all the
+ possible version values from the database,
+ regardless of what product they're in.
+ Returns a list with no duplicate versions.
+
+ Params: none
+
+ Returns: A list of strings (versions).
+
=back
=cut