Bug 33362 - Return claims can be un-resolvable if issue_id is set but no issue is found in issues or old_issues
Summary: Return claims can be un-resolvable if issue_id is set but no issue is found i...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Kyle M Hall (khall)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-29 18:35 UTC by Kyle M Hall (khall)
Modified: 2023-12-28 20:47 UTC (History)
4 users (show)

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


Attachments
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database (4.63 KB, patch)
2023-05-11 14:46 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database (4.65 KB, patch)
2023-05-11 14:48 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database (4.69 KB, patch)
2023-05-19 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database (4.75 KB, patch)
2023-05-23 02:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2023-03-29 18:35:16 UTC
The column return_claims.issue_id is not a foreign key. If for any reason the issue is removed ( such as via cleanup_database.pl ), that claim will raise an FKConstraint exception every time an attempt is made to resolve it.

We should either split that column into two with foreign key constrains, or allow the claim to be resolved even if the related issues cannot be found.
Comment 1 Kyle M Hall (khall) 2023-05-11 14:46:08 UTC
Created attachment 151084 [details] [review]
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database

Test Plan:
1) Check out an item
2) Claim return on it, moving it to the old_issues table
3) Delete the old_issue via koha-mysql or Use cleanup_database.pl
4) Attempt to resolve the claim
5) Note the error
6) Apply this patch set
7) Restart all the things!
8) Attempt to resolve the claim
9) No errors!
Comment 2 Kyle M Hall (khall) 2023-05-11 14:48:11 UTC
Created attachment 151085 [details] [review]
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database

Test Plan:
1) Check out an item
2) Claim return on it, moving it to the old_issues table
3) Delete the old_issue via koha-mysql or Use cleanup_database.pl
4) Attempt to resolve the claim
5) Note the error
6) Apply this patch set
7) Restart all the things!
8) Attempt to resolve the claim
9) No errors!
Comment 3 Sam Lau 2023-05-19 18:29:18 UTC
Created attachment 151492 [details] [review]
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database

Test Plan:
1) Check out an item
2) Claim return on it, moving it to the old_issues table
3) Delete the old_issue via koha-mysql or Use cleanup_database.pl
4) Attempt to resolve the claim
5) Note the error
6) Apply this patch set
7) Restart all the things!
8) Attempt to resolve the claim
9) No errors!

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 4 Victor Grousset/tuxayo 2023-05-23 02:07:26 UTC
Created attachment 151547 [details] [review]
Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database

Test Plan:
1) Check out an item
2) Claim return on it, moving it to the old_issues table
3) Delete the old_issue via koha-mysql or Use cleanup_database.pl
4) Attempt to resolve the claim
5) Note the error
6) Apply this patch set
7) Restart all the things!
8) Attempt to resolve the claim
9) No errors!

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 5 Victor Grousset/tuxayo 2023-05-23 02:08:12 UTC
Works, makes sense, QA script happy, code looks good, passing QA :)
Comment 6 Tomás Cohen Arazi (tcohen) 2023-05-24 14:22:29 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 7 Matt Blenkinsop 2023-06-08 17:15:47 UTC
Nice work everyone!

Pushed to stable for 22.11.x