$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};
($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();