https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22263
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 211455 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211455&action=edit Bug 22263: Add script to recalculate items.cn_sort Koha only calculates items.cn_sort when an item is created or when its call number or classification source changes. Changing a classification source or filing rule, or a wrong configuration at migration time, leaves existing items with the old sort key, and neither saving an item nor touch_all_items.pl is a good way to fix that on a large catalogue (the latter queues an index job and writes a log entry for every item). This adds misc/maintenance/recalculate_cn_sort.pl. It recomputes the key with the current configuration, writes only the items whose key changes without logging, holds queue or per-item indexing, and queues the changed biblios for reindexing once at the end. It can be limited by classification source (NULL for items without one) or a raw WHERE clause, has a dry run mode, and reports call numbers that produce an empty key. To test: 1. Create two items with call numbers "QA 4" and "QA 90", using a classification source whose filing rule is "generic" 2. Check items.cn_sort: QA_4 and QA_90 3. Administration > Classification sources: change the filing rule of that source to "lcc" 4. Run: misc/maintenance/recalculate_cn_sort.pl --dry-run -v => the two items are listed, nothing is changed 5. Run: misc/maintenance/recalculate_cn_sort.pl --confirm => items.cn_sort is now QA0004 and QA0090 6. Run it again and confirm that nothing is changed 7. Try --cn_source with a source code, and NULL 8. prove t/db_dependent/misc/maintenance/recalculate_cn_sort.t Co-Authored-By: Claude Sonnet 5.5 <[email protected]> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
