Sorting by year in opac lists doesn't work due to trying to use biblioitems.publicationyear which is not mapped in the default MARC21 mapping. My patch passes through the sorting field and will change 'year' to 'copyrightdate' to instead sort by biblio.copyrightdate (marc 260$c). Patch incoming (have to get bug number first).
Created attachment 10530 [details] [review] Fixing year sorting of OPAC lists Patch attached to fix, will pass sort field through the the SQL and will change 'year' to 'copyrightdate'.
Created attachment 10537 [details] [review] [SIGNED-OFF] bug 8323 fixing year sorting of a list Signed-off-by: Marc Veron <veron@veron.ch> Works as expected. Caveat: If you edit the list in Opac, change the sort and then klick 'Save', the List always is displayed in title order. This is du to the fact that save calls opac-shelves.pl?viewshelf=4 without the sort parameter (defaults to 'title'). If you go back to lists, choose the list from List name, the param is correct and the list displays in expected order. It took quite a time to track that down, I first thought that opac-shelves.pl was broken. However, current bug 8323 is not affected, signing off. Marc
Opend a bug for wrong sort order just after editing (8324).
QA comment: * Having to do $sortfield eq 'year' ? 'copyrightdate' : $sortfield proves that there's something wrong in the parameters. It's not in the scope of this patch to fix this, but if you want to provide a follow-up to have 'copyrightdate' in $sortfield instead of year, you'll be welcomed ! Otherwise, tiny patch, passes QA
Pushed to 3.8.x, will be in 3.8.3