X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FRequirementSpec.pm;h=3fa13c0f50e1544499544298dbb81dbaa564830a;hb=aaa2cd9291719d6a8f327606fc5aeeeb172b7ecb;hp=f99e0bf4db28f6ee7cec5e8a03d4d4edb2104900;hpb=2015b4b39c078152726dfd57215f602e4a4ce668;p=kivitendo-erp.git diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index f99e0bf4d..3fa13c0f5 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -120,11 +120,14 @@ sub action_ajax_edit_time_and_cost_estimate { my ($self) = @_; my $html = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 }); + my $first = ($self->requirement_spec->sections_sorted || [])->[0]; + $first = ($first->children_sorted || [])->[0] if $first; $self->js ->hide('#time_cost_estimate') ->after('#time_cost_estimate', $html) ->on('#time_cost_estimate INPUT[type=text]', 'keydown', 'kivi.requirement_spec.time_cost_estimate_input_key_down') + ->action_if($first && $first->id, 'focus', '#time_and_cost_estimate_form_complexity_id_' . $first->id) ->render($self); } @@ -146,9 +149,12 @@ sub action_ajax_save_time_and_cost_estimate { $self->requirement_spec(SL::DB::RequirementSpec->new(id => $self->requirement_spec->id)->load); - my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 }); - $self->js->replaceWith('#time_cost_estimate', $html) - ->remove('#time_cost_estimate_form_container'); + my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 }, initially_hidden => !!$::form->{keep_open}); + $self->js->replaceWith('#time_cost_estimate', $html); + + return $self->js->render($self) if $::form->{keep_open}; + + $self->js->remove('#time_cost_estimate_form_container'); if ($self->visible_section) { $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->visible_section);