]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Controller/RequirementSpec.pm
Pflichtenhefte: CVars bei erfolglosem Speichern beibehalten
[kivitendo-erp.git] / SL / Controller / RequirementSpec.pm
index bd37a02ab7a63ea63797ff762ae00eaf3a1bfedb..e249196d19a9bb6cd64b5fb1c9ddaa402a2d3a97 100644 (file)
@@ -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 }) {