Kundenstatistik: Typo und Formatierung
[kivitendo-erp.git] / SL / DB / GLTransaction.pm
index 67a4d3a..a92271f 100644 (file)
@@ -3,7 +3,8 @@ package SL::DB::GLTransaction;
 use strict;
 
 use SL::DB::MetaSetup::GLTransaction;
-
+use SL::Locale::String qw(t8);
+use List::Util qw(sum);
 
 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
 __PACKAGE__->meta->make_manager_class;
@@ -30,11 +31,22 @@ sub abbreviation {
   return $abbreviation;
 }
 
+sub displayable_type {
+  return t8('GL Transaction');
+}
+
+sub oneline_summary {
+  my ($self) = @_;
+  my $amount =  sum map { $_->amount if $_->amount > 0 } @{$self->transactions};
+  $amount = $::form->format_amount(\%::myconfig, $amount, 2);
+  return sprintf("%s: %s %s %s (%s)", $self->abbreviation, $self->description, $self->reference, $amount, $self->transdate->to_kivitendo);
+}
+
 sub link {
   my ($self) = @_;
 
   my $html;
-  $html   = SL::Presenter->get->gl_transaction($self, display => 'inline');
+  $html   = $self->presenter->gl_transaction(display => 'inline');
 
   return $html;
 }
@@ -43,4 +55,6 @@ sub invnumber {
   return $_[0]->reference;
 }
 
+sub date { goto &gldate }
+
 1;