| Summary: | CheckReserves dies if itype doesn't exist | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Status: | Pushed to oldstable --- | QA Contact: | Marcel de Rooy <m.de.rooy> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | baptiste.wojtkowski, m.de.rooy, tomascohen |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| 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: |
25.11.00,25.05.01,24.11.07
|
|
| Circulation function: | |||
| Attachments: |
Bug 40034: Regression tests
Bug 40034: Only check notforloan on itemtype if it exists Bug 40034: Regression tests Bug 40034: Only check notforloan on itemtype if it exists Bug 40034: Regression tests Bug 40034: Only check notforloan on itemtype if it exists |
||
Created attachment 182908 [details] [review] Bug 40034: Regression tests Created attachment 182909 [details] [review] Bug 40034: Only check notforloan on itemtype if it exists This patch makes the code in `CheckReserves` survive the non-existence of the referenced item type in the `items` table for the passed item. To test: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/Reserves.t => FAIL: Tests explode like this: ``` Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870. ``` 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Created attachment 182913 [details] [review] Bug 40034: Regression tests Signed-off-by: David Nind <david@davidnind.com> Created attachment 182914 [details] [review] Bug 40034: Only check notforloan on itemtype if it exists This patch makes the code in `CheckReserves` survive the non-existence of the referenced item type in the `items` table for the passed item. To test: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/Reserves.t => FAIL: Tests explode like this: ``` Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870. ``` 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Created attachment 183042 [details] [review] Bug 40034: Regression tests Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 183043 [details] [review] Bug 40034: Only check notforloan on itemtype if it exists This patch makes the code in `CheckReserves` survive the non-existence of the referenced item type in the `items` table for the passed item. To test: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/Reserves.t => FAIL: Tests explode like this: ``` Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870. ``` 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x for 25.05.03 Pushed to 24.11.x for 24.11.07 |
Filing like this becauseI'm not sure how tackle this. I feel tempted to just propose making item types a real FK. In the meantime, this line explodes if the item type doesn't exist on the DB: ```perl if ($item_type) { return if Koha::ItemTypes->find($item_type)->notforloan; } ```