From 21436d8b965f90a61813aedba3caa40e9f8eaf80 Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Mon, 3 Jun 2013 15:14:31 +0200 Subject: [PATCH] CustomVariables-Helper registrieren von neu erstellen CVars MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit SL::DB::Helper::CustomVariables::cvars_by_config fügt neue CVars dem ursprünglichen Objekt hinzu. --- SL/DB/Helper/CustomVariables.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SL/DB/Helper/CustomVariables.pm b/SL/DB/Helper/CustomVariables.pm index df90aa73b..3c43624db 100644 --- a/SL/DB/Helper/CustomVariables.pm +++ b/SL/DB/Helper/CustomVariables.pm @@ -78,7 +78,19 @@ sub make_cvar_by_configs { my $cvars = $self->custom_variables; my %cvars_by_config = map { $_->config_id => $_ } @$cvars; - my @return = map { $cvars_by_config{$_->id} || _new_cvar($self, %params, config => $_) } @$configs; + my @return = map( + { + if ( $cvars_by_config{$_->id} ) { + $cvars_by_config{$_->id}; + } + else { + my $cvar = _new_cvar($self, %params, config => $_); + $self->add_custom_variables($cvar); + $cvar; + } + } + @$configs + ); return \@return; } -- 2.20.1