X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FOrder.pm;h=0c46f567373703caa85f634c35c24bd5cf9acd68;hb=dd6282f6e20d531511ae35cadc491a8c7ab8bad5;hp=e28a87c7d22870ae40f6f4b5d970e6daf310fe16;hpb=2746ccd0d46d3b8f5105bad0ceeb00039da26764;p=kivitendo-erp.git diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index e28a87c7d..0c46f5673 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -27,47 +27,18 @@ __PACKAGE__->meta->add_relationship( } }, periodic_invoices_config => { - type => 'one to one', - class => 'SL::DB::PeriodicInvoicesConfig', - column_map => { id => 'oe_id' }, - }, - periodic_invoices => { type => 'one to many', - class => 'SL::DB::PeriodicInvoice', + class => 'SL::DB::PeriodicInvoicesConfig', 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; # methods -sub items { goto &orderitems; } +sub items { goto &orderitems; } +sub payment_terms { goto &payment; } sub type { my $self = shift; @@ -149,6 +120,19 @@ sub convert_to_invoice { return $invoice; } +sub number { + my $self = shift; + + my %number_method = ( + sales_order => 'ordnumber', + sales_quotation => 'quonumber', + purchase_order => 'ordnumber', + request_quotation => 'quonumber', + ); + + return $self->${ \ $number_method{$self->type} }(@_); +} + 1; __END__