1 package SL::DB::PurchaseInvoice;
 
   7 use SL::DB::MetaSetup::PurchaseInvoice;
 
   8 use SL::DB::Manager::PurchaseInvoice;
 
   9 use SL::DB::Helper::LinkedRecords;
 
  10 use SL::Locale::String qw(t8);
 
  12 # The calculator hasn't been adjusted for purchase invoices yet.
 
  13 # use SL::DB::Helper::PriceTaxCalculator;
 
  15 __PACKAGE__->meta->add_relationship(
 
  17     type         => 'one to many',
 
  18     class        => 'SL::DB::InvoiceItem',
 
  19     column_map   => { id => 'trans_id' },
 
  20     manager_args => { with_objects => [ 'part' ] }
 
  22   sepa_export_items => {
 
  23     type            => 'one to many',
 
  24     class           => 'SL::DB::SepaExportItem',
 
  25     column_map      => { id => 'ap_id' },
 
  26     manager_args    => { with_objects => [ 'sepa_export' ] }
 
  30     class           => 'SL::DB::Shipto',
 
  31     column_map      => { id => 'trans_id' },
 
  32     query_args      => [ module => 'AP' ],
 
  36 __PACKAGE__->meta->initialize;
 
  38 sub items { goto &invoiceitems; }
 
  39 sub add_items { goto &add_invoiceitems; }
 
  44   return [ sort {$a->id <=> $b->id } @{ $self->items } ];
 
  48   # For compatibility with Order, DeliveryOrder
 
  49   croak 'not an accessor' if @_ > 1;
 
  68   return t8('AP Transaction (abbreviation)') if !$self->invoice && !$self->storno;
 
  69   return t8('AP Transaction (abbreviation)') . '(' . t8('Storno (one letter abbreviation)') . ')' if !$self->invoice && $self->storno;
 
  70   return t8('Invoice (one letter abbreviation)'). '(' . t8('Storno (one letter abbreviation)') . ')' if $self->storno;
 
  71   return t8('Invoice (one letter abbreviation)');