From aea2a0938cc8cc8755645ae9ba58934502d7bd8b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 21 Nov 2012 15:47:31 +0100 Subject: [PATCH] =?utf8?q?=C3=9Cberfl=C3=BCssiges=20Query=20vermeiden,=20w?= =?utf8?q?enn=20keine=20Zahlungsbedingungen=20ausgew=C3=A4hlt=20sind?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 9cc1065f5..45f37599c 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1970,7 +1970,7 @@ sub get_duedate { $reference_date = $reference_date ? conv_dateq($reference_date) . '::DATE' : 'current_date'; my $dbh = $self->get_standard_dbh($myconfig); - my $payment_id; + my ($payment_id, $duedate); if($self->{payment_id}) { $payment_id = $self->{payment_id}; @@ -1979,8 +1979,10 @@ sub get_duedate { ($payment_id) = selectrow_query($self, $dbh, $query, $self->{vendor_id}); } - my $query = qq|SELECT ${reference_date} + terms_netto FROM payment_terms WHERE id = ?|; - my ($duedate) = selectrow_query($self, $dbh, $query, $payment_id); + if ($payment_id) { + my $query = qq|SELECT ${reference_date} + terms_netto FROM payment_terms WHERE id = ?|; + ($duedate) = selectrow_query($self, $dbh, $query, $payment_id); + } $main::lxdebug->leave_sub(); -- 2.20.1