From eccd2f5ff28fd76d8b1d34fcf9f1e48fb6c7d57f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 22 Apr 2015 19:11:30 +0200 Subject: [PATCH] =?utf8?q?Artikelstammdaten:=20als=20ung=C3=BCltig=20marki?= =?utf8?q?erte=20CVars=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn man einen Artikel hat und darin eine CVar als ungültig/nicht zutreffend markiert, so blieben bisher die Daten, die zu dieser CVar gehörten, in der Datenbank. Das sorgt zum Einen dafür, dass die Tabellen unnötig voller werden, zum Anderen geistern die Daten dann noch in $form herum (und damit auch in Druckvorlagen). Also entfernen. --- SL/IC.pm | 14 ++++++++++++++ ...lete_invalidated_custom_variables_for_parts.sql | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 sql/Pg-upgrade2/delete_invalidated_custom_variables_for_parts.sql diff --git a/SL/IC.pm b/SL/IC.pm index 2455d9e0e..da263bede 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -526,6 +526,20 @@ sub save { variables => $form, save_validity => 1); + # Delete saved custom variable values for configs that have been + # marked invalid for this part. + $query = <{id}) x 2); + # commit my $rc = $dbh->commit; diff --git a/sql/Pg-upgrade2/delete_invalidated_custom_variables_for_parts.sql b/sql/Pg-upgrade2/delete_invalidated_custom_variables_for_parts.sql new file mode 100644 index 000000000..a07d32675 --- /dev/null +++ b/sql/Pg-upgrade2/delete_invalidated_custom_variables_for_parts.sql @@ -0,0 +1,13 @@ +-- @tag: delete_invalidated_custom_variables_for_parts +-- @description: Bei Artikeln ungültig gesetzte, benutzerdefinierte Variablen löschen +-- @depends: release_3_2_0 +DELETE FROM custom_variables +WHERE (config_id IN ( + SELECT id + FROM custom_variable_configs + WHERE module = 'IC')) + AND EXISTS ( + SELECT val.id + FROM custom_variables_validity val + WHERE (val.config_id = custom_variables.config_id) + AND (val.trans_id = custom_variables.trans_id)); -- 2.20.1