From 1e58715fd5c5658374122145ef9185cf8fc28561 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 28 Sep 2022 20:33:26 -1000 Subject: [PATCH] Bug 31649: Fix acquisition basket CSV export if biblio does not exist Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 28b56098b548b9b198f5a1527714040eef337297) Signed-off-by: Lucas Gass (cherry picked from commit ace7e412a85576bd268bb5a6e7c1cc58c5715f4a) Signed-off-by: Arthur Suzuki --- C4/Acquisition.pm | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 83dda12425..544dfe3b48 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -322,20 +322,23 @@ sub GetBasketAsCSV { else { foreach my $order (@orders) { my $biblio = Koha::Biblios->find( $order->{biblionumber} ); - my $biblioitem = $biblio->biblioitem; + my $biblioitem; + if ($biblio) { + $biblioitem = $biblio->biblioitem; + } my $row = { - contractname => $contract->{'contractname'}, - ordernumber => $order->{'ordernumber'}, - entrydate => $order->{'entrydate'}, - isbn => $order->{'isbn'}, - author => $biblio->author, - title => $biblio->title, - publicationyear => $biblioitem->publicationyear, - publishercode => $biblioitem->publishercode, - collectiontitle => $biblioitem->collectiontitle, - notes => $order->{'order_vendornote'}, - quantity => $order->{'quantity'}, - rrp => $order->{'rrp'}, + contractname => $contract->{'contractname'}, + ordernumber => $order->{'ordernumber'}, + entrydate => $order->{'entrydate'}, + isbn => $order->{'isbn'}, + author => $biblio ? $biblio->author : q{}, + title => $biblio ? $biblio->title : q{}, + publicationyear => $biblioitem ? $biblioitem->publicationyear : q{}, + publishercode => $biblioitem ? $biblioitem->publishercode : q{}, + collectiontitle => $biblioitem ? $biblioitem->collectiontitle : q{}, + notes => $order->{'order_vendornote'}, + quantity => $order->{'quantity'}, + rrp => $order->{'rrp'}, }; for my $place ( qw( deliveryplace billingplace ) ) { if ( my $library = Koha::Libraries->find( $row->{deliveryplace} ) ) { -- 2.39.5