X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/f63af42d0b025b20a5836dad9da6c07388b5da7a..7203ed2f94d9ac63e93097e05b19db4c5e557d25:/SL/DB/PurchaseInvoice.pm diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index fbb990329..d1eaded8f 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -9,6 +9,7 @@ use SL::DB::Manager::PurchaseInvoice; use SL::DB::Helper::AttrHTML; use SL::DB::Helper::AttrSorted; use SL::DB::Helper::LinkedRecords; +use SL::DB::Helper::Payment qw(:ALL); use SL::Locale::String qw(t8); # The calculator hasn't been adjusted for purchase invoices yet. @@ -49,6 +50,7 @@ __PACKAGE__->attr_sorted('items'); sub items { goto &invoiceitems; } sub add_items { goto &add_invoiceitems; } +sub record_number { goto &invnumber; }; sub is_sales { # For compatibility with Order, DeliveryOrder @@ -76,6 +78,34 @@ sub abbreviation { return t8('Invoice (one letter abbreviation)'). '(' . t8('Storno (one letter abbreviation)') . ')' if $self->storno; return t8('Invoice (one letter abbreviation)'); +}; + +sub link { + my ($self) = @_; + + my $html; + $html = SL::Presenter->get->purchase_invoice($self, display => 'inline') if $self->invoice; + $html = SL::Presenter->get->ap_transaction($self, display => 'inline') if !$self->invoice; + + return $html; +} + +sub invoice_type { + my ($self) = @_; + + return 'ap_transaction' if !$self->invoice; + return 'purchase_invoice'; } +sub displayable_type { + my ($self) = @_; + + return t8('AP Transaction') if $self->invoice_type eq 'ap_transaction'; + return t8('Purchase Invoice'); +} + +sub displayable_name { + join ' ', grep $_, map $_[0]->$_, qw(displayable_type record_number); +}; + 1;