sellprice information test commit
[kivitendo-erp.git] / SL / DB / Manager / Order.pm
1 package SL::DB::Manager::Order;
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::Order' }
9
10 __PACKAGE__->make_manager_methods;
11
12 sub type_filter {
13   my $class  = shift;
14   my $type   = lc(shift || '');
15   my $prefix = shift || '';
16
17   return (and => [ "!${prefix}customer_id" => undef,         "${prefix}quotation" => 1                       ]) if $type eq 'sales_quotation';
18   return (and => [ "!${prefix}vendor_id"   => undef,         "${prefix}quotation" => 1                       ]) if $type eq 'request_quotation';
19   return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'sales_order';
20   return (and => [ "!${prefix}vendor_id"   => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'purchase_order';
21
22   die "Unknown type $type";
23 }
24
25 1;