X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FOrder.pm;h=f4ca003a2d6cd61da17a5a3c30f7e08ccd3f0b93;hb=56b91fb4030432fde4159c11a0ca97a7571535f3;hp=8212a647e6bf3fd992b909c2a1d651ffcdddd9b1;hpb=67079598f8f98a12e12a8acddc3afbf12bb58c5d;p=kivitendo-erp.git diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 8212a647e..f4ca003a2 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -31,36 +31,6 @@ __PACKAGE__->meta->add_relationship( class => 'SL::DB::PeriodicInvoicesConfig', column_map => { id => 'oe_id' }, }, - periodic_invoices => { - type => 'one to many', - class => 'SL::DB::PeriodicInvoice', - column_map => { id => 'oe_id' }, - }, - payment_term => { - type => 'one to one', - class => 'SL::DB::PaymentTerm', - column_map => { payment_id => 'id' }, - }, - contact => { - type => 'one to one', - class => 'SL::DB::Contact', - column_map => { cp_id => 'cp_id' }, - }, - shipto => { - type => 'one to one', - class => 'SL::DB::Shipto', - column_map => { shipto_id => 'shipto_id' }, - }, - department => { - type => 'one to one', - class => 'SL::DB::Department', - column_map => { department_id => 'id' }, - }, - language => { - type => 'one to one', - class => 'SL::DB::Language', - column_map => { language_id => 'id' }, - }, ); __PACKAGE__->meta->initialize; @@ -69,6 +39,13 @@ __PACKAGE__->meta->initialize; sub items { goto &orderitems; } +sub items_sorted { + my ($self) = @_; + + my @sorted = sort {$a->id <=> $b->id } @{ $self->items }; + return wantarray ? @sorted : \@sorted; +} + sub type { my $self = shift; @@ -98,7 +75,7 @@ sub displayable_type { sub is_sales { croak 'not an accessor' if @_ > 1; - return shift->customer_id; + return !!shift->customer_id; } sub invoices { @@ -155,13 +132,17 @@ sub number { my %number_method = ( sales_order => 'ordnumber', sales_quotation => 'quonumber', - puchase_order => 'ordnumber', + purchase_order => 'ordnumber', request_quotation => 'quonumber', ); return $self->${ \ $number_method{$self->type} }(@_); } +sub date { + goto &transdate; +} + 1; __END__