Bug 31369 - Koha::Recalls->add_recall should validate there's a related checkout
Summary: Koha::Recalls->add_recall should validate there's a related checkout
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 29734
Blocks:
  Show dependency treegraph
 
Reported: 2022-08-16 12:50 UTC by Tomás Cohen Arazi
Modified: 2022-08-16 20:43 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2022-08-16 12:50:50 UTC
I haven't really tried, but the code cleary relies on an $recall->checkout returning a Koha::Checkout object... Which shouldn't be taken for granted. The way it is constructed is fragile and makes the controller need to perform all the checks, that really belong here. It should probably throw an exception as well. Right now the code can generate a recall object (store it on the DB) and then explode because of the lack of the checkout. This also points to the need of a transaction.