Bug 39652

Summary: Pseudonymized_borrower_attributes causes subsequent pseudonymized_transactions to not be added
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: PatronsAssignee: Pedro Amorim <pedro.amorim>
Status: Pushed to main --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: normal    
Priority: P5 - low CC: david, gmcharlt, kyle.m.hall, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 37901    
Attachments: Bug 39652: Add tests
Bug 39652: store PseudonymizedTransaction before adding related entries
Bug 39652: Rename new_from_statistic
Bug 39652: Rename new_from_statistic
Bug 39652: Add tests
Bug 39652: store PseudonymizedTransaction before adding related entries
Bug 39652: Rename new_from_statistic
Bug 39652: Add tests
Bug 39652: store PseudonymizedTransaction before adding related entries
Bug 39652: Rename new_from_statistic
Bug 39652 (QA follow-up): Update misc/maintenance/pseudonymize_statistics.pl

Description Pedro Amorim 2025-04-16 11:03:03 UTC
And the new PseudonymizedBorrowerAttribute entries to attach to the previous PseudonymizedTransaction
Comment 1 Pedro Amorim 2025-04-16 11:13:50 UTC
Created attachment 181001 [details] [review]
Bug 39652: Add tests

These tests prove the bug:
perl t/db_dependent/Koha/Pseudonymization.t
Comment 2 Pedro Amorim 2025-04-16 11:46:35 UTC
Created attachment 181002 [details] [review]
Bug 39652: store PseudonymizedTransaction before adding related entries

Test plan:
Run the tests before and after applying this patch:
perl t/db_dependent/Koha/Pseudonymization.t

They should fail before this patch and pass after applying patch.
Comment 3 Martin Renvoize (ashimema) 2025-04-17 12:26:45 UTC
The approach seems sound to me and works; I've already spoken to Pedro about the `new_` name and we agreed to perhaps rename to `create_` to clarify that in this case the method is actually storing data now do no subsequent 'store' is required.
Comment 4 Pedro Amorim 2025-04-17 15:56:26 UTC
Created attachment 181109 [details] [review]
Bug 39652: Rename new_from_statistic

This new method name better reflects the fact that it now creates - and stores - the PseudonymizedTransaction object
Comment 5 Pedro Amorim 2025-04-17 15:57:40 UTC
Created attachment 181110 [details] [review]
Bug 39652: Rename new_from_statistic

This new method name better reflects the fact that it now creates - and stores - the PseudonymizedTransaction object
Comment 6 David Nind 2025-04-19 09:27:50 UTC
Created attachment 181209 [details] [review]
Bug 39652: Add tests

These tests prove the bug:
perl t/db_dependent/Koha/Pseudonymization.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2025-04-19 09:27:53 UTC
Created attachment 181210 [details] [review]
Bug 39652: store PseudonymizedTransaction before adding related entries

Test plan:
Run the tests before and after applying this patch:
perl t/db_dependent/Koha/Pseudonymization.t

They should fail before this patch and pass after applying patch.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-04-19 09:27:56 UTC
Created attachment 181211 [details] [review]
Bug 39652: Rename new_from_statistic

This new method name better reflects the fact that it now creates - and stores - the PseudonymizedTransaction object

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-04-19 09:29:29 UTC
Testing notes (using KTD):
1. Apply the first patch.
2. The tests should fail: prove t/db_dependent/Koha/Pseudonymization.t
3. Apply the remaining patches.
3. The tests should now pass: prove t/db_dependent/Koha/Pseudonymization.t
Comment 10 Nick Clemens (kidclamp) 2025-04-23 14:44:14 UTC
Created attachment 181382 [details] [review]
Bug 39652: Add tests

These tests prove the bug:
perl t/db_dependent/Koha/Pseudonymization.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Nick Clemens (kidclamp) 2025-04-23 14:44:16 UTC
Created attachment 181383 [details] [review]
Bug 39652: store PseudonymizedTransaction before adding related entries

Test plan:
Run the tests before and after applying this patch:
perl t/db_dependent/Koha/Pseudonymization.t

They should fail before this patch and pass after applying patch.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Nick Clemens (kidclamp) 2025-04-23 14:44:18 UTC
Created attachment 181384 [details] [review]
Bug 39652: Rename new_from_statistic

This new method name better reflects the fact that it now creates - and stores - the PseudonymizedTransaction object

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 13 Nick Clemens (kidclamp) 2025-04-23 14:44:20 UTC
Created attachment 181385 [details] [review]
Bug 39652 (QA follow-up): Update misc/maintenance/pseudonymize_statistics.pl

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 14 Katrin Fischer 2025-04-24 17:48:27 UTC
Fixed before pushing: 

Processing additional checks

	* Commit title does not start with 'Bug XXXXX: ' - be2ae9c86ab
Comment 15 Katrin Fischer 2025-04-24 17:54:03 UTC
Pushed for 25.05!

Well done everyone, thank you!