Revision 0395c036
Von Kivitendo Admin vor etwa 10 Jahren hinzugefügt
SL/DB/GLTransaction.pm | ||
---|---|---|
|
||
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;
|
||
|
SL/DB/Invoice.pm | ||
---|---|---|
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;
|
||
... | ... | |
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__
|
SL/DB/PurchaseInvoice.pm | ||
---|---|---|
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;
|
Auch abrufbar als: Unified diff
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.