1 package SL::DB::PurchaseInvoice;
 
   7 use SL::DB::MetaSetup::PurchaseInvoice;
 
   8 use SL::DB::Manager::PurchaseInvoice;
 
   9 use SL::DB::Helper::LinkedRecords;
 
  10 # The calculator hasn't been adjusted for purchase invoices yet.
 
  11 # use SL::DB::Helper::PriceTaxCalculator;
 
  13 __PACKAGE__->meta->add_relationship(
 
  15     type         => 'one to many',
 
  16     class        => 'SL::DB::InvoiceItem',
 
  17     column_map   => { id => 'trans_id' },
 
  18     manager_args => { with_objects => [ 'part' ] }
 
  20   sepa_export_items => {
 
  21     type            => 'one to many',
 
  22     class           => 'SL::DB::SepaExportItem',
 
  23     column_map      => { id => 'ap_id' },
 
  24     manager_args    => { with_objects => [ 'sepa_export' ] }
 
  28 __PACKAGE__->meta->initialize;
 
  30 sub items { goto &invoiceitems; }
 
  35   my @sorted =  sort {$a->id <=> $b->id } @{ $self->items };
 
  36   return wantarray ? @sorted : \@sorted;
 
  40   # For compatibility with Order, DeliveryOrder
 
  41   croak 'not an accessor' if @_ > 1;