splittingred/Gallery — pull request #284 by Jacqbus (2014-05-20 17:06:24+00:00)
Title: Improved sorting function in GalleryAlbum

I had a problem with sorting by 'rank' field in GalleryAlbums. The problem was that, when i had some parent Albums and then few Album-childrens inside, the rank field for childrens in each Album-parent was reset to 0, so sorting function work only for one Parent-Album. When i had many of that sets, sorting function did mess.

The problem was in line 461 in galalbum.class.php:
$c->sortby($sort,$dir);
This simple 'sortby' didn't include parent field.

The solution is replace that mentioned line by
$c->sortby('COALESCE(parent, rank) DESC, rank',$dir);

I hope you can understand what i mean :)