Revision f766dfb7
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpecItem.pm | ||
---|---|---|
84 | 84 |
my $old_visible_section = $self->visible_section ? $self->visible_section : undef; |
85 | 85 |
my $old_parent_id = $self->item->parent_id; |
86 | 86 |
my $old_type = $self->item->item_type; |
87 |
my $new_type = $position =~ m/before|after/ ? $dropped_item->item_type : $dropped_item->child_type; |
|
87 | 88 |
|
88 | 89 |
$self->item->db->do_transaction(sub { |
89 | 90 |
$self->item->remove_from_list; |
90 | 91 |
$self->item->parent_id($position =~ m/before|after/ ? $dropped_item->parent_id : $dropped_item->id); |
92 |
$self->item->item_type($new_type); |
|
91 | 93 |
$self->item->add_to_list(position => $position, reference => $::form->{dropped_id} || undef); |
92 | 94 |
}); |
93 | 95 |
|
94 | 96 |
$self->item(SL::DB::RequirementSpecItem->new(id => $self->item->id)->load); |
95 | 97 |
my $new_section = $self->item->section; |
96 |
my $new_type = $self->item->item_type; |
|
97 | 98 |
my $new_visible_section = SL::DB::RequirementSpecItem->new(id => $self->visible_item->id)->load->section; |
98 | 99 |
|
99 | 100 |
return $self->invalidate_version->render($self) if !$old_visible_section || ($new_type eq 'section'); |
... | ... | |
103 | 104 |
my $old_parent = SL::DB::RequirementSpecItem->new(id => $old_parent_id)->load; |
104 | 105 |
my $old_section = $old_parent->section; |
105 | 106 |
|
107 |
# Section debug info: |
|
106 | 108 |
# $::lxdebug->message(0, "old sec ID " . $old_section->id . " new " . $new_section->id . " old visible " . $old_visible_section->id . " new visible " . $new_visible_section->id |
107 | 109 |
# . " PARENT: old " . $old_parent->id . " new " . $self->item->parent_id . '/' . $self->item->parent->id); |
108 | 110 |
|
111 |
# Item debug info: |
|
112 |
# $::lxdebug->message(0, 'item id: ' . $self->item->id . " new type: $new_type old type: $old_type #old children: " . scalar(@{ $old_parent->children })); |
|
113 |
|
|
109 | 114 |
if ($old_visible_section->id != $new_visible_section->id) { |
110 | 115 |
# The currently visible item has been dragged to a different section. |
111 | 116 |
$self->invalidate_version; |
Auch abrufbar als: Unified diff
Pflichtenhefte: requirement_spec_items.item_type nach Drag&Drop richtig setzen