Changeset 2412


Ignore:
Timestamp:
06/23/20 08:52:55 (4 years ago)
Author:
nanardon
Message:

Fix: add specific listReal() for SQL Onlyaddress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Onlyaddress.pm

    r2175 r2412  
    1818 
    1919=cut 
     20 
     21sub listReal { 
     22    my ($class, $base) = @_; 
     23 
     24    my $sth = $base->db->prepare_cached( 
     25        sprintf( 
     26            q{select %s.%s as k from %s 
     27              join "user" on %s."user" = "user".name %s 
     28              where %s.oalias is NULL and %s.ikey not in (select okey from %s where attr = 'isMainAddress') %s 
     29              order by %s.%s 
     30            }, 
     31            $base->db->quote_identifier($class->_object_table), 
     32            $base->db->quote_identifier($class->_key_field), 
     33            $base->db->quote_identifier($class->_object_table), 
     34            $base->db->quote_identifier($class->_object_table), 
     35            ($base->{wexported} ? '' : 'and "user".exported = true'), 
     36            $base->db->quote_identifier($class->_object_table), 
     37            $base->db->quote_identifier($class->_object_table), 
     38            $base->db->quote_identifier($class->_object_table_attributes_read), # attr 
     39            ($base->{wexported} ? '' : 'and ' . 
     40                $base->db->quote_identifier($class->_object_table) . '.exported = true'), 
     41            $base->db->quote_identifier($class->_object_table), 
     42            $base->db->quote_identifier($class->_key_field), 
     43        ) 
     44    ); 
     45    $sth->execute; 
     46    my @keys; 
     47    while(my $res = $sth->fetchrow_hashref) { 
     48        push(@keys, $res->{k}); 
     49    } 
     50    @keys 
     51} 
    2052 
    2153sub list { 
Note: See TracChangeset for help on using the changeset viewer.