Revision c96c4bb2
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/RequirementSpec.pm | ||
---|---|---|
133 | 133 |
$id_to_clone{ $item->id }->update_attributes(dependencies => [ map { $id_to_clone{$_->id} } @{ $item->dependencies } ]); |
134 | 134 |
} |
135 | 135 |
|
136 |
$self->update_attributes(%attributes); |
|
137 |
|
|
136 | 138 |
return $self; |
137 | 139 |
} |
138 | 140 |
|
141 |
sub delete_items { |
|
142 |
my ($self) = @_; |
|
143 |
|
|
144 |
my $worker = sub { |
|
145 |
# First convert all items to sections so that deleting won't |
|
146 |
# violate foreign key constraints on parent_id. |
|
147 |
SL::DB::Manager::RequirementSpecItem->update_all( |
|
148 |
set => { parent_id => undef, item_type => 'section' }, |
|
149 |
where => [ |
|
150 |
requirement_spec_id => $self->id, |
|
151 |
'!parent_id' => undef, |
|
152 |
]); |
|
153 |
|
|
154 |
# Now delete all items in one go. |
|
155 |
SL::DB::Manager::RequirementSpecItem->delete_all(where => [ requirement_spec_id => $self->id ]); |
|
156 |
|
|
157 |
# Last clear values in ourself. |
|
158 |
$self->items([]); |
|
159 |
}; |
|
160 |
|
|
161 |
return $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); |
|
162 |
} |
|
163 |
|
|
139 | 164 |
sub previous_version { |
140 | 165 |
my ($self) = @_; |
141 | 166 |
|
Auch abrufbar als: Unified diff
Pflichtenhefte auf Versionen zurücksetzen können