From 3757b1669a9ed18f04a84da8cf31b800107c7268 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 6 Jan 2017 12:21:56 +0100 Subject: [PATCH] Bug 17736: [QA Follow-up] Crashes in basket.pl and parcel.pl Content-Type: text/plain; charset=utf-8 Crash in basket.pl: Can't call method "holds" on an undefined value at /usr/share/koha/masterclone/acqui/basket.pl line 466. Comes from a biblionumber == NULL in aqorders where I cancelled the order and deleted the biblio. Crash in parcel.pl: Can't call method "holds" on an undefined value at /usr/share/koha/masterclone/acqui/parcel.pl line 246. Similar fix. Trivial fixes indeed. Signed-off-by: Marcel de Rooy --- acqui/basket.pl | 2 +- acqui/parcel.pl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 31b96bb..db24721 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -463,7 +463,7 @@ sub get_order_infos { my $ordernumber = $order->{'ordernumber'}; my @subscriptions = GetSubscriptionsId ($biblionumber); my $itemcount = GetItemsCount($biblionumber); - my $holds_count = $biblio->holds->count; + my $holds_count = $biblio ? $biblio->holds->count : 0; my @items = GetItemnumbersFromOrder( $ordernumber ); my $itemholds; foreach my $item (@items){ diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 97943a3..3bd586c 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -141,11 +141,11 @@ for my $order ( @orders ) { $line{holds} = 0; my @itemnumbers = GetItemnumbersFromOrder( $order->{ordernumber} ); my $biblio = Koha::Biblios->find( $line{biblionumber} ); - $line{holds} = $biblio->current_holds->search( + $line{holds} = $biblio ? $biblio->current_holds->search( { itemnumber => { -in => \@itemnumbers }, } - )->count; + )->count : 0; $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} ); $line{tax_value} = $line{tax_value_on_receiving}; @@ -243,7 +243,7 @@ unless( defined $invoice->{closedate} ) { my $ordernumber = $line{'ordernumber'}; my @subscriptions = GetSubscriptionsId ($biblionumber); my $itemcount = GetItemsCount($biblionumber); - my $holds_count = $biblio->holds->count; + my $holds_count = $biblio ? $biblio->holds->count : 0; my @items = GetItemnumbersFromOrder( $ordernumber ); my $itemholds; foreach my $item (@items){ -- 2.1.4