X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0c3193511e1ea50fad793887ede6ac5732d85074..f6ed86e:/SL/DB/RequirementSpec.pm 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;