X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FRequirementSpecItem.pm;h=b74ebefd07e411711032679fec60a5b49a326e7b;hb=78078fbf7a94e349032c83ae324c87c94487e11a;hp=b7512928ed4ee38c83f405c40b344fb4688ea64f;hpb=7fc95c364c273bf11fff7cd5c263e74e0f234a73;p=kivitendo-erp.git diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index b7512928e..b74ebefd0 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -87,21 +87,21 @@ sub action_dragged_and_dropped { my $old_type = $self->item->item_type; my $new_type = !$dropped_item ? 'section' : $position =~ m/before|after/ ? $dropped_item->item_type : $dropped_item->child_type; - $self->item->db->do_transaction(sub { + $self->item->db->with_transaction(sub { $self->item->remove_from_list; $self->item->parent_id($position =~ m/before|after/ ? $dropped_item->parent_id : $dropped_item->id) if $dropped_item; $self->item->item_type($new_type); $self->item->add_to_list(position => $position, reference => $::form->{dropped_id} || undef); }); - $self->item(SL::DB::RequirementSpecItem->new(id => $self->item->id)->load); - my $new_section = $self->item->section; - my $new_visible_section = SL::DB::RequirementSpecItem->new(id => $self->visible_item->id)->load->section; - return $self->invalidate_version->render if !$old_visible_section || ($new_type eq 'section'); # From here on $old_visible_section is definitely set. + $self->item(SL::DB::RequirementSpecItem->new(id => $self->item->id)->load); + my $new_section = $self->item->section; + my $new_visible_section = SL::DB::RequirementSpecItem->new(id => $self->visible_item->id)->load->section; + my $old_parent = SL::DB::RequirementSpecItem->new(id => $old_parent_id)->load; my $old_section = $old_parent->section;