X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FOrder.pm;h=00886d67e8c4aa2d84666ddeac874c17231bbbbb;hb=f7e892266e58bd2a75de38b58feac85ed25747e8;hp=0c46f567373703caa85f634c35c24bd5cf9acd68;hpb=dd6282f6e20d531511ae35cadc491a8c7ab8bad5;p=kivitendo-erp.git diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 0c46f5673..00886d67e 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -27,7 +27,7 @@ __PACKAGE__->meta->add_relationship( } }, periodic_invoices_config => { - type => 'one to many', + type => 'one to one', class => 'SL::DB::PeriodicInvoicesConfig', column_map => { id => 'oe_id' }, }, @@ -37,8 +37,13 @@ __PACKAGE__->meta->initialize; # methods -sub items { goto &orderitems; } -sub payment_terms { goto &payment; } +sub items { goto &orderitems; } + +sub items_sorted { + my ($self) = @_; + + return [ sort {$a->id <=> $b->id } @{ $self->items } ]; +} sub type { my $self = shift; @@ -69,7 +74,7 @@ sub displayable_type { sub is_sales { croak 'not an accessor' if @_ > 1; - return shift->customer_id; + return !!shift->customer_id; } sub invoices { @@ -133,6 +138,10 @@ sub number { return $self->${ \ $number_method{$self->type} }(@_); } +sub date { + goto &transdate; +} + 1; __END__