From 36417312eb85236c5375994209cda50a01d0c2a2 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 28 Sep 2022 20:42:57 -1000 Subject: [PATCH] Bug 31649: Fix acquisition basket group 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 8d933d482ab30efdacb239dfd0af8944f1b6db9f) Signed-off-by: Lucas Gass --- C4/Acquisition.pm | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 674950baee..abec8f108c 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -395,30 +395,33 @@ sub GetBasketGroupAsCSV { foreach my $order (@orders) { my $biblio = Koha::Biblios->find( $order->{biblionumber} ); - my $biblioitem = $biblio->biblioitem; + my $biblioitem; + if ($biblio) { + $biblioitem = $biblio->biblioitem; + } my $row = { - clientnumber => $bookseller->accountnumber, - basketname => $basket->{basketname}, - ordernumber => $order->{ordernumber}, - author => $biblio->author, - title => $biblio->title, - publishercode => $biblioitem->publishercode, - publicationyear => $biblioitem->publicationyear, - collectiontitle => $biblioitem->collectiontitle, - isbn => $order->{isbn}, - quantity => $order->{quantity}, - rrp_tax_included => $order->{rrp_tax_included}, - rrp_tax_excluded => $order->{rrp_tax_excluded}, - discount => $bookseller->discount, + clientnumber => $bookseller->accountnumber, + basketname => $basket->{basketname}, + ordernumber => $order->{ordernumber}, + author => $biblio ? $biblio->author : q{}, + title => $biblio ? $biblio->title : q{}, + publishercode => $biblioitem ? $biblioitem->publishercode : q{}, + publicationyear => $biblioitem ? $biblioitem->publicationyear : q{}, + collectiontitle => $biblioitem ? $biblioitem->collectiontitle : q{}, + isbn => $order->{isbn}, + quantity => $order->{quantity}, + rrp_tax_included => $order->{rrp_tax_included}, + rrp_tax_excluded => $order->{rrp_tax_excluded}, + discount => $bookseller->discount, ecost_tax_included => $order->{ecost_tax_included}, ecost_tax_excluded => $order->{ecost_tax_excluded}, - notes => $order->{order_vendornote}, - entrydate => $order->{entrydate}, - booksellername => $bookseller->name, - bookselleraddress => $bookseller->address1, - booksellerpostal => $bookseller->postal, - contractnumber => $contract->{contractnumber}, - contractname => $contract->{contractname}, + notes => $order->{order_vendornote}, + entrydate => $order->{entrydate}, + booksellername => $bookseller->name, + bookselleraddress => $bookseller->address1, + booksellerpostal => $bookseller->postal, + contractnumber => $contract->{contractnumber}, + contractname => $contract->{contractname}, }; my $temp = { basketgroupdeliveryplace => $basketgroup->{deliveryplace}, -- 2.39.5