To reproduce, k-t-d: 1) Install FreeForm and enable ILLmodule, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Visit /cgi-bin/koha/ill/ill-requests.pl 3) Create 'New ILL request' 4) Select the request type, input cardnumber '42' and select a library 5) Hit 'Create' 6) Manage the request created just now: click the request id or 'manage request' button from the table 7) Click "Edit request" from the top actions toolbar 8a) Input text in Patron ID e.g. 'asdasdasf'. Notice you get redirected to the table - that doesn't render - with an error. 8b) Input a patron id that doesn't exist e.g. '987654'. Notice you get an error upon saving "FK Constraint error"
Created attachment 157417 [details] [review] Bug 35105: Fix patron accessor in Illrequest.pm Patron is nullable, so we need to consider undef return Test plan, k-t-d: 1) Install FreeForm and enable ILLmodule, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Visit /cgi-bin/koha/ill/ill-requests.pl 3) Create 'New ILL request' 4) Select the request type, input cardnumber '42' and select a library 5) Hit 'Create' 6) Manage the request created just now: click the request id or 'manage request' button from the table 7) Click "Edit request" from the top actions toolbar 8a) Input text in Patron ID e.g. 'asdasdasf'. Notice you get redirected to the table - now renders correctly. 8b) Input a patron id that doesn't exist e.g. '987654'. Notice you get an error upon saving "FK Constraint error", go back to the table and verify it renders correctly. In both instances, the request is saved with borrowernumber as NULL, this was preventing the table from rendering because the 'patron' API embed was trying to retrieve a patron - getting an empty resultset instead of undef.
Created attachment 157418 [details] [review] Bug 35105: Fix patron accessor in Illrequest.pm Patron is nullable, so we need to consider undef return Test plan, k-t-d: 1) Install FreeForm and enable ILLmodule, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Visit /cgi-bin/koha/ill/ill-requests.pl 3) Create 'New ILL request' 4) Select the request type, input cardnumber '42' and select a library 5) Hit 'Create' 6) Manage the request created just now: click the request id or 'manage request' button from the table 7) Click "Edit request" from the top actions toolbar 8a) Input text in Patron ID e.g. 'asdasdasf'. Notice you get redirected to the table - now renders correctly. 8b) Input a patron id that doesn't exist e.g. '987654'. Notice you get an error upon saving "FK Constraint error", go back to the table and verify it renders correctly. In both instances, the request is saved with borrowernumber as NULL, this was preventing the table from rendering because the 'patron' API embed was trying to retrieve a patron - getting an empty resultset instead of undef. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Fast QA of this trivial patch.. all working perfectly and following prior art. Passing QA
I setting this as rel 23.05 and 22.11 candidates as this bug is actually a follow-up of bug 22440. Still requires bug 35094 (not backportable to those releases) to test on current master.
Updated bug title to better reflect the issue being fixed here: we're fixing the table not rendering, not the explosion that happens upon inserting invalid data, that is fixed in bug 35106.
Created attachment 157474 [details] [review] Bug 35105: Regression tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 157475 [details] [review] Bug 35105: Fix patron accessor in Illrequest.pm Patron is nullable, so we need to consider undef return Test plan, k-t-d: 1) Install FreeForm and enable ILLmodule, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Visit /cgi-bin/koha/ill/ill-requests.pl 3) Create 'New ILL request' 4) Select the request type, input cardnumber '42' and select a library 5) Hit 'Create' 6) Manage the request created just now: click the request id or 'manage request' button from the table 7) Click "Edit request" from the top actions toolbar 8a) Input text in Patron ID e.g. 'asdasdasf'. Notice you get redirected to the table - now renders correctly. 8b) Input a patron id that doesn't exist e.g. '987654'. Notice you get an error upon saving "FK Constraint error", go back to the table and verify it renders correctly. In both instances, the request is saved with borrowernumber as NULL, this was preventing the table from rendering because the 'patron' API embed was trying to retrieve a patron - getting an empty resultset instead of undef. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.05
Dependency missing for 22.11.x - not backporting
Ignore previous comment - backported to 22.11.x