X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FManager%2FOrder.pm;h=ff5169bfa80bb28b46ac4e7cf9ad1790508133ef;hb=058e3bc770fa6cc7f9695e39f22a9a6415dd5834;hp=3c76073e8cebffd6d20bbcf52a94221638e03c5b;hpb=fd0a62ab6e04848235d609db53ad90a39dc921c8;p=kivitendo-erp.git diff --git a/SL/DB/Manager/Order.pm b/SL/DB/Manager/Order.pm index 3c76073e8..ff5169bfa 100644 --- a/SL/DB/Manager/Order.pm +++ b/SL/DB/Manager/Order.pm @@ -6,11 +6,23 @@ use parent qw(SL::DB::Helper::Manager); use SL::DB::Helper::Paginated; use SL::DB::Helper::Sorted; +use SL::DB::Helper::Filtered; sub object_class { 'SL::DB::Order' } __PACKAGE__->make_manager_methods; +__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(ordnumber quonumber customer.name vendor.name transaction_description) ] + } +); + sub type_filter { my $class = shift; my $type = lc(shift || ''); @@ -30,12 +42,21 @@ sub _sort_spec { nulls => { transaction_description => 'FIRST', customer_name => 'FIRST', + vendor_name => 'FIRST', default => 'LAST', }, columns => { SIMPLE => 'ALL', - customer => 'customer.name', + customer => 'lower(customer.name)', + vendor => 'lower(vendor.name)', 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(oe.$_)" ) } qw(ordnumber quonumber cusordnumber shippingpoint shipvia notes intnotes transaction_description), }); }