1cc5737957fc5c25e18dcf6c45b0ac749c1f456e
[kivitendo-erp.git] / SL / DB / Manager / PurchaseInvoice.pm
1 package SL::DB::Manager::PurchaseInvoice;
2
3 use strict;
4
5 use SL::DB::Helper::Manager;
6 use base qw(SL::DB::Helper::Manager);
7
8 sub object_class { 'SL::DB::PurchaseInvoice' }
9
10 __PACKAGE__->make_manager_methods;
11
12 sub type_filter {
13   my $class = shift;
14   my $type  = lc(shift || '');
15
16   return (or  => [ invoice => 0, invoice => undef                       ]) if $type eq 'ap_transaction';
17   return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
18   return (and => [ invoice => 1,         storno => 1                    ]) if $type =~ m/(?:invoice_)?storno/;
19
20   die "Unknown type $type";
21 }
22
23 1;