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; } ```
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