Revision 59d0eec3
Von Sven Schöling vor fast 8 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
18 | 18 |
use SL::DB::Helper::TransNumberGenerator; |
19 | 19 |
use SL::Locale::String qw(t8); |
20 | 20 |
use SL::DB::CustomVariable; |
21 |
use SL::Presenter::Invoice; |
|
21 | 22 |
|
22 | 23 |
__PACKAGE__->meta->add_relationship( |
23 | 24 |
invoiceitems => { |
... | ... | |
525 | 526 |
return 'invoice'; |
526 | 527 |
} |
527 | 528 |
|
528 |
sub displayable_state { |
|
529 |
my $self = shift; |
|
530 |
|
|
531 |
return $self->closed ? $::locale->text('closed') : $::locale->text('open'); |
|
532 |
} |
|
533 |
|
|
534 |
sub displayable_type { |
|
535 |
my ($self) = @_; |
|
536 |
|
|
537 |
return t8('AR Transaction') if $self->invoice_type eq 'ar_transaction'; |
|
538 |
return t8('Credit Note') if $self->invoice_type eq 'credit_note'; |
|
539 |
return t8('Invoice') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'invoice_storno'; |
|
540 |
return t8('Credit Note') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'credit_note_storno'; |
|
541 |
return t8('Invoice'); |
|
542 |
} |
|
543 |
|
|
544 |
sub displayable_name { |
|
545 |
join ' ', grep $_, map $_[0]->$_, qw(displayable_type record_number); |
|
546 |
}; |
|
547 |
|
|
548 |
sub abbreviation { |
|
549 |
my ($self) = @_; |
|
550 |
|
|
551 |
return t8('AR Transaction (abbreviation)') if $self->invoice_type eq 'ar_transaction'; |
|
552 |
return t8('Credit note (one letter abbreviation)') if $self->invoice_type eq 'credit_note'; |
|
553 |
return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'invoice_storno'; |
|
554 |
return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'credit_note_storno'; |
|
555 |
return t8('Invoice (one letter abbreviation)'); |
|
556 |
} |
|
557 |
|
|
558 |
sub oneline_summary { |
|
559 |
my $self = shift; |
|
560 |
|
|
561 |
return sprintf("%s: %s %s %s (%s)", $self->abbreviation, $self->invnumber, $self->customer->name, |
|
562 |
$::form->format_amount(\%::myconfig, $self->amount,2), $self->transdate->to_kivitendo); |
|
563 |
} |
|
564 |
|
|
565 | 529 |
sub date { |
566 | 530 |
goto &transdate; |
567 | 531 |
} |
... | ... | |
574 | 538 |
goto &customer; |
575 | 539 |
} |
576 | 540 |
|
577 |
sub url_link { |
|
578 |
return ($_[0]->invoice ? "is" : "ar") . '.pl?action=edit&type=invoice&id=' . $_[0]->id; |
|
579 |
} |
|
580 |
|
|
581 |
sub link { |
|
582 |
my ($self) = @_; |
|
583 |
|
|
584 |
return SL::Presenter->get->invoice($self, display => 'inline'); |
|
585 |
} |
|
541 |
sub abbreviation { $_[0]->presenter->abbreviation } |
|
542 |
sub displayable_name { $_[0]->presenter->id } |
|
543 |
sub displayable_state { $_[0]->presenter->state } |
|
544 |
sub displayable_type { $_[0]->presenter->type } |
|
545 |
sub link { $_[0]->presenter->link_tag; } |
|
546 |
sub oneline_summary { $_[0]->presenter->gist } |
|
547 |
sub url_link { $_[0]->presenter->url } |
|
586 | 548 |
|
587 | 549 |
sub mark_as_paid { |
588 | 550 |
my ($self) = @_; |
Auch abrufbar als: Unified diff
neue Presenter Infrastruktur
Testweise implementiert für Invoice/PurchaseInvoice/GLTransaction