Bug 30633

Summary: Move OPACHoldingsDefaultSortField to table settings configuration
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: Signed Off --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: aude.charillon, catrina, clemens.tubach, jonathan.druart, michaela.sieber, r.delahunty
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36640
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 40982, 41010, 16552, 16759, 29648    
Bug Blocks: 30634    
Attachments: Bug 30633: Prepare the ground
Bug 30633: Hide columns when needed
Bug 30633: Add default_sort_order to table settings
Bug 30633: Remove OPACHoldingsDefaultSortField
Bug 30633: Prepare the ground
Bug 30633: Hide columns when needed
Bug 30633: Add default_sort_order to table settings
Bug 30633: Remove OPACHoldingsDefaultSortField

Description Katrin Fischer 2022-04-27 16:44:53 UTC
Now that the sorting of a table can be defined in administration > table settings, we should move OPACHoldingsDefaultSortField there and remove the pref.
Comment 1 Catrina Berka 2023-02-16 19:03:08 UTC
Does 23.05 include the ability to sort the holdingst table? There is no sort capability on that table in 22.11 so the system preference is still needed.
Comment 2 Aude Charillon 2025-09-25 15:20:07 UTC
I believe making this happen would solve bug 35319 - Default sorting of the holdings table with OPACHoldingsDefaultSortField is broken?
Comment 3 Jonathan Druart 2025-10-14 09:28:25 UTC
Feature introduced by bug 16552, accidentally removed by bug 16759.
Comment 4 Jonathan Druart 2025-10-14 09:28:48 UTC
I can work on this if we get one tester and one QAer in advance for quick inclusion.
Comment 5 Jonathan Druart 2025-10-14 09:29:36 UTC
*** Bug 35319 has been marked as a duplicate of this bug. ***
Comment 6 Ray Delahunty 2025-10-14 09:50:04 UTC
We don't have server access but assuming this is testable in a sandbox, I'll try for the first signoff.
Comment 7 Jonathan Druart 2025-10-14 10:01:18 UTC
Created attachment 187856 [details] [review]
Bug 30633: Prepare the ground

Make the OPAC holdings table ready to use visibility based on
column's names.
Comment 8 Jonathan Druart 2025-10-14 10:01:20 UTC
Created attachment 187857 [details] [review]
Bug 30633: Hide columns when needed

We can use the force_visibility flag to hide column when they are empty
or should not be displayed because of syspref.
Comment 9 Jonathan Druart 2025-10-14 10:01:22 UTC
Created attachment 187858 [details] [review]
Bug 30633: Add default_sort_order to table settings

So we can pick a column from the table settings
http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst
Comment 10 Jonathan Druart 2025-10-14 10:01:25 UTC
Created attachment 187859 [details] [review]
Bug 30633: Remove OPACHoldingsDefaultSortField

It's no longer needed
Comment 11 Jonathan Druart 2025-10-14 10:01:40 UTC
I am suggesting to remove OPACHoldingsDefaultSortField and have the default sort order option available for this table in the table settings.

With OpacLocationBranchToDisplay (introduced by bug 35006) it might improve the situation and answer the different needs.
Comment 12 Biblibre Sandboxes 2025-10-14 14:24:31 UTC
Created attachment 187886 [details] [review]
Bug 30633: Prepare the ground

Make the OPAC holdings table ready to use visibility based on
column's names.

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Comment 13 Biblibre Sandboxes 2025-10-14 14:24:33 UTC
Created attachment 187887 [details] [review]
Bug 30633: Hide columns when needed

We can use the force_visibility flag to hide column when they are empty
or should not be displayed because of syspref.

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Comment 14 Biblibre Sandboxes 2025-10-14 14:24:35 UTC
Created attachment 187888 [details] [review]
Bug 30633: Add default_sort_order to table settings

So we can pick a column from the table settings
http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Comment 15 Biblibre Sandboxes 2025-10-14 14:24:38 UTC
Created attachment 187889 [details] [review]
Bug 30633: Remove OPACHoldingsDefaultSortField

It's no longer needed

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Comment 16 Michaela Sieber 2025-10-14 14:35:42 UTC
Tested in Sandbox and additionally with ktd.

Testplan:

- search for a biblio with multiple items, e.g. biblionumber=211
- change the items so that they have different home libraries, current libraries, itemtypes, collections, and so on ...
- try different variations of sysprefs OPACHoldingsDefaultSortField and check that the sort order in the opac is always by item type
- apply patch
- Go to system preferences and verify that OPACHoldingsDefaultSortField does not exist any more
- Go to table settings and check the new drop down for default sort order
- try different variations of the default sort order settings and verify that the holdings table in the opac is sorted correctly