[Bug 44152] New: Allow classification call number sorting in the holds queue
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 Bug ID: 44152 Summary: Allow classification call number sorting in the holds queue Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Hold requests Assignee: nugged@gmail.com Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com Target Milestone: --- The Call number column in Circulation > Holds queue is ordered as plain text. For LCC call numbers such as JC43 and JC330, that differs from classification shelf order. There is currently no preference to choose classification ordering for this report. Steps to reproduce: 1. Prepare available LCC items with call numbers JC43 .G6 1890, JC330 .F74 2000 and JC480 .R63 2006 at the same holding library. 2. Place holds on those items and rebuild the holds queue using the usual queue-building job. 3. Open Circulation > Holds queue, select the library and submit the report. 4. Sort Call number ascending. Actual result: JC330 .F74 2000 appears before JC43 .G6 1890, followed by JC480 .R63 2006. Requested behavior: Allow a library to choose classification ordering: JC43, JC330, JC480. A separate HoldsCallnumberSortQueue preference can offer alphabetical and classification choices. Alphabetical remains the default to preserve current behavior. Technical note: The current main report uses /api/v1/holds/queue. Classification ordering must be applied on the server before pagination, using the related item's cn_sort while preserving the displayed call number and existing API fields, filters and permissions. Missing or empty classification keys can fall back to the displayed call number. Bug 26867 covers the separate Holds to pull report. The two reports need independent preferences. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #1 from Andrii Nugged <nugged@gmail.com> --- Created attachment 211998 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211998&action=edit Bug 44152: Add HoldsCallnumberSortQueue preference Allow libraries to select alphabetical or classification call number ordering in the holds queue. Default to alphabetical to preserve the current main behavior independently of the Holds to pull preference. Add the fresh-install seed, an idempotent atomic update that preserves configured values, and the administration UI definition. Test plan: 1. Run the database updater and search for HoldsCallnumberSortQueue. 2. Confirm the default is alphabetical. 3. Save classification, rerun the atomic update, and confirm the value remains classification. 4. Confirm the fresh-install seed defines the same default. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #2 from Andrii Nugged <nugged@gmail.com> --- Created attachment 211999 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211999&action=edit Bug 44152: Apply the selected call number order to the holds queue The holds queue orders call numbers as plain text, which differs from classification shelf order for call numbers such as JC43 and JC330. Apply HoldsCallnumberSortQueue in the queue result set before pagination. Classification mode uses the related item's cn_sort and falls back to the displayed call number for a missing or empty key. Alphabetical mode, missing preferences and unknown values preserve plain-text ordering. Preserve other requested ordering fields and resolve call number ties by item number after those fields. Keep the existing API fields, filtering and permissions unchanged. Exercise both directions, pagination, missing keys, configuration fallbacks and existing multi-column ordering with the actual API. Test plan: Prepare three available LCC items with call numbers JC43 .G6 1890, JC330 .F74 2000 and JC480 .R63 2006, place holds on them, and rebuild the holds queue using the normal queue-building job. Before applying the patch: 1. Open Circulation > Holds queue. 2. Select the holding library and submit the report. 3. Sort Call number ascending. Confirm JC330, JC43, JC480. Apply the series and run the database updater. After applying the patch: 1. Repeat the report and confirm the default ordering is unchanged. 2. Set HoldsCallnumberSortQueue to classification in system preferences. 3. Reopen the report and sort Call number ascending. Confirm JC43, JC330, JC480, and the reverse order when sorting descending. 4. Save alphabetical and confirm the original ordering returns. 5. Run prove -v t/db_dependent/api/v1/holds_queue.t. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=26867 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=14907 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=41932 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- I'm really not that familiar with classification schemes, but there was no change in the sorting order for me after the patches. I only edited the "o - Full call number" for the items I placed a hold on. Do I need to do something else to make this work? Testing notes (using KTD): 1. To update the holds queue: misc/cronjobs/holds/build_holds_queue.pl 2. Step 4 of the second patch test plan "Confirm the fresh-install seed defines the same default.": I assume this means that for a fresh install, the default setting for the new HoldsCallnumberSortQueue system preference is "alphabetically (as plain text)". To do this run reset_all in KTD with the patches applied, and check the system preference value. 3. Sample items edited with call numbers and holds placed for Mary Burton for pickup at Centerville: - Programming Perl (262): 39999000011418 - JC43 .G6 1890 - Intermediate Perl (126): 39999000005134 - JC330 .F74 2000 - Perl template toolkit (255): 39999000011111 - JC480 .R63 2006 4. I even deleted any existing 050 information and reindexed (koha-rebuild-zebra -d -f -v kohadev) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211998|0 |1 is obsolete| | Attachment #211999|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 212160 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212160&action=edit Bug 44152: Add HoldsCallnumberSortQueue preference Allow libraries to select alphabetical or classification call number ordering in the holds queue. Default to alphabetical to preserve the current main behavior independently of the Holds to pull preference. Add the fresh-install seed, an idempotent atomic update that preserves configured values, and the administration UI definition. Test plan: 1. Run the database updater and search for HoldsCallnumberSortQueue. 2. Confirm the default is alphabetical. 3. Save classification, rerun the atomic update, and confirm the value remains classification. 4. Confirm the fresh-install seed defines the same default. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 212161 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212161&action=edit Bug 44152: Apply the selected call number order to the holds queue The holds queue orders call numbers as plain text, which differs from classification shelf order for call numbers such as JC43 and JC330. Apply HoldsCallnumberSortQueue in the queue result set before pagination. Classification mode uses the related item's cn_sort and falls back to the displayed call number for a missing or empty key. Alphabetical mode, missing preferences and unknown values preserve plain-text ordering. Preserve other requested ordering fields and resolve call number ties by item number after those fields. Keep the existing API fields, filtering and permissions unchanged. Exercise both directions, pagination, missing keys, configuration fallbacks and existing multi-column ordering with the actual API. Test plan: Prepare three available LCC items with call numbers JC43 .G6 1890, JC330 .F74 2000 and JC480 .R63 2006, place holds on them, and rebuild the holds queue using the normal queue-building job. Before applying the patch: 1. Open Circulation > Holds queue. 2. Select the holding library and submit the report. 3. Sort Call number ascending. Confirm JC330, JC43, JC480. Apply the series and run the database updater. After applying the patch: 1. Repeat the report and confirm the default ordering is unchanged. 2. Set HoldsCallnumberSortQueue to classification in system preferences. 3. Reopen the report and sort Call number ascending. Confirm JC43, JC330, JC480, and the reverse order when sorting descending. 4. Save alphabetical and confirm the original ordering returns. 5. Run prove -v t/db_dependent/api/v1/holds_queue.t. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed --- Comment #6 from David Nind <david@davidnind.com> --- Please ignore my previous comment (which I've obsoleted) - I solved how to get this to work (from testing related bug 262867). The missing step to make this work with the current test plan is to: 1. Set "2 - Source of classification or shelving scheme" to "Library of Congress Classification" for the items you add the call numbers to. Note: When creating a new record, the 942$2 defaults to DDC (for the BKS framework), and the "2 - Source of classification or shelving scheme" for a new item defaults to DDC. Something for QA: 1. The new system preference defaults to "alphabetically (as plain text)". 2. This preserves the current behavour before the patches, which is the standard practice for new system preferences. 3. However, related bug 26867 takes a different approach, and sets its new system preference to "by classification sort key (cn_sort)". 4. I don't mind what the default is set to (and in some ways it makes sense to make it default to the order that actually works), but I think both bugs should be consistent and take the same approach. Testing notes (using KTD): 1. Step 4 of the first patch test plan "Confirm the fresh-install seed defines the same default.": I assume this means that for a fresh install, the default setting for the new HoldsCallnumberSortQueue system preference is "alphabetically (as plain text)". To test this run reset_all in KTD with the patches applied, and check the default system preference value. 2. When adding the suggested call numbers to items, change "2 - Source of classification or shelving scheme" to "Library of Congress Classification", otherwise there is no change in the sort order with the new system preference. 3. Sample items edited with call numbers and holds placed for Mary Burton for pickup at Centerville: - Programming Perl (262): 39999000011418 - JC43 .G6 1890 - Intermediate Perl (126): 39999000005134 - JC330 .F74 2000 - Perl template toolkit (255): 39999000011111 - JC480 .R63 2006 4. To update the holds queue: misc/cronjobs/holds/build_holds_queue.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #7 from Andrii Nugged <nugged@gmail.com> --- Created attachment 212169 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212169&action=edit Bug 44152: Keep classification sorting with report search and pagination The report's full search includes related bibliographic fields. With classification ordering, DBIx cannot derive the grouping needed for paginated results from the literal COALESCE expression in ORDER BY. The API returns 500 although simpler ordering tests pass. Expose the computed key as a declared column of a virtual DBIx source, with one row per queue item. DBIx can then apply its normal grouping and pagination rules. No database view or schema migration is needed. Keep API output, missing-key fallback, ties and the alphabetical default. Exercise the report's complete embeds and search fields with pagination, both modes and directions. Also generate real DDC and LCC keys through Item->store instead of relying only on precomputed key fixtures. Test plan: Continue the preceding report plan with this fixture correction: 1. Edit each test item. 2. Set "2 - Source of classification or shelving scheme" to "Library of Congress Classification". 3. Save the item. Before applying this follow-up: 1. Set HoldsCallnumberSortQueue to classification. 2. Open Circulation > Holds queue and submit the report. 3. Sort Call number and enter a title in the table's Search box. 4. Observe the 500 error. Apply the patch. After applying the patch: 1. Repeat the same report search and call number sorting. 2. Confirm the report loads and gives the expected classification order. 3. Reverse the sorting and check the next page when results span pages. 4. Select alphabetical and confirm plain-text order still works. Automated tests: prove t/db_dependent/api/v1/holds_queue.t Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff --- Comment #8 from Andrii Nugged <nugged@gmail.com> --- The LCC item-setting step is now explicit here too. Both reports keep alphabetical sorting by default. The follow-up also fixes a 500 with classification sorting and the table's search. The regression now covers that request, pagination, both directions and real DDC/LCC key generation. Manual report checks and the API regression pass. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212160|0 |1 is obsolete| | Attachment #212161|0 |1 is obsolete| | Attachment #212169|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 212172 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212172&action=edit Bug 44152: Add HoldsCallnumberSortQueue preference Allow libraries to select alphabetical or classification call number ordering in the holds queue. Default to alphabetical to preserve the current main behavior independently of the Holds to pull preference. Add the fresh-install seed, an idempotent atomic update that preserves configured values, and the administration UI definition. Test plan: 1. Run the database updater and search for HoldsCallnumberSortQueue. 2. Confirm the default is alphabetical. 3. Save classification, rerun the atomic update, and confirm the value remains classification. 4. Confirm the fresh-install seed defines the same default. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #10 from David Nind <david@davidnind.com> --- Created attachment 212173 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212173&action=edit Bug 44152: Apply the selected call number order to the holds queue The holds queue orders call numbers as plain text, which differs from classification shelf order for call numbers such as JC43 and JC330. Apply HoldsCallnumberSortQueue in the queue result set before pagination. Classification mode uses the related item's cn_sort and falls back to the displayed call number for a missing or empty key. Alphabetical mode, missing preferences and unknown values preserve plain-text ordering. Preserve other requested ordering fields and resolve call number ties by item number after those fields. Keep the existing API fields, filtering and permissions unchanged. Exercise both directions, pagination, missing keys, configuration fallbacks and existing multi-column ordering with the actual API. Test plan: Prepare three available LCC items with call numbers JC43 .G6 1890, JC330 .F74 2000 and JC480 .R63 2006, place holds on them, and rebuild the holds queue using the normal queue-building job. Before applying the patch: 1. Open Circulation > Holds queue. 2. Select the holding library and submit the report. 3. Sort Call number ascending. Confirm JC330, JC43, JC480. Apply the series and run the database updater. After applying the patch: 1. Repeat the report and confirm the default ordering is unchanged. 2. Set HoldsCallnumberSortQueue to classification in system preferences. 3. Reopen the report and sort Call number ascending. Confirm JC43, JC330, JC480, and the reverse order when sorting descending. 4. Save alphabetical and confirm the original ordering returns. 5. Run prove -v t/db_dependent/api/v1/holds_queue.t. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44152 --- Comment #11 from David Nind <david@davidnind.com> --- Created attachment 212174 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212174&action=edit Bug 44152: Keep classification sorting with report search and pagination The report's full search includes related bibliographic fields. With classification ordering, DBIx cannot derive the grouping needed for paginated results from the literal COALESCE expression in ORDER BY. The API returns 500 although simpler ordering tests pass. Expose the computed key as a declared column of a virtual DBIx source, with one row per queue item. DBIx can then apply its normal grouping and pagination rules. No database view or schema migration is needed. Keep API output, missing-key fallback, ties and the alphabetical default. Exercise the report's complete embeds and search fields with pagination, both modes and directions. Also generate real DDC and LCC keys through Item->store instead of relying only on precomputed key fixtures. Test plan: Continue the preceding report plan with this fixture correction: 1. Edit each test item. 2. Set "2 - Source of classification or shelving scheme" to "Library of Congress Classification". 3. Save the item. Before applying this follow-up: 1. Set HoldsCallnumberSortQueue to classification. 2. Open Circulation > Holds queue and submit the report. 3. Sort Call number and enter a title in the table's Search box. 4. Observe the 500 error. Apply the patch. After applying the patch: 1. Repeat the same report search and call number sorting. 2. Confirm the report loads and gives the expected classification order. 3. Reverse the sorting and check the next page when results span pages. 4. Select alphabetical and confirm plain-text order still works. Automated tests: prove t/db_dependent/api/v1/holds_queue.t Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org