From 680c9d5c8ed0bd4101384ca1b89a9405b8c2c49e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 17 Feb 2015 13:13:43 +0100 Subject: [PATCH] Pflichtenhefte: CVars bei erfolglosem Speichern beibehalten --- SL/Controller/RequirementSpec.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index bd37a02ab..e249196d1 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -375,6 +375,13 @@ sub create_or_update { my $params = delete($::form->{requirement_spec}) || { }; my $cvars = delete($::form->{cvars}) || { }; + # Forcefully make it clear to Rose which custom_variables exist (or don't), so that the ones added with »add_custom_variables« are visible when calling »custom_variables«. + if ($is_new) { + $params->{custom_variables} = []; + } else { + $self->requirement_spec->custom_variables; + } + $self->requirement_spec->assign_attributes(%{ $params }); foreach my $var (@{ $self->requirement_spec->cvars_by_config }) { -- 2.20.1