From: Moritz Bunkus Date: Tue, 7 Jan 2014 08:43:43 +0000 (+0100) Subject: Merge branch 'master' of github.com:kivitendo/kivitendo-erp X-Git-Tag: release-3.1.0beta1~22^2~33^2~3 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/b0be688fa50e3f92526fdc281a663b19e52f6753?hp=ad9b15c2da87c6ee98f0990b49c8dff0f09cf581 Merge branch 'master' of github.com:kivitendo/kivitendo-erp --- diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 7f7269923..72844b4db 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -7,6 +7,7 @@ use strict; use Carp; use List::Util qw(first); +use List::MoreUtils qw(pairwise); use SL::DB::MetaSetup::Invoice; use SL::DB::Manager::Invoice; @@ -15,6 +16,7 @@ use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::PriceTaxCalculator; use SL::DB::Helper::PriceUpdater; use SL::DB::Helper::TransNumberGenerator; +use SL::DB::CustomVariable; __PACKAGE__->meta->add_relationship( invoiceitems => { @@ -147,6 +149,14 @@ sub new_from { fxsellprice => $source_item->sellprice,); } @{ $source->items_sorted }; + my $i = 0; + foreach my $item (@items) { + my $source_cvars = $source->items_sorted->[$i]->cvars_by_config; + my $target_cvars = $item->cvars_by_config; + pairwise { $a->value($b->value) } @{ $target_cvars }, @{ $source_cvars }; + $i++; + } + $invoice->invoiceitems(\@items); return $invoice;