From a5e4f9ca835489c2250db39f2c3abe6ac4ba04e6 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sun, 29 Jan 2017 15:34:02 +0100 Subject: [PATCH] Oneline summary for GLTransaction/Invoice/PurchaseInvoice to be used e.g. in Fibu Quicksearch --- SL/DB/GLTransaction.pm | 5 +++++ SL/DB/Invoice.pm | 6 ++++++ SL/DB/PurchaseInvoice.pm | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/SL/DB/GLTransaction.pm b/SL/DB/GLTransaction.pm index 67a4d3aca..3b9612e9e 100644 --- a/SL/DB/GLTransaction.pm +++ b/SL/DB/GLTransaction.pm @@ -30,6 +30,11 @@ sub abbreviation { return $abbreviation; } +sub oneline_summary { + my ($self) = @_; + return sprintf("%s: %s %s (%s)", $self->abbreviation, $self->description, $self->reference, $_->transdate->to_kivitendo); +} + sub link { my ($self) = @_; diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 0ef8d614e..4caafc0b0 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -555,6 +555,12 @@ sub abbreviation { return t8('Invoice (one letter abbreviation)'); } +sub oneline_summary { + my $self = shift; + + return sprintf("%s: %s %s (%s)", $self->abbreviation, $self->invnumber, $self->customer->name, $self->transdate->to_kivitendo); +} + sub date { goto &transdate; } diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index 08be07f33..102cd8a52 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -88,6 +88,12 @@ sub abbreviation { }; +sub oneline_summary { + my $self = shift; + + return sprintf("%s: %s %s (%s)", $self->abbreviation, $self->invnumber, $self->vendor->name, $self->transdate->to_kivitendo); +} + sub link { my ($self) = @_; -- 2.20.1