X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/4440782f0737cd715dbd96851ecc2dbd8cd639f2..82515b2d93dc5632f24d6e0b6f8f05f3fd19fbb0:/SL/DB/Manager/Order.pm diff --git a/SL/DB/Manager/Order.pm b/SL/DB/Manager/Order.pm new file mode 100644 index 000000000..451a43aaf --- /dev/null +++ b/SL/DB/Manager/Order.pm @@ -0,0 +1,24 @@ +package SL::DB::Manager::Order; + +use strict; + +use SL::DB::Helpers::Manager; +use base qw(SL::DB::Helpers::Manager); + +sub object_class { 'SL::DB::Order' } + +__PACKAGE__->make_manager_methods; + +sub type_filter { + my $class = shift; + my $type = lc(shift || ''); + + return (and => [ '!customer_id' => undef, quotation => 1 ]) if $type eq 'sales_quotation'; + return (and => [ '!vendor_id' => undef, quotation => 1 ]) if $type eq 'request_quotation'; + return (and => [ '!customer_id' => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'sales_order'; + return (and => [ '!vendor_id' => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'purchase_order'; + + die "Unknown type $type"; +} + +1;