Bug 39334 - Preserve order when saving patron attributes
Summary: Preserve order when saving patron attributes
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Gustafsson
QA Contact: Testopia
URL:
Keywords: RM_priority
Depends on: 26744
Blocks:
  Show dependency treegraph
 
Reported: 2025-03-14 14:45 UTC by David Gustafsson
Modified: 2025-03-19 10:56 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39334: (follow up) Preserve order when adding patron attributes (6.21 KB, patch)
2025-03-14 14:50 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 39334: (follow-up) Preserve order when adding patron attributes (6.21 KB, patch)
2025-03-17 07:15 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 39334: (follow-up) Preserve order when adding patron attributes (6.34 KB, patch)
2025-03-17 11:23 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2025-03-14 14:45:14 UTC
A changed introduced in Bug 26744 affects the order in which patron attribtes are saved, so that one no longer can rely on that the attribute ids are assigned in the same order as the data was passed in. This has very minor implications in Koha itself. since attributes are sorted by other columns when retrieved. but many tests in t/db_dependent/api/v1/patrons_extended_attributes.t now fail because of this. This patch makes sure the order is preserved when saving the attributes, and tests should now work again.
Comment 1 David Gustafsson 2025-03-14 14:50:16 UTC
Created attachment 179329 [details] [review]
Bug 39334: (follow up) Preserve order when adding patron attributes

To test:
1) Run tests in t/db_dependent/api/v1/patrons_extended_attributes.t, serveral should fail
2) Apply patch
3) Run the tests in 1) again, all should now pass
Comment 2 Katrin Fischer 2025-03-17 07:12:29 UTC
Hi David, please make sure you are using the newest components (newest ktd, nuke erm_module, yarn install...) - the patch was not tidy. I fixed before pushing and treating this as a follow-up to the original bug
Comment 3 Katrin Fischer 2025-03-17 07:15:17 UTC
Hm, on second thought: since this doesn't fix the tests but changes the code I am asking for a set of QA eyes here too please. Attaching the tidied patch.
Comment 4 Katrin Fischer 2025-03-17 07:15:44 UTC
Created attachment 179377 [details] [review]
Bug 39334: (follow-up) Preserve order when adding patron attributes

To test:
1) Run tests in t/db_dependent/api/v1/patrons_extended_attributes.t, serveral should fail
2) Apply patch
3) Run the tests in 1) again, all should now pass
Comment 5 Jonathan Druart 2025-03-17 11:23:52 UTC
Created attachment 179388 [details] [review]
Bug 39334: (follow-up) Preserve order when adding patron attributes

To test:
1) Run tests in t/db_dependent/api/v1/patrons_extended_attributes.t, serveral should fail
2) Apply patch
3) Run the tests in 1) again, all should now pass

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 David Gustafsson 2025-03-17 14:32:35 UTC
(In reply to Katrin Fischer from comment #2)
> Hi David, please make sure you are using the newest components (newest ktd,
> nuke erm_module, yarn install...) - the patch was not tidy. I fixed before
> pushing and treating this as a follow-up to the original bug

Ok, thanks!
Comment 7 Katrin Fischer 2025-03-19 10:56:38 UTC
Pushed for 25.05!

Well done everyone, thank you!