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 <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
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{
my $sth = $dbh->prepare($query);
$sth->execute($invoiceid);
- $invoice = $sth->fetchrow_hashref;
+ my $invoice = $sth->fetchrow_hashref;
$query = qq{
SELECT aqorders.*, biblio.*
[% END %]
</td>
<td>[% IF ( suggestions_loo.invoicenumber ) %]
- <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% suggestions_loo.invoicenumber %]&booksellerid=[% suggestions_loo.id %]&datereceived=[% suggestions_loo.datereceived %]">[% suggestions_loo.invoicenumber %]</a>
+ <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% suggestions_loo.invoicenumber %]&booksellerid=[% suggestions_loo.id %]&datereceived=[% suggestions_loo.datereceived %]">[% suggestions_loo.invoicenumber %]</a>
[% ELSE %]
[% END %]