| Summary: | A missing manager (51) failed my patron test | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
| Component: | Architecture, internals, and plumbing | Assignee: | Marcel de Rooy <m.de.rooy> |
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart, martin.renvoize, tomascohen |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34918 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
23.11.00,23.05.05,22.11.11
|
|
| Circulation function: | |||
| Bug Depends on: | |||
| Bug Blocks: | 34933 | ||
| Attachments: |
Bug 34932: Patron.t - Pass borrowernumber of manager to userenv
Bug 34932: Patron.t - Pass borrowernumber of manager to userenv |
||
|
Description
Marcel de Rooy
2023-09-27 12:44:40 UTC
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_myclone`.`accountlines`, CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE) at /usr/share/koha/Koha/Object.pm line 170
This line is the culprit:
$patron->account->pay({ amount => 10, debits => [ $debit ] });
The pay routine gets the manager from userenv. When there is no borrowernumber, Mocks returns 51. And when that does not exist, boom.
Created attachment 156287 [details] [review] Bug 34932: Patron.t - Pass borrowernumber of manager to userenv Test plan: Make sure that you do not have borrowr 51. Run t/db_dependent/Koha/Patron.t. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Trivial: Self SO Hum ok, certainly enough for now. Maybe we should remove the fallback and force a patron. It will help to catch missing userenv mocks. Created attachment 156328 [details] [review] Bug 34932: Patron.t - Pass borrowernumber of manager to userenv Test plan: Make sure that you do not have borrowr 51. Run t/db_dependent/Koha/Patron.t. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.05 Nice work everyone! Pushed to oldstable for 22.11.x |