Ignore:
Timestamp:
12/18/15 07:24:42 (9 years ago)
Author:
nanardon
Message:

Enable/Disable? address according user status

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

Legend:

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

    r1329 r1498  
    310310        $data{isMainAddress} = 1; 
    311311    } 
     312    $data{exported} = $user->get_attributes('exported'); 
    312313    $class->SUPER::_create($base, $id, %data); 
    313314} 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r1489 r1498  
    112112                        ); 
    113113                    } 
     114                    foreach my $al ($self->object->get_attributes('otheraddress')) { 
     115                        my $obj = $self->base->get_object('address', $al) or next; 
     116                        $obj->_set_c_fields( 
     117                            exported => $value, 
     118                        ); 
     119                    } 
    114120                }, 
    115121            }, 
     
    282288                            } else { 
    283289                                $self->base->log(LA_ERR, "Cannot add forward for %s", 
    284                                     $self->id); 
     290                                    $self->object->id); 
    285291                            } 
    286292                        } 
     
    873879                    ); 
    874880                    $sth->execute($self->id); 
    875                     if (my $res = $sth->fetchrow_hashref) { 
     881                    my $res = $sth->fetchrow_hashref; 
     882                    $sth->finish; 
     883                    if ($res) { 
    876884                        return $res->{name} 
    877885                    } else { 
     
    902910} 
    903911 
     912=head2 listEmployment 
     913 
     914Return the ordered list of contract 
     915 
     916=cut 
     917 
     918sub listEmployment { 
     919    my ($self) = @_; 
     920 
     921    my $sth = $self->base->db->prepare_cached( 
     922        q{ 
     923        select name from employment where "user" = ? 
     924        order by lastday desc NULLS first 
     925        } 
     926    ); 
     927    $sth->execute($self->id); 
     928    my @list = (); 
     929    while (my $res = $sth->fetchrow_hashref) { 
     930        push(@list, $res->{name}); 
     931    } 
     932 
     933    @list 
     934} 
     935 
    9049361; 
    905937 
Note: See TracChangeset for help on using the changeset viewer.