Bug 37218

Summary: Sorting by publication date works unexpectedly in UNIMARC
Product: Koha Reporter: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Component: ListsAssignee: Bugs List <koha-bugs>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: amaury.gau, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 37218: Sorting by publication date works unexpectedly in UNIMARC

Description Baptiste Wojtkowski (bwoj) 2024-06-28 10:34:52 UTC
Sorting by publication date sorts the list by field biblio.copyrightdate which is not bound with an UNIMARC field.

I am not sure about the fix. Should we check the marc flavour to determine if we sort by biblio.copyrightdate and biblioitems.publicationyear ?
Comment 1 Baptiste Wojtkowski (bwoj) 2024-07-03 10:54:52 UTC
Created attachment 168437 [details] [review]
Bug 37218: Sorting by publication date works unexpectedly in UNIMARC

Steps to reproduce:
1 - Open a Koha with syspref "UNIMARC" set
2 - Search for items
3 - Sort by publication date -> there should be no change whatever you
  do

In my previous comment, I had not noticed that this is clearly a bug:
the results from search are put in the field "copyrightdate" whatever
the MARC flavour so the line checking for marcflavour to pick the sort
field is obsolete

TEST PLAN:
1 - Open a Koha with syspref "UNIMARC" set
2 - Search for items
3 - Sort by publication date -> there should be no change whatever you
  do
4 - Apply patch and repeat 2&3 -> items should be changed
Comment 2 Amaury GAU 2024-07-23 09:52:50 UTC
(In reply to Baptiste Wojtkowski (bwoj) from comment #1)

Hi Baptiste, 
Here's what tested.


> 3 - Sort by publication date -> there should be no change whatever you
>   do

I searched "science" and sorted by "Publication/Copyright date: newest to oldest". 

The records are somewhat sorted but are still not in the expected order.

> In my previous comment, I had not noticed that this is clearly a bug:
> the results from search are put in the field "copyrightdate" whatever
> the MARC flavour so the line checking for marcflavour to pick the sort
> field is obsolete
> 
> TEST PLAN:
> 1 - Open a Koha with syspref "UNIMARC" set
> 2 - Search for items
> 3 - Sort by publication date -> there should be no change whatever you
>   do
> 4 - Apply patch and repeat 2&3 -> items should be changed

After applying the patch, same behaviour occured.
Comment 3 Baptiste Wojtkowski (bwoj) 2024-07-23 14:49:04 UTC
Bug was incorrectly reported and fix is breaking a working functionnality