Changeset 201 for LATMOS-Accounts/lib


Ignore:
Timestamp:
05/27/09 02:18:46 (15 years ago)
Author:
nanardon
Message:
  • fix for new schema
Location:
LATMOS-Accounts/lib/LATMOS/Accounts
Files:
4 edited

Legend:

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

    r197 r201  
    7878    $for ||= 'rw'; 
    7979    my $pclass = $self->_load_obj_class($otype) or return; 
    80     $pclass->_canonical_fields($self, $for); 
     80    sort $pclass->_canonical_fields($self, $for); 
    8181} 
    8282 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm

    r183 r201  
    7373                join group_attributes_list on 
    7474                group_attributes_users.attr = group_attributes_list.ikey 
    75                 where id = ? and canonical = ? 
     75                join "group" on "group".ikey = group_attributes_users.okey 
     76                where name = ? and canonical = ? 
    7677                } 
    7778            ); 
     
    106107                if ($member{$_}{n}) { 
    107108                    my $sth = $self->db->prepare_cached( 
    108                         q{insert into group_attributes_users (value, attr, id) values (?,?,?)} 
     109                        q{insert into group_attributes_users (value, attr, okey) values (?,?,?)} 
    109110                    ); 
    110                     $sth->execute($_, $attrid, $self->id); 
     111                    $sth->execute($_, $attrid, $self->_get_ikey); 
    111112                } elsif ($member{$_}{c}) { 
    112113                    my $sth = $self->db->prepare_cached( 
    113                         q{delete from group_attributes_users where value = ? and attr = ? and id = ?} 
     114                        q{delete from group_attributes_users where value = ? and attr = ? and okey = ?} 
    114115                    ); 
    115                     $sth->execute($_, $attrid, $self->id); 
     116                    $sth->execute($_, $attrid, $self->_get_ikey); 
    116117                } # else {} # can't happend 
    117118            } 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r196 r201  
    8282        my $sth = $self->db->prepare_cached( 
    8383            q{ 
    84             select id from group_attributes_users 
     84            select name from "group" join 
     85            group_attributes_users on group_attributes_users.okey = "group".ikey 
    8586            join group_attributes_list on 
    8687            group_attributes_users.attr = group_attributes_list.ikey 
     
    9192        my @res; 
    9293        while (my $res = $sth->fetchrow_hashref) { 
    93             push(@res, $res->{id}); 
     94            push(@res, $res->{name}); 
    9495        } 
    9596        return \@res; 
     
    9798        my $sth = $self->db->prepare_cached( 
    9899            q{ 
    99             select id from user_attributes join user_attributes_list 
     100            select uid from "user" join 
     101            user_attributes on user_attributes.okey = "user".ikey 
     102            join user_attributes_list 
    100103            on user_attributes_list.ikey = user_attributes.attr 
    101104            where value = ? and canonical = ? 
     
    105108        my @res; 
    106109        while (my $res = $sth->fetchrow_hashref) { 
    107             push(@res, $res->{id}); 
     110            push(@res, $res->{uid}); 
    108111        } 
    109112        return \@res; 
     
    111114        my $sth = $self->db->prepare_cached( 
    112115            q{ 
    113             select id from group_attributes join group_attributes_list 
     116            select name from "group" join 
     117            group_attributes on group_attributes.okey = "group".ikey 
     118            join group_attributes_list 
    114119            on group_attributes_list.ikey = group_attributes.attr 
    115120            where value = ? and canonical = ? 
     
    119124        my @res; 
    120125        while (my $res = $sth->fetchrow_hashref) { 
    121             push(@res, $res->{id}); 
     126            push(@res, $res->{name}); 
    122127        } 
    123128        return \@res; 
     
    175180                if ($member{$_}{n}) { 
    176181                    my $sth = $self->db->prepare_cached( 
    177                         q{insert into group_attributes_users (value, attr, id) values (?,?,?)} 
     182                        q{insert into group_attributes_users (value, attr, okey) values (?,?,?)} 
    178183                    ); 
    179                     $sth->execute($self->id, $attrid, $_); 
     184                    $sth->execute($self->id, $attrid, $group->_get_ikey); 
    180185                } elsif ($member{$_}{c}) { 
    181186                    my $sth = $self->db->prepare_cached( 
    182                         q{delete from group_attributes_users where value = ? and attr = ? and id = ?} 
     187                        q{delete from group_attributes_users where value = ? and attr = ? and okey = ?} 
    183188                    ); 
    184                     $sth->execute($self->id, $attrid, $_); 
     189                    $sth->execute($self->id, $attrid, $group->_get_ikey); 
    185190                } # else {} # can't happend 
    186191            } 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm

    r200 r201  
    119119        } 
    120120    } 
    121     @attr, keys %{ $class->_inline_fields($for, $base) || {} } 
     121    my %inl = %{ $class->_inline_fields($for, $base) || {} }; 
     122    $inl{$_} = 1 foreach(@attr); 
     123    sort keys %inl; 
    122124} 
    123125 
Note: See TracChangeset for help on using the changeset viewer.