Oneline summary for GLTransaction/Invoice/PurchaseInvoice
[kivitendo-erp.git] / SL / DB / GLTransaction.pm
1 package SL::DB::GLTransaction;
2
3 use strict;
4
5 use SL::DB::MetaSetup::GLTransaction;
6
7
8 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
9 __PACKAGE__->meta->make_manager_class;
10
11 __PACKAGE__->meta->add_relationship(
12   transactions   => {
13     type         => 'one to many',
14     class        => 'SL::DB::AccTransaction',
15     column_map   => { id => 'trans_id' },
16     manager_args => {
17       with_objects => [ 'chart' ],
18       sort_by      => 'acc_trans_id ASC',
19     },
20   },
21 );
22
23 __PACKAGE__->meta->initialize;
24
25 sub abbreviation {
26   my $self = shift;
27
28   my $abbreviation = $::locale->text('GL Transaction (abbreviation)');
29   $abbreviation   .= "(" . $::locale->text('Storno (one letter abbreviation)') . ")" if $self->storno;
30   return $abbreviation;
31 }
32
33 sub oneline_summary {
34   my ($self) = @_;
35   return sprintf("%s: %s %s (%s)", $self->abbreviation, $self->description, $self->reference, $_->transdate->to_kivitendo);
36 }
37
38 sub link {
39   my ($self) = @_;
40
41   my $html;
42   $html   = SL::Presenter->get->gl_transaction($self, display => 'inline');
43
44   return $html;
45 }
46
47 sub invnumber {
48   return $_[0]->reference;
49 }
50
51 1;