From 8862bb1eb24c616d45d556c6022dff6e3afbf69c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 25 Nov 2014 14:13:25 +0100 Subject: [PATCH] Kunden/Lieferanten sind nicht verwaist, wenn es Lieferscheine gibt. --- SL/Controller/CustomerVendor.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index 3e6ad8217..ada9d0d15 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -637,7 +637,7 @@ sub is_orphaned { } my $arap = $self->is_vendor ? 'ap' : 'ar'; - my $num_args = 2; + my $num_args = 3; my $cv = $self->is_vendor ? 'vendor' : 'customer'; @@ -652,6 +652,13 @@ sub is_orphaned { SELECT a.id FROM oe a JOIN '. $cv .' ct ON (a.'. $cv .'_id = ct.id) + WHERE ct.id = ? + + UNION + + SELECT a.id + FROM delivery_orders a + JOIN '. $cv .' ct ON (a.'. $cv .'_id = ct.id) WHERE ct.id = ?'; -- 2.20.1