From: G. Richardson Date: Fri, 30 Jan 2015 06:22:59 +0000 (+0100) Subject: ar/ap/gl - neues Relationship "transactions" X-Git-Tag: release-3.2.0beta~6^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0395c0364adb8fde7442c6b11ab064e406fd7776;p=kivitendo-erp.git ar/ap/gl - neues Relationship "transactions" Objekt-Verknüpfung ar/ap/gl zu acc_trans-Objekten: one-to-many Hat man ein ar/ap/gl Objekt kann man sich jetzt alle acc_trans-Einträge dazu holen. Die acc_trans-Objekte werden nach acc_trans_id sortiert zurückgegeben. Die Methode transactions aus Invoice wurde entfernt. --- diff --git a/SL/DB/GLTransaction.pm b/SL/DB/GLTransaction.pm index 078e2b981..52c8b6e2e 100644 --- a/SL/DB/GLTransaction.pm +++ b/SL/DB/GLTransaction.pm @@ -4,11 +4,24 @@ use strict; use SL::DB::MetaSetup::GLTransaction; -__PACKAGE__->meta->initialize; # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. __PACKAGE__->meta->make_manager_class; +__PACKAGE__->meta->add_relationship( + 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; + sub abbreviation { my $self = shift; diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 7626793c2..08c580973 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; @@ -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__ diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index a54f1bd4c..d5955c57c 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -31,6 +31,13 @@ __PACKAGE__->meta->add_relationship( column_map => { id => 'trans_id' }, query_args => [ module => 'AP' ], }, + 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;