X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FCustomVariable.pm;h=cb6c83158bcba5d96720f0f5b794f4c52b26d936;hb=564b5410a5b4913215b53e659be6ee2a9cf259be;hp=26ff748f782d735d7a8a24af443dc0565d6690d4;hpb=49b00f2cc1d5fd7a536a9e30292f2eaec26ff825;p=kivitendo-erp.git diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index 26ff748f7..cb6c83158 100644 --- a/SL/DB/CustomVariable.pm +++ b/SL/DB/CustomVariable.pm @@ -124,8 +124,13 @@ sub is_valid { require SL::DB::CustomVariableValidity; - my $query = [config_id => $self->config_id, trans_id => $self->trans_id]; - return (SL::DB::Manager::CustomVariableValidity->get_all_count(query => $query) == 0) ? 1 : 0; + # only base level custom variables can be invalid. ovverloaded ones could potentially clash on trans_id, so disallow them + return 1 if $self->sub_module; + + $self->{is_valid} //= do { + my $query = [config_id => $self->config_id, trans_id => $self->trans_id]; + (SL::DB::Manager::CustomVariableValidity->get_all_count(query => $query) == 0) ? 1 : 0; + } } 1;