X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FInvoice.pm;h=6af70994b0ecf5428ef56c7e3957e2da3c31026d;hb=52e195fc889bd4bae6bae2a47c649363b2afd6cd;hp=502654ba262168fed42635a5b0581f6052757150;hpb=fa7fc7eeb3ca718914affee06c0629a08d571288;p=kivitendo-erp.git diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 502654ba2..6af70994b 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -17,6 +17,7 @@ use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::PriceTaxCalculator; use SL::DB::Helper::PriceUpdater; use SL::DB::Helper::TransNumberGenerator; +use SL::Locale::String qw(t8); __PACKAGE__->meta->add_relationship( invoiceitems => { @@ -63,6 +64,7 @@ sub _before_save_set_invnumber { # methods sub items { goto &invoiceitems; } +sub add_items { goto &add_invoiceitems; } sub items_sorted { my ($self) = @_; @@ -196,6 +198,7 @@ sub new_from { } @{ $items }; @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty}; + @items = grep { $_->qty >=0 } @items if $params{skip_items_negative_qty}; $invoice->invoiceitems(\@items); @@ -316,6 +319,26 @@ sub displayable_state { return $self->closed ? $::locale->text('closed') : $::locale->text('open'); } +sub displayable_type { + my ($self) = @_; + + return t8('AR Transaction') if $self->invoice_type eq 'ar_transaction'; + return t8('Credit Note') if $self->invoice_type eq 'credit_note'; + return t8('Invoice') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'invoice_storno'; + return t8('Credit Note') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'credit_note_storno'; + return t8('Invoice'); +} + +sub abbreviation { + my ($self) = @_; + + return t8('AR Transaction (abbreviation)') if $self->invoice_type eq 'ar_transaction'; + return t8('Credit note (one letter abbreviation)') if $self->invoice_type eq 'credit_note'; + return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'invoice_storno'; + return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'credit_note_storno'; + return t8('Invoice (one letter abbreviation)'); +} + sub date { goto &transdate; } @@ -364,6 +387,11 @@ missing then the method C will be called on C<$source>. This option can be used to override the sorting, to exclude certain positions or to add additional ones. +=item C + +If trueish then items with a negative quantity are skipped. Items with +a quantity of 0 are not affected by this option. + =item C If trueish then items with a quantity of 0 are skipped.