X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDB%2FInvoice.pm;h=c824624514041b16b2eb52e6f345aa9ff15bba09;hb=f72a365d3988ad682f853764fdbfb39aa92ac089;hp=753ca3c5a88ffcd3e2a7a25f39d7e1656fa2ae0e;hpb=90e59318411f63c95a7e803b4383d75ec72427a8;p=kivitendo-erp.git diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 753ca3c5a..c82462451 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -60,6 +60,12 @@ __PACKAGE__->meta->add_relationship( sort_by => 'acc_trans_id ASC', }, }, + dunnings => { + type => 'one to many', + class => 'SL::DB::Dunning', + column_map => { id => 'trans_id' }, + manager_args => { with_objects => [ 'dunnings' ] } + }, ); __PACKAGE__->meta->initialize; @@ -165,7 +171,6 @@ sub new_from { $terms = $source->customer->payment_terms if !defined $terms && $source->customer; my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id - shipto_id cp_id language_id taxzone_id globalproject_id transaction_description currency_id delivery_term_id), @columns), transdate => DateTime->today_local, gldate => DateTime->today_local, @@ -556,6 +561,13 @@ sub abbreviation { return t8('Invoice (one letter abbreviation)'); } +sub oneline_summary { + my $self = shift; + + return sprintf("%s: %s %s %s (%s)", $self->abbreviation, $self->invnumber, $self->customer->name, + $::form->format_amount(\%::myconfig, $self->amount,2), $self->transdate->to_kivitendo); +} + sub date { goto &transdate; } @@ -572,12 +584,18 @@ sub link { my ($self) = @_; my $html; - $html = SL::Presenter->get->sales_invoice($self, display => 'inline') if $self->invoice; - $html = SL::Presenter->get->ar_transaction($self, display => 'inline') if !$self->invoice; + $html = $self->presenter->sales_invoice(display => 'inline') if $self->invoice; + $html = $self->presenter->ar_transaction(display => 'inline') if !$self->invoice; return $html; } +sub mark_as_paid { + my ($self) = @_; + + $self->update_attributes(paid => $self->amount); +} + 1; __END__ @@ -761,6 +779,10 @@ Mandatory params are =back +=item C + +Marks the invoice as paid by setting its C member to the value of C. + =back =head1 TODO