X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FRequirementSpec.pm;h=0ad61aa69390667483ae5e9bd5614e6eedd5c1c2;hb=3bbe01f72076071001aee77c1c8b9bce00c6d7c2;hp=cd1c837f6f0d1461ea044cc4c352cbdf8953d37a;hpb=50aabb483692039941096440a354d77b49ce0236;p=kivitendo-erp.git diff --git a/SL/DB/RequirementSpec.pm b/SL/DB/RequirementSpec.pm index cd1c837f6..0ad61aa69 100644 --- a/SL/DB/RequirementSpec.pm +++ b/SL/DB/RequirementSpec.pm @@ -27,6 +27,11 @@ __PACKAGE__->meta->add_relationship( class => 'SL::DB::RequirementSpec', column_map => { id => 'working_copy_id' }, }, + orders => { + type => 'one to many', + class => 'SL::DB::RequirementSpecOrder', + column_map => { id => 'requirement_spec_id' }, + }, ); __PACKAGE__->meta->initialize; @@ -71,6 +76,13 @@ sub sections_sorted { sub sections { §ions_sorted; } +sub orders_sorted { + my ($self, %params) = _hashify(1, @_); + my $by = $params{by} || 'itime'; + + return [ sort { $a->$by cmp $b->$by } @{ $self->orders } ]; +} + sub displayable_name { my ($self) = @_; @@ -153,6 +165,7 @@ sub _copy_from { my $cloned = Rose::DB::Object::Helpers::clone_and_reset($item); $cloned->requirement_spec_id($self->id); $cloned->position(undef); + $cloned->fb_number(undef) if $params->{paste_template}; $cloned->children(map { $clone_item->($_) } @{ $item->children }); $id_to_clone{ $item->id } = $cloned;