X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FOrderItem.pm;h=37520977bfc9ca486e049d91b269efb54083287d;hb=6f74e4e27fcc35d7fb8955fe0de3b4ae5687df2d;hp=7372f81a8d81642d4991ce5ff8773010ecc21861;hpb=b632cee8434442efd8ae3962126c34123172daac;p=kivitendo-erp.git diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm index 7372f81a8..37520977b 100644 --- a/SL/DB/OrderItem.pm +++ b/SL/DB/OrderItem.pm @@ -3,7 +3,6 @@ package SL::DB::OrderItem; use strict; use List::Util qw(sum); -use SL::AM; use SL::DB::MetaSetup::OrderItem; use SL::DB::Manager::OrderItem; @@ -11,13 +10,16 @@ use SL::DB::Helper::CustomVariables ( sub_module => 'orderitems', cvars_alias => 1, overloads => { - parts_id => 'SL::DB::Part', + parts_id => { + class => 'SL::DB::Part', + module => 'IC', + } }, ); __PACKAGE__->meta->add_relationship( unit_obj => { - type => 'one to one', + type => 'many to one', class => 'SL::DB::Unit', column_map => { unit => 'name' }, }, @@ -36,17 +38,8 @@ sub shipped_qty { my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); my @doi = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders; + require SL::AM; return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi); } -sub part { - # canonial alias for parts. - goto &parts; -} - -sub order { - # canonial alias for trans. - goto &trans; -} - 1;