From b823a51e7a8a88432152fa8e9aa2af140584a89d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 13 Nov 2023 15:59:19 +0000 Subject: [PATCH] Bug 30070: (follow-up) Return unless the related object exists Signed-off-by: Katrin Fischer --- Koha/Edifact/File.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Koha/Edifact/File.pm b/Koha/Edifact/File.pm index 8e9cea555c..2fd475221c 100644 --- a/Koha/Edifact/File.pm +++ b/Koha/Edifact/File.pm @@ -38,7 +38,8 @@ Returns the I associated with this edifact file sub vendor { my ($self) = @_; my $vendor_rs = $self->_result->vendor; - return Koha::Acquisition::Bookseller->_new_from_dbic( $vendor_rs ); + return unless $vendor_rs; + return Koha::Acquisition::Bookseller->_new_from_dbic($vendor_rs); } =head3 basket @@ -50,9 +51,10 @@ Returns the I associated with this edifact file. =cut sub basket { - my ( $self ) = @_; + my ($self) = @_; my $basket_rs = $self->_result->basketno; - return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs ); + return unless $basket_rs; + return Koha::Acquisition::Basket->_new_from_dbic($basket_rs); } =head3 to_api_mapping @@ -64,8 +66,8 @@ on the API. sub to_api_mapping { return { - message_type => 'type', - basketno => 'basket_id', + message_type => 'type', + basketno => 'basket_id', }; } -- 2.39.5