X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/1e2673bbe853305facd6bf61d7bb45141250136d..a94080db277740fb7666781601a83ada92ff38c2:/SL/DB/Invoice.pm diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index ae1c596d6..e8b49c46f 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -45,6 +45,15 @@ __PACKAGE__->meta->add_relationship( column_map => { id => 'trans_id' }, query_args => [ module => 'AR' ], }, + transactions => { + type => 'one to many', + class => 'SL::DB::AccTransaction', + column_map => { id => 'trans_id' }, + manager_args => { + with_objects => [ 'chart' ], + sort_by => 'acc_trans_id ASC', + }, + }, ); __PACKAGE__->meta->initialize; @@ -69,7 +78,7 @@ sub add_items { goto &add_invoiceitems; } sub items_sorted { my ($self) = @_; - return [ sort {$a->id <=> $b->id } @{ $self->items } ]; + return [ sort {$a->position <=> $b->position } @{ $self->items } ]; } sub is_sales { @@ -187,7 +196,7 @@ sub new_from { SL::DB::InvoiceItem->new(map({ ( $_ => $source_item->$_ ) } qw(parts_id description qty sellprice discount project_id serialnumber pricegroup_id transdate cusordnumber unit - base_qty longdescription lastcost price_factor_id), @item_columns), + base_qty longdescription lastcost price_factor_id active_discount_source active_price_source), @item_columns), deliverydate => $source_item->reqdate, fxsellprice => $source_item->sellprice, custom_variables => \@custom_variables, @@ -351,15 +360,6 @@ sub customervendor { goto &customer; } -sub transactions { - my ($self) = @_; - - return unless $self->id; - - require SL::DB::AccTransaction; - SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $self->id ]); -} - 1; __END__