source: LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Onlyaddress.pm @ 519

Last change on this file since 519 was 445, checked in by nanardon, 15 years ago
  • add onlyaddress object to create an address book in ldap for secondary address
  • Property svn:keywords set to Id Rev
File size: 882 bytes
Line 
1package LATMOS::Accounts::Bases::Sql::Onlyaddress;
2
3use strict;
4use warnings;
5
6use base qw(LATMOS::Accounts::Bases::Sql::Address);
7
8our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];
9
10sub list {
11    my ($class, $base) = @_;
12
13    my $sth = $base->db->prepare_cached(
14        sprintf(
15            q{select %s as k from %s where ikey not in (select okey from %s where attr = 'isMainAddress') %s order by %s},
16            $base->db->quote_identifier($class->key_field),
17            $base->db->quote_identifier($class->object_table),
18            $base->db->quote_identifier($class->object_table. '_attributes'), # attr
19            ($base->{wexported} ? '' : 'and exported = true'),
20            $base->db->quote_identifier($class->key_field),
21        )
22    );
23    $sth->execute;
24    my @keys;
25    while(my $res = $sth->fetchrow_hashref) {
26        push(@keys, $res->{k});
27    }
28    @keys
29}
30
311;
Note: See TracBrowser for help on using the repository browser.