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> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
c91e02a4d6
commit
540626ef15
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue