From 4a9ea1c6328899a4c36c4ed6ac6f51d948f22230 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 Signed-off-by: Galen Charlton Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- C4/Acquisition.pm | 8 +++++--- .../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 4a03e2c2a4..249f10dd7f 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 e10ec8f7f5..94d1bc7ca9 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 %] -- 2.39.5