Revision cd4e2d68
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/DB/Manager/EmailJournal.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use SL::DB::Helper::Paginated; |
8 | 8 |
use SL::DB::Helper::Sorted; |
9 |
use SL::DB::Helper::Filtered; |
|
9 | 10 |
|
10 | 11 |
sub object_class { 'SL::DB::EmailJournal' } |
11 | 12 |
|
12 | 13 |
__PACKAGE__->make_manager_methods; |
13 | 14 |
|
15 |
__PACKAGE__->add_filter_specs( |
|
16 |
linked_to => sub { |
|
17 |
my ($key, $value, $prefix) = @_; |
|
18 |
|
|
19 |
# if $value is truish, we want at least one link otherwise we want none |
|
20 |
my $comp = !!$value ? '>' : '='; |
|
21 |
|
|
22 |
# table emial_journal is aliased as t1 |
|
23 |
return |
|
24 |
\qq{( |
|
25 |
SELECT CASE WHEN count(*) $comp 0 THEN TRUE ELSE FALSE END |
|
26 |
FROM record_links |
|
27 |
WHERE ( |
|
28 |
(record_links.from_table = 'email_journal'::varchar(50)) |
|
29 |
AND record_links.from_id = t1.id |
|
30 |
) OR ( |
|
31 |
(record_links.to_table = 'email_journal'::varchar(50)) |
|
32 |
AND record_links.to_id = t1.id |
|
33 |
) |
|
34 |
)} => \'TRUE'; |
|
35 |
}, |
|
36 |
); |
|
37 |
|
|
14 | 38 |
sub _sort_spec { |
15 | 39 |
return ( |
16 | 40 |
default => [ 'sent_on', 0 ], |
... | ... | |
18 | 42 |
SIMPLE => 'ALL', |
19 | 43 |
sender => 'sender.name', |
20 | 44 |
linked_to => qq{( |
21 |
SELECT count(*) from record_links where |
|
45 |
SELECT count(*) |
|
46 |
FROM record_links |
|
47 |
WHERE |
|
22 | 48 |
( record_links.from_table = 'email_journal'::varchar(50) |
23 | 49 |
AND record_links.from_id = email_journal.id |
24 | 50 |
) OR ( |
Auch abrufbar als: Unified diff
EmailJournal: Report um Obsolete, Belegtype und Verknüpft erweitert