From: Jan Büren Date: Mon, 9 Aug 2021 12:06:50 +0000 (+0200) Subject: Fix für redmine #483 X-Git-Tag: kivitendo-mebil_0.1-0~9^2~12 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=dc59476f1c3287836a90efdabb4d2bfdeeab22df;p=kivitendo-erp.git Fix für redmine #483 Falls es verwaiste abweichende Lieferadressen gibt, werden alle Benutzerdefinierten Variablen gelöscht. --- diff --git a/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql b/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql index ab1d1a4f5..d2f887b43 100644 --- a/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql +++ b/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql @@ -4,7 +4,7 @@ -- 1.6 Alle benutzerdefinierten Variablen löschen, für die es keine -- Einträge in shipto mehr gibt. -DELETE FROM custom_variables WHERE EXISTS +DELETE FROM custom_variables WHERE id IN (SELECT cv.id FROM custom_variables cv LEFT JOIN custom_variable_configs cvc ON (cv.config_id = cvc.id) WHERE module LIKE 'ShipTo' AND NOT EXISTS (SELECT shipto_id FROM shipto WHERE shipto_id = cv.trans_id));