From: Moritz Bunkus Date: Mon, 17 Jan 2011 16:58:07 +0000 (+0100) Subject: Gültigkeit von custom variables nur für Artikelstammdaten speichern X-Git-Tag: release-2.6.2beta2~12 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2bfb8a5019d8b97fbbe2efb83da959eb66f458f1;p=kivitendo-erp.git Gültigkeit von custom variables nur für Artikelstammdaten speichern Fix für Bug 1561. --- 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 +);