X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=SL%2FDB%2FRequirementSpec.pm;h=cd603aa6f1c4ef3f05d03eb65e3dc14b8be6d5f3;hb=d860b41d55abbf46fa8b94ec445aca3a2bb4e0d6;hp=235444047f64baf8ff3d14168457c7729c44c1f0;hpb=0c3193511e1ea50fad793887ede6ac5732d85074;p=kivitendo-erp.git diff --git a/SL/DB/RequirementSpec.pm b/SL/DB/RequirementSpec.pm index 235444047..cd603aa6f 100644 --- a/SL/DB/RequirementSpec.pm +++ b/SL/DB/RequirementSpec.pm @@ -171,9 +171,9 @@ sub _copy_from { my %paste_template_result; # Clone text blocks and pictures. - my $clone_picture = sub { - my ($picture) = @_; - my $cloned = Rose::DB::Object::Helpers::clone_and_reset($picture); + my $clone_and_reset_position = sub { + my ($src_obj) = @_; + my $cloned = Rose::DB::Object::Helpers::clone_and_reset($src_obj); $cloned->position(undef); return $cloned; }; @@ -182,7 +182,7 @@ sub _copy_from { my ($text_block) = @_; my $cloned = Rose::DB::Object::Helpers::clone_and_reset($text_block); $cloned->position(undef); - $cloned->pictures([ map { $clone_picture->($_) } @{ $text_block->pictures_sorted } ]); + $cloned->pictures([ map { $clone_and_reset_position->($_) } @{ $text_block->pictures_sorted } ]); return $cloned; }; @@ -194,6 +194,11 @@ sub _copy_from { $self->add_text_blocks($paste_template_result{text_blocks}); } + # Clone additional parts. + $paste_template_result{parts} = [ map { $clone_and_reset_position->($_) } @{ $source->parts } ]; + my $accessor = $params->{paste_template} ? "add_parts" : "parts"; + $self->$accessor($paste_template_result{parts}); + # Save new object -- we need its ID for the items. $self->save;