Bug 40916 - Cannot edit a list to have a sortfield value of anything other than publicationyear
Summary: Cannot edit a list to have a sortfield value of anything other than publicati...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Lucas Gass (lukeg)
QA Contact: Paul Derscheid
URL:
Keywords:
: 40487 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-09-30 19:44 UTC by Lucas Gass (lukeg)
Modified: 2025-10-06 15:17 UTC (History)
6 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes a problem where lists were un-sortable in the staff interface. It also fixes a problem where the sort value for a list was always being set to 'Publication year' when editing that list.
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40916: Fix evaluation when editing a list (1.37 KB, patch)
2025-09-30 19:46 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 40916: Fix another occurance (1.01 KB, patch)
2025-09-30 20:28 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 40916: Fix another occurance (1.06 KB, patch)
2025-10-01 17:16 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 40916: Fix evaluation when editing a list (1.43 KB, patch)
2025-10-02 10:21 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 40916: Fix another occurance (1.12 KB, patch)
2025-10-02 10:21 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2025-09-30 19:44:00 UTC
TO recreate:

1. Create a list
2. Sort this list by: title
3. Save 
4. Edit the list, changing the the "Sort this list by:" to copyrightdate
5. Try to edit it again to any other type of sort. Save 
6. Look again, it is reverted to copyrightdate
Comment 1 Lucas Gass (lukeg) 2025-09-30 19:44:46 UTC
This check:

if ( $sortfield == 'copyrightdate' and C4::Context->preference('marcflavour') == 'UNIMARC' ) {

It should use 'eq' to compare strings, not `==`.
Comment 2 Lucas Gass (lukeg) 2025-09-30 19:46:35 UTC
Created attachment 187133 [details] [review]
Bug 40916: Fix evaluation when editing a list

1. Create a list
2. Sort this list by: title
3. Save
4. Edit the list, changing the the "Sort this list by:" to copyrightdate
5. Try to edit it again to any other type of sort. Save
6. Look again, it is reverted to copyrightdate
7. APPLY PATCH, restart_all
8. Now when you edit the list any value you use in "Sort this list by:" should be retained.
Comment 3 Lucas Gass (lukeg) 2025-09-30 20:28:04 UTC
Created attachment 187137 [details] [review]
Bug 40916: Fix another occurance
Comment 4 Lucas Gass (lukeg) 2025-10-01 12:06:51 UTC
With these patches applied lists should sort correctly.
Comment 5 Lucas Gass (lukeg) 2025-10-01 12:07:12 UTC
*** Bug 40487 has been marked as a duplicate of this bug. ***
Comment 6 Biblibre Sandboxes 2025-10-01 17:16:49 UTC
Created attachment 187222 [details] [review]
Bug 40916: Fix another occurance

Signed-off-by: Michelle <mspinney@clamsnet.org>
Comment 7 Paul Derscheid 2025-10-02 10:21:51 UTC
Created attachment 187248 [details] [review]
Bug 40916: Fix evaluation when editing a list

1. Create a list
2. Sort this list by: title
3. Save
4. Edit the list, changing the the "Sort this list by:" to copyrightdate
5. Try to edit it again to any other type of sort. Save
6. Look again, it is reverted to copyrightdate
7. APPLY PATCH, restart_all
8. Now when you edit the list any value you use in "Sort this list by:" should be retained.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 8 Paul Derscheid 2025-10-02 10:21:53 UTC
Created attachment 187249 [details] [review]
Bug 40916: Fix another occurance

Signed-off-by: Michelle <mspinney@clamsnet.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 9 Paul Derscheid 2025-10-02 10:23:02 UTC
Wow, that one was really subtle! Good catch.
I also noticed that the sort by dropdown in the main list table behaves weirdly but that's maybe for another bug.
Comment 10 Lucas Gass (lukeg) 2025-10-06 15:17:17 UTC
Nice work everyone!

Pushed to main for 25.11