From 5bd7e74db1f425a8bbc43357e949efcc1d4eb135 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 7 Jan 2014 09:29:05 +0100 Subject: [PATCH] =?utf8?q?=C3=9Cberlagerte=20benutzerdefinierte=20Variable?= =?utf8?q?n=20werden=20in=20wiederkehrende=20Rechnungen=20nicht=20=C3=BCbe?= =?utf8?q?rnommen=20closes=20#2365?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Invoice.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; -- 2.20.1