Changeset 2448


Ignore:
Timestamp:
11/05/20 15:19:17 (4 years ago)
Author:
nanardon
Message:

Fix: ListReal? returning all userstatus instead only futur one

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql
Files:
2 edited

Legend:

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

    r1520 r2448  
    2020 
    2121sub list { 
    22     my ($class, $base) = @_; 
     22    my ($class, $base, $Real) = @_; 
    2323 
    2424    my $sth = $base->db->prepare_cached( 
     
    2727              join "user" on %s."user" = "user".name 
    2828              where (%s.lastday is null or %s.lastday >= now() - '1 days'::interval) 
    29               %s %s 
     29              %s %s %s 
    3030              order by %s.%s 
    3131            }, 
     
    3636            $base->db->quote_identifier($class->_object_table), 
    3737            $base->db->quote_identifier($class->_object_table), 
     38            ($Real ? 'and oalias IS NULL' : ''), 
    3839            ($base->{wexported} ? '' : 'and "user".exported = true'), 
    3940            ($base->{wexported} ? '' : 'and ' . 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm

    r2445 r2448  
    2828    my ($class, $base) = @_; 
    2929 
     30    $class->list( $base, 'True' ); 
     31} 
     32 
     33sub list { 
     34    my ($class, $base, $Real) = @_; 
     35 
    3036    my $sth = $base->db->prepare_cached( 
    3137        sprintf( 
    32             q{select %s as k from %s where internobject = false 
    33                 and oalias IS NULL %s order by %s}, 
     38            q{select %s as k from %s where internobject = false %s %s order by %s}, 
    3439            $base->db->quote_identifier($class->_key_field), 
    3540            $base->db->quote_identifier($class->_object_table), 
    3641            ($base->{wexported} ? '' : 'and exported = true'), 
    37             $base->db->quote_identifier($class->_key_field), 
    38         ) 
    39     ); 
    40     $sth->execute; 
    41     my @keys; 
    42     while(my $res = $sth->fetchrow_hashref) { 
    43         push(@keys, $res->{k}); 
    44     } 
    45     @keys 
    46 } 
    47  
    48 sub list { 
    49     my ($class, $base) = @_; 
    50  
    51     my $sth = $base->db->prepare_cached( 
    52         sprintf( 
    53             q{select %s as k from %s where internobject = false %s order by %s}, 
    54             $base->db->quote_identifier($class->_key_field), 
    55             $base->db->quote_identifier($class->_object_table), 
    56             ($base->{wexported} ? '' : 'and exported = true'), 
     42            ($Real ? 'and oalias IS NULL' : ''), 
    5743            $base->db->quote_identifier($class->_key_field), 
    5844        ) 
Note: See TracChangeset for help on using the changeset viewer.