kivitendo/SL/DB/Manager/DeliveryOrder.pm @ 45ea642b
82515b2d | Sven Schöling | package SL::DB::Manager::DeliveryOrder;
|
||
use strict;
|
||||
168836cf | Moritz Bunkus | use parent qw(SL::DB::Helper::Manager);
|
||
use SL::DB::Helper::Paginated;
|
||||
use SL::DB::Helper::Sorted;
|
||||
0c227fb2 | Moritz Bunkus | use SL::DB::Helper::Filtered;
|
||
82515b2d | Sven Schöling | |||
45ea642b | Sven Schöling | use SL::DB::DeliveryOrder::TypeData qw(validate_type);
|
||
82515b2d | Sven Schöling | sub object_class { 'SL::DB::DeliveryOrder' }
|
||
__PACKAGE__->make_manager_methods;
|
||||
0c227fb2 | Moritz Bunkus | __PACKAGE__->add_filter_specs(
|
||
type => sub {
|
||||
my ($key, $value, $prefix) = @_;
|
||||
return __PACKAGE__->type_filter($value, $prefix);
|
||||
},
|
||||
all => sub {
|
||||
my ($key, $value, $prefix) = @_;
|
||||
return or => [ map { $prefix . $_ => $value } qw(donumber customer.name vendor.name transaction_description orderitems.serialnumber) ]
|
||||
}
|
||||
);
|
||||
82515b2d | Sven Schöling | sub type_filter {
|
||
my $class = shift;
|
||||
my $type = lc(shift || '');
|
||||
45ea642b | Sven Schöling | return type => validate_type($type);
|
||
82515b2d | Sven Schöling | }
|
||
168836cf | Moritz Bunkus | sub _sort_spec {
|
||
return (
|
||||
default => [ 'transdate', 1 ],
|
||||
nulls => {
|
||||
transaction_description => 'FIRST',
|
||||
customer_name => 'FIRST',
|
||||
vendor_name => 'FIRST',
|
||||
default => 'LAST',
|
||||
},
|
||||
columns => {
|
||||
SIMPLE => 'ALL',
|
||||
284470c1 | Moritz Bunkus | customer => 'lower(customer.name)',
|
||
vendor => 'lower(vendor.name)',
|
||||
168836cf | Moritz Bunkus | globalprojectnumber => 'lower(globalproject.projectnumber)',
|
||
# Bug in Rose::DB::Object: the next should be
|
||||
# "globalproject.project_type.description". This workaround will
|
||||
# only work if no other table with "project_type" is visible in
|
||||
# the current query
|
||||
globalproject_type => 'lower(project_type.description)',
|
||||
map { ( $_ => "lower(delivery_orders.$_)" ) } qw(donumber ordnumber cusordnumber oreqnumber shippingpoint shipvia notes intnotes transaction_description),
|
||||
});
|
||||
}
|
||||
sub default_objects_per_page { 40 }
|
||||
82515b2d | Sven Schöling | 1;
|