From 56ed64675501781efea751581d146d5bc49fad6a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 25 Jun 2008 08:33:31 +0000 Subject: [PATCH] =?utf8?q?Vermeiden,=20dass=20SQL-Fehlermeldungen=20angeze?= =?utf8?q?igt=20werden,=20wenn=20noch=20kein=20Kunde/Lieferant=20ausgew?= =?utf8?q?=C3=A4hlt=20wurden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index f45d9584e..59e01de07 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1897,6 +1897,12 @@ sub _get_contacts { $key = "all_contacts" unless ($key); + if (!$id) { + $self->{$key} = []; + $main::lxdebug->leave_sub(); + return; + } + my $query = qq|SELECT cp_id, cp_cv_id, cp_name, cp_givenname, cp_abteilung | . qq|FROM contacts | . @@ -1965,10 +1971,15 @@ sub _get_shipto { $key = "all_shipto" unless ($key); - # get shipping addresses - my $query = qq|SELECT * FROM shipto WHERE trans_id = ?|; + if ($vc_id) { + # get shipping addresses + my $query = qq|SELECT * FROM shipto WHERE trans_id = ?|; - $self->{$key} = selectall_hashref_query($self, $dbh, $query, $vc_id); + $self->{$key} = selectall_hashref_query($self, $dbh, $query, $vc_id); + + } else { + $self->{$key} = []; + } $main::lxdebug->leave_sub(); } -- 2.20.1