From 2bfb8a5019d8b97fbbe2efb83da959eb66f458f1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 17 Jan 2011 17:58:07 +0100 Subject: [PATCH] =?utf8?q?G=C3=BCltigkeit=20von=20custom=20variables=20nur?= =?utf8?q?=20f=C3=BCr=20Artikelstammdaten=20speichern?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix für Bug 1561. --- SL/CVar.pm | 11 +++++++---- SL/IC.pm | 9 +++++---- .../invalid_entries_in_custom_variables_validity.sql | 9 +++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql diff --git a/SL/CVar.pm b/SL/CVar.pm index 0de9a4bcf..779bfc325 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -338,10 +338,13 @@ sub save_custom_variables { do_statement($form, $sth, $query, @values); - my $valid_index = "$params{name_prefix}cvar_$config->{name}$params{name_postfix}_valid"; - $self->save_custom_variables_validity(trans_id => $params{trans_id}, config_id => $config->{id}, - validity => ($params{variables}{$valid_index} || $params{always_valid} ? 1 : 0) - ); + if ($params{save_validity}) { + my $valid_index = "$params{name_prefix}cvar_$config->{name}$params{name_postfix}_valid"; + $self->save_custom_variables_validity(trans_id => $params{trans_id}, + config_id => $config->{id}, + validity => ($params{variables}{$valid_index} || $params{always_valid} ? 1 : 0) + ); + } } $sth->finish(); diff --git a/SL/IC.pm b/SL/IC.pm index ac3d6f281..b6007d9dc 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -583,10 +583,11 @@ sub save { } } - CVar->save_custom_variables('dbh' => $dbh, - 'module' => 'IC', - 'trans_id' => $form->{id}, - 'variables' => $form); + CVar->save_custom_variables(dbh => $dbh, + module => 'IC', + trans_id => $form->{id}, + variables => $form, + save_validity => 1); # commit my $rc = $dbh->commit; diff --git a/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql b/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql new file mode 100644 index 000000000..62dd9447e --- /dev/null +++ b/sql/Pg-upgrade2/invalid_entries_in_custom_variables_validity.sql @@ -0,0 +1,9 @@ +-- @tag: invalid_entries_in_custom_variables_validity +-- @description: Ungültige Einträge in custom_variables_validity bereinigen +-- @depends: release_2_6_1 +-- @charset: utf-8 +DELETE FROM custom_variables_validity +WHERE trans_id NOT IN ( + SELECT id + FROM parts +); -- 2.20.1