From: Moritz Bunkus Date: Wed, 12 Jan 2011 15:04:07 +0000 (+0100) Subject: Keine lokalen Variablennamen doppelt vergeben X-Git-Tag: release-2.6.3~61^2~7^2~1^2~2^2~89 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3bd03753e22635304bc6ffe385fc60b5229d8c6e;p=kivitendo-erp.git Keine lokalen Variablennamen doppelt vergeben --- diff --git a/SL/DB/Helper/LinkedRecords.pm b/SL/DB/Helper/LinkedRecords.pm index 8784811a7..1f91718bc 100644 --- a/SL/DB/Helper/LinkedRecords.pm +++ b/SL/DB/Helper/LinkedRecords.pm @@ -75,14 +75,14 @@ sub link_to_record { my @links; foreach my $direction (@directions) { - my %params = ( $direction->[0] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($self)), - $direction->[0] . "_id" => $self->id, - $direction->[1] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($other)), - $direction->[1] . "_id" => $other->id, - ); - - my $link = SL::DB::Manager::RecordLink->find_by(and => [ %params ]); - push @links, $link ? $link : SL::DB::RecordLink->new(%params)->save unless $link; + my %data = ( $direction->[0] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($self)), + $direction->[0] . "_id" => $self->id, + $direction->[1] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($other)), + $direction->[1] . "_id" => $other->id, + ); + + my $link = SL::DB::Manager::RecordLink->find_by(and => [ %data ]); + push @links, $link ? $link : SL::DB::RecordLink->new(%data)->save unless $link; } return wantarray ? @links : $links[0];