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.
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!
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!
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>
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>
Works, makes sense, QA script happy, code looks good, passing QA :)
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work everyone! Pushed to stable for 22.11.x