X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FManager%2FPurchaseInvoice.pm;h=ca0bb106eff23e82906b6d20988108f14b1e9bf3;hb=b32183e81bf653f1de18c4ee350c84c7fa55ba87;hp=1cc5737957fc5c25e18dcf6c45b0ac749c1f456e;hpb=ac5522802741d3092b371ab6b57199cb8a587bf9;p=kivitendo-erp.git diff --git a/SL/DB/Manager/PurchaseInvoice.pm b/SL/DB/Manager/PurchaseInvoice.pm index 1cc573795..ca0bb106e 100644 --- a/SL/DB/Manager/PurchaseInvoice.pm +++ b/SL/DB/Manager/PurchaseInvoice.pm @@ -2,8 +2,10 @@ package SL::DB::Manager::PurchaseInvoice; use strict; -use SL::DB::Helper::Manager; -use base qw(SL::DB::Helper::Manager); +use parent qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Paginated; +use SL::DB::Helper::Sorted; sub object_class { 'SL::DB::PurchaseInvoice' } @@ -14,10 +16,35 @@ sub type_filter { my $type = lc(shift || ''); return (or => [ invoice => 0, invoice => undef ]) if $type eq 'ap_transaction'; - return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice'; + return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type =~ m/^(?:purchase_)?invoice$/; return (and => [ invoice => 1, storno => 1 ]) if $type =~ m/(?:invoice_)?storno/; die "Unknown type $type"; } +sub _sort_spec { + return ( + default => [ 'transdate', 1 ], + nulls => { + transaction_description => 'FIRST', + vendor_name => 'FIRST', + default => 'LAST', + }, + columns => { + SIMPLE => 'ALL', + 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(ap.$_)" ) } qw(invnumber ordnumber quonumber shipvia notes intnotes transaction_description), + }); +} + +sub default_objects_per_page { 40 } + 1;