Bug 38080 - Sorting options for holdings table are incorrect
Summary: Sorting options for holdings table are incorrect
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Laura Escamilla
URL:
Keywords:
Depends on: 14919
Blocks:
  Show dependency treegraph
 
Reported: 2024-10-03 17:25 UTC by Nick Clemens (kidclamp)
Modified: 2025-12-02 10:13 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the default sort order for the OPAC holdings table, so that the default table sorting setting is used. Previously, it was not correctly using this setting (for example, setting the shelving location as the default sort order did not work).
Version(s) released in:
25.11.00,25.05.06,24.11.11
Circulation function:


Attachments
Bug 38080: Fix order of columns in opac's holdings tables (1.18 KB, patch)
2025-10-20 08:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38080: Fix order of columns in opac's holdings tables (1.23 KB, patch)
2025-10-26 22:22 UTC, David Nind
Details | Diff | Splinter Review
Bug 38080: Fix order of columns in opac's holdings tables (1.29 KB, patch)
2025-10-30 15:17 UTC, Laura Escamilla
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-10-03 17:25:42 UTC
The sorting seems to rely on the correct ordering of the columns from the DB/YAML - the current order does not match the displayed order, so if you select to sort by CCODE, we actually sort by callnumber
Comment 2 Jonathan Druart 2025-10-20 08:20:41 UTC
I do recreate the problem at the OPAC
Comment 3 Jonathan Druart 2025-10-20 08:23:03 UTC
Caused by 
  commit 4fa34acc414a1580019df62c28bb39bb6d9f3e85
  Bug 14919: Add holds history for patron
Comment 4 Jonathan Druart 2025-10-20 08:25:14 UTC
Created attachment 188142 [details] [review]
Bug 38080: Fix order of columns in opac's holdings tables

The order of the columns in the yaml file must match the order of the
columns in the template file.

Test plan:
Confirm that, with bug 30633 applied, you can pick "shelving location"
as the default sort order and that the items are correctly sorted by
shelving location.
Comment 5 Jonathan Druart 2025-10-20 08:25:53 UTC
This bug has certainly been opened for the staff. In the OPAC the problem shouldn't be visible before bug 30633.
Comment 6 David Nind 2025-10-26 22:22:39 UTC
Created attachment 188451 [details] [review]
Bug 38080: Fix order of columns in opac's holdings tables

The order of the columns in the yaml file must match the order of the
columns in the template file.

Test plan:
Confirm that, with bug 30633 applied, you can pick "shelving location"
as the default sort order and that the items are correctly sorted by
shelving location.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2025-10-26 22:34:43 UTC
I hope I have tested this correctly.

Testing notes (using KTD on main, bug 30633 is already included in main)

1. Replicate the issue:
   1.1 Find a record with multiple items. I used record 255 - Perl template toolkit, with four items.
   1.2 Change the shelving locations for each item, so that each item is different. I edited items so that the shelving locations were General stacks, New materials shelf, Fiction, Children's area.
   1.3 For the OPAC holdings table setting (Administration > Other > Table settings > OPAC > biblio-detail > holdingst), set the default sort order to shelving location (item_shelving_location).
   1.4 Set OpacLocationOnDetail = on a separate column.
   1.5 Open the record details page in the OPAC.
   1.6. Note the collection code column is used to sort the holdings table (the Collection column has the ascending arrow in dark green highlighted).
   1.7 Note that the shelving location was not used as the default sorting order.
2. Apply the patch.
3. Reset everything (reset_all).
4. Repeat steps 1.1 to 1.5.
5. Note that now the shelving location is used to sort the items (the shelving location column has the ascending arrow in dark green highlighted), and these are in ascending alphabetical order.
Comment 8 Laura Escamilla 2025-10-30 15:17:37 UTC
Created attachment 188661 [details] [review]
Bug 38080: Fix order of columns in opac's holdings tables

The order of the columns in the yaml file must match the order of the
columns in the template file.

Test plan:
Confirm that, with bug 30633 applied, you can pick "shelving location"
as the default sort order and that the items are correctly sorted by
shelving location.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 9 Lucas Gass (lukeg) 2025-10-31 21:28:35 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 10 Paul Derscheid 2025-11-25 16:30:29 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 11 Fridolin Somers 2025-12-02 10:13:59 UTC
Pushed to 24.11.x for 24.11.11