From: Moritz Bunkus Date: Wed, 21 Nov 2012 14:47:31 +0000 (+0100) Subject: Überflüssiges Query vermeiden, wenn keine Zahlungsbedingungen ausgewählt sind X-Git-Tag: release-3.0.0beta2~10^2~4^2~3 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=aea2a0938cc8cc8755645ae9ba58934502d7bd8b;p=kivitendo-erp.git Überflüssiges Query vermeiden, wenn keine Zahlungsbedingungen ausgewählt sind --- 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();