From: Moritz Bunkus Date: Fri, 19 Jul 2013 13:02:34 +0000 (+0200) Subject: Pflichtenhefte: Drag & Drop von Abschnitten fixen X-Git-Tag: release-3.2.0beta~467^2~101 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6bcd3c849d50f9df3b40031e2899b7e14c34875a;p=kivitendo-erp.git Pflichtenhefte: Drag & Drop von Abschnitten fixen --- diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index ce24e3138..0797a3ffd 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -84,11 +84,11 @@ sub action_dragged_and_dropped { my $old_visible_section = $self->visible_section ? $self->visible_section : undef; my $old_parent_id = $self->item->parent_id; my $old_type = $self->item->item_type; - my $new_type = $position =~ m/before|after/ ? $dropped_item->item_type : $dropped_item->child_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->remove_from_list; - $self->item->parent_id($position =~ m/before|after/ ? $dropped_item->parent_id : $dropped_item->id); + $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); });