Gallery
Gallery copied to clipboard
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 :)
EDIT 23.05:
- COALESCE in that configuration don't work correctly. I'm working on it...