line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::list::identities; |
2
|
1
|
|
|
1
|
|
1675
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use Bif::Mo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
1153
|
use Term::ANSIColor 'color'; |
|
1
|
|
|
|
|
8575
|
|
|
1
|
|
|
|
|
774
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.5_6'; |
8
|
|
|
|
|
|
|
extends 'App::bif'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub run { |
11
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
12
|
1
|
|
|
|
|
4
|
my $opts = $self->opts; |
13
|
1
|
|
|
|
|
7
|
my $db = $self->db; |
14
|
0
|
|
|
|
|
|
my $dark = color('yellow'); |
15
|
0
|
|
|
|
|
|
my $reset = color('reset'); |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
DBIx::ThinSQL->import(qw/ case qv /); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $data = $db->xarrayrefs( |
20
|
|
|
|
|
|
|
select => [ |
21
|
|
|
|
|
|
|
qv( $dark . 'identity' . $reset )->as('type'), |
22
|
|
|
|
|
|
|
'i.id', 'e.name', |
23
|
|
|
|
|
|
|
"ecm.mvalue || ' (' || ecm.method || ')' AS contact", |
24
|
|
|
|
|
|
|
case ( |
25
|
|
|
|
|
|
|
when => 'bif.identity_id = i.id', |
26
|
|
|
|
|
|
|
then => qv('*'), |
27
|
|
|
|
|
|
|
else => qv(''), |
28
|
|
|
|
|
|
|
)->as('self'), |
29
|
|
|
|
|
|
|
], |
30
|
|
|
|
|
|
|
from => 'identities i', |
31
|
|
|
|
|
|
|
inner_join => 'entities e', |
32
|
|
|
|
|
|
|
on => 'e.id = i.id', |
33
|
|
|
|
|
|
|
inner_join => 'entities c', |
34
|
|
|
|
|
|
|
on => 'c.id = e.contact_id', |
35
|
|
|
|
|
|
|
inner_join => 'entity_contact_methods ecm', |
36
|
|
|
|
|
|
|
on => 'ecm.id = e.default_contact_method_id', |
37
|
|
|
|
|
|
|
left_join => 'bifkv bif', |
38
|
|
|
|
|
|
|
on => { 'bif.key' => 'self', 'bif.identity_id' => \'i.id' }, |
39
|
|
|
|
|
|
|
order_by => [qw/e.name contact ecm.mvalue/], |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
return $self->ok('ListIdentities') unless $data; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->start_pager( scalar @$data ); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
print $self->render_table( ' l r l l l ', |
47
|
|
|
|
|
|
|
[ 'Type', 'ID', 'Name', 'Contact (Method)', '' ], $data ); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $self->ok('ListIdentities'); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |