1 package SL::DB::Manager::PurchaseInvoice;
 
   5 use parent qw(SL::DB::Helper::Manager);
 
   7 use SL::DB::Helper::Paginated;
 
   8 use SL::DB::Helper::Sorted;
 
  10 sub object_class { 'SL::DB::PurchaseInvoice' }
 
  12 __PACKAGE__->make_manager_methods;
 
  16   my $type  = lc(shift || '');
 
  18   return (or  => [ invoice => 0, invoice => undef                       ]) if $type eq 'ap_transaction';
 
  19   return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type =~ m/^(?:purchase_)?invoice$/;
 
  20   return (and => [ invoice => 1,         storno => 1                    ]) if $type =~ m/(?:invoice_)?storno/;
 
  22   die "Unknown type $type";
 
  27     default                   => [ 'transdate', 1 ],
 
  29       transaction_description => 'FIRST',
 
  30       vendor_name             => 'FIRST',
 
  35       vendor                  => 'lower(vendor.name)',
 
  36       globalprojectnumber     => 'lower(globalproject.projectnumber)',
 
  38       # Bug in Rose::DB::Object: the next should be
 
  39       # "globalproject.project_type.description". This workaround will
 
  40       # only work if no other table with "project_type" is visible in
 
  42       globalproject_type      => 'lower(project_type.description)',
 
  44       map { ( $_ => "lower(ap.$_)" ) } qw(invnumber ordnumber quonumber shipvia notes intnotes transaction_description),
 
  48 sub default_objects_per_page { 40 }