Bugzilla – Attachment 157418 Details for
Bug 35105
ILL - Saving 'Edit request' form with invalid Patron ID causes ILL table to not render
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35105: Fix patron accessor in Illrequest.pm
Bug-35105-Fix-patron-accessor-in-Illrequestpm.patch (text/plain), 2.01 KB, created by
Martin Renvoize (ashimema)
on 2023-10-19 10:56:43 UTC
(
hide
)
Description:
Bug 35105: Fix patron accessor in Illrequest.pm
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-10-19 10:56:43 UTC
Size:
2.01 KB
patch
obsolete
>From a9078fadeb219e436ea2dccdce3876902d331a13 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 19 Oct 2023 10:42:48 +0000 >Subject: [PATCH] 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> >--- > Koha/Illrequest.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index aa5e16b8baf..831d6fa52de 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -242,14 +242,17 @@ sub logs { > > my $patron = $request->patron; > >-Returns the linked I<Koha::Patron> object. >+For a given request, return the linked I<Koha::Patron> object >+associated with it, or undef if none exists > > =cut > > sub patron { > my ( $self ) = @_; > >- return Koha::Patron->_new_from_dbic( scalar $self->_result->patron ); >+ my $patron_rs = $self->_result->patron; >+ return unless $patron_rs; >+ return Koha::Patron->_new_from_dbic($patron_rs); > } > > =head3 library >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35105
:
157417
|
157418
|
157474
|
157475