Projekt

Allgemein

Profil

Herunterladen (915 Bytes) Statistiken
| Zweig: | Markierung: | Revision:
82515b2d Sven Schöling
package SL::DB::Manager::Order;

use strict;

ac552280 Moritz Bunkus
use SL::DB::Helper::Manager;
use base qw(SL::DB::Helper::Manager);
82515b2d Sven Schöling
sub object_class { 'SL::DB::Order' }

__PACKAGE__->make_manager_methods;

sub type_filter {
ba0fb69c Sven Schöling
my $class = shift;
my $type = lc(shift || '');
my $prefix = shift || '';

return (and => [ "!${prefix}customer_id" => undef, "${prefix}quotation" => 1 ]) if $type eq 'sales_quotation';
return (and => [ "!${prefix}vendor_id" => undef, "${prefix}quotation" => 1 ]) if $type eq 'request_quotation';
return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'sales_order';
return (and => [ "!${prefix}vendor_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'purchase_order';
82515b2d Sven Schöling
die "Unknown type $type";
}

1;