View Issue Details

IDProjectCategoryView StatusLast Update
0014503mantisbtfeaturepublic2012-08-09 16:46
Reporterzuallauz Assigned Todregad  
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version1.2.11 
Summary0014503: Incorrect order of versions in dropdowns
Description

The versions being displayed in the dropdowns for Product Version, Fixed in Version and Target Version are incorrectly ordered. Currently they use an unknown order - probably the order they were added.

They should be ordered from latest version to oldest version in the dropdown. It makes sense that the latest version would be at the top as most bugs will be filed against that. Also it doesn't make sense for a random order as it makes it harder to find the version.

Steps To Reproduce

View any of the version drop downs in the lists. You'll note the order will be something like this:

'7.1.7'
'8.0.0'
'7.1.2'
'8.1.3'
'8.1.2'

They should look like this:

'8.1.3'
'8.1.2'
'8.0.0'
'7.1.7'
'7.1.2'

Additional Information

I have created a small patch for this which I tested in version 1.1.8:

Line 832 in /usr/share/mantis/www/core/print_api.php

Add in the following code:

// Sort the versions from highest to lowest
usort($versions, function($a, $b)
{
return version_compare($a['version'], $b['version'], '<');
});

TagsNo tags attached.

Relationships

duplicate of 0010419 acknowledged Allow customized sorting of versions 

Activities

Lapinkiller

Lapinkiller

2012-07-25 03:24

reporter   ~0032362

Last edited: 2012-07-25 03:25

I confirm this bug

But, versions should be ordered by date and not its name

You don't always have numeric version.

Example with dokuwiki :
version name are : angua, antearer etc

so version_compare will failed ;)

atrol

atrol

2012-07-25 16:16

developer   ~0032369

Can I close this as a duplicate of 0011095 ?
Versions by default are sorted by the date associated with the version, allowing you to define the order by changing the date of each version.

zuallauz

zuallauz

2012-07-26 04:23

reporter   ~0032375

Ok I understand that it works ordering by date. However I'm working for an organisation that has 70+ different versions created, all with incorrect dates so everything is out of order. I believe they just added the versions without assigning a proper date to the version. It would be quite time consuming to go back and assign dates to the random order they are in.

Is it possible just to have a small feature which sorts it by date by default, but if the user chooses then they can select an option to sort the dropdowns by the version name/number?

The code above works fine sorting versions that aren't in format "3.2.1" it just puts them at the end of the list. However you could always order ones with non numeric characters alphabetically as well. If you're still supporting the PHP 5.2 and lower the code above won't work because it uses a closure, so you'd have to use the old usort format with a separate function.

dregad

dregad

2012-07-26 16:23

developer   ~0032379

Please see issue 0010419 (the one mentioned by atrol earlier is actually a duplicate of that one).

As for your immediate problem, since it is quite unlikely that the requested feature gets implemented in the short term, I would advise you to write a small, one-time fix script that will update the version's date in the database table based on the desired version number.