Revision 168836cf
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/DB/Manager/PurchaseInvoice.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
5 |
use SL::DB::Helper::Manager; |
|
6 |
use base qw(SL::DB::Helper::Manager); |
|
5 |
use parent qw(SL::DB::Helper::Manager); |
|
6 |
|
|
7 |
use SL::DB::Helper::Paginated; |
|
8 |
use SL::DB::Helper::Sorted; |
|
7 | 9 |
|
8 | 10 |
sub object_class { 'SL::DB::PurchaseInvoice' } |
9 | 11 |
|
... | ... | |
14 | 16 |
my $type = lc(shift || ''); |
15 | 17 |
|
16 | 18 |
return (or => [ invoice => 0, invoice => undef ]) if $type eq 'ap_transaction'; |
17 |
return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
|
|
19 |
return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type =~ m/^(?:purchase_)?invoice$/;
|
|
18 | 20 |
return (and => [ invoice => 1, storno => 1 ]) if $type =~ m/(?:invoice_)?storno/; |
19 | 21 |
|
20 | 22 |
die "Unknown type $type"; |
21 | 23 |
} |
22 | 24 |
|
25 |
sub _sort_spec { |
|
26 |
return ( |
|
27 |
default => [ 'transdate', 1 ], |
|
28 |
nulls => { |
|
29 |
transaction_description => 'FIRST', |
|
30 |
vendor_name => 'FIRST', |
|
31 |
default => 'LAST', |
|
32 |
}, |
|
33 |
columns => { |
|
34 |
SIMPLE => 'ALL', |
|
35 |
vendor => 'vendor.name', |
|
36 |
globalprojectnumber => 'lower(globalproject.projectnumber)', |
|
37 |
|
|
38 |
# Bug in Rose::DB::Object: the next should be |
|
39 |
# "globalproject.project_type.description". This workaround will |
|
40 |
# only work if no other table with "project_type" is visible in |
|
41 |
# the current query |
|
42 |
globalproject_type => 'lower(project_type.description)', |
|
43 |
|
|
44 |
map { ( $_ => "lower(ap.$_)" ) } qw(invnumber ordnumber quonumber shipvia notes intnotes transaction_description), |
|
45 |
}); |
|
46 |
} |
|
47 |
|
|
48 |
sub default_objects_per_page { 40 } |
|
49 |
|
|
23 | 50 |
1; |
Auch abrufbar als: Unified diff
Verknüpfte Belege: beliebige Verknüpfungen hinzufügen können