From 97bace3a02fb9b2bf29c589580e6b7a184e583da Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 29 Jan 2013 11:56:15 +0000 Subject: [PATCH] Bug 9503 Correct name of parameter passed to parcel.pl invoiceid was being passed as invoice causing GetInvoiceDetails to silently fail and a system error downstream when accessing the 'orders' element of the undefined invoice Added an error message if GetInvoiceDetails called on undef --- C4/Acquisition.pm | 8 +++++--- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4a03e2c..249f10d 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2319,9 +2319,11 @@ Orders informations are in $invoice->{orders} (array ref) sub GetInvoiceDetails { my ($invoiceid) = @_; - my $invoice; - return unless $invoiceid; + if ( !defined $invoiceid ) { + carp 'GetInvoiceDetails called without an invoiceid'; + return; + } my $dbh = C4::Context->dbh; my $query = qq{ @@ -2333,7 +2335,7 @@ sub GetInvoiceDetails { my $sth = $dbh->prepare($query); $sth->execute($invoiceid); - $invoice = $sth->fetchrow_hashref; + my $invoice = $sth->fetchrow_hashref; $query = qq{ SELECT aqorders.*, biblio.* diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt index e10ec8f..94d1bc7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -91,7 +91,7 @@ [% END %] [% IF ( suggestions_loo.invoicenumber ) %] - [% suggestions_loo.invoicenumber %] + [% suggestions_loo.invoicenumber %] [% ELSE %]   [% END %] -- 1.8.1.1.347.g9591fcc