Commit 9444e963 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 346588: Versions should be sorted using vers_cmp() - Patch by Olav Vitters…

Bug 346588: Versions should be sorted using vers_cmp() - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=mkanat a=myk
parent d58a16bb
...@@ -25,6 +25,8 @@ use Bugzilla::Util; ...@@ -25,6 +25,8 @@ use Bugzilla::Util;
use Bugzilla::Group; use Bugzilla::Group;
use Bugzilla::Error; use Bugzilla::Error;
use Bugzilla::Install::Requirements;
use base qw(Bugzilla::Object); use base qw(Bugzilla::Object);
use constant DEFAULT_CLASSIFICATION_ID => 1; use constant DEFAULT_CLASSIFICATION_ID => 1;
...@@ -107,11 +109,10 @@ sub versions { ...@@ -107,11 +109,10 @@ sub versions {
if (!defined $self->{versions}) { if (!defined $self->{versions}) {
my $values = $dbh->selectcol_arrayref(q{ my $values = $dbh->selectcol_arrayref(q{
SELECT value FROM versions SELECT value FROM versions
WHERE product_id = ? WHERE product_id = ?}, undef, $self->id);
ORDER BY value}, undef, $self->id);
my @versions; my @versions;
foreach my $value (@$values) { foreach my $value (sort { vers_cmp (lc($a), lc($b)) } @$values) {
push @versions, new Bugzilla::Version($self->id, $value); push @versions, new Bugzilla::Version($self->id, $value);
} }
$self->{versions} = \@versions; $self->{versions} = \@versions;
......
...@@ -38,6 +38,7 @@ use Bugzilla::Error; ...@@ -38,6 +38,7 @@ use Bugzilla::Error;
use Bugzilla::Product; use Bugzilla::Product;
use Bugzilla::Keyword; use Bugzilla::Keyword;
use Bugzilla::Field; use Bugzilla::Field;
use Bugzilla::Install::Requirements;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -211,7 +212,7 @@ foreach my $product (@selectable_products) { ...@@ -211,7 +212,7 @@ foreach my $product (@selectable_products) {
} }
my @components = sort(keys %components); my @components = sort(keys %components);
my @versions = sort(keys %versions); my @versions = sort { vers_cmp (lc($a), lc($b)) } keys %versions;
my @milestones = sort(keys %milestones); my @milestones = sort(keys %milestones);
$vars->{'product'} = \@selectable_products; $vars->{'product'} = \@selectable_products;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment