Ignore:
Timestamp:
10/18/16 16:06:10 (8 years ago)
Author:
nanardon
Message:

Automatically register attributes a db start

File:
1 edited

Legend:

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

    r1838 r1843  
    9797        $self->{_db}->do(q{set DATESTYLE to 'DMY'}); 
    9898        $self->log(LA_DEBUG, 'New connection to DB'); 
     99 
     100        foreach my $otype ($self->list_supported_objects) { 
     101            foreach my $attribute ($self->list_canonical_fields($otype, 'r')) { 
     102                my $attr = $self->attribute($otype, $attribute); 
     103                $attr->{inline} and next; 
     104                $attr->{managed} and next; 
     105 
     106                if ($self->is_registered_attribute($otype, $attribute)) { 
     107                } else { 
     108                    if($self->register_attribute($otype, $attribute, $attr->{comment})) { 
     109                        $self->log(LA_NOTICE, "Attr. $attribute for object type $otype registred"); 
     110                    } else { 
     111                        $self->log(LA_ERR, "Can't register attribute $attribute"); 
     112                        $self->{_db}->rollback; 
     113                        return; 
     114                    } 
     115                } 
     116            } 
     117        } 
     118 
    99119        $self->{_db}->commit; 
    100120        return $self->{_db}; 
Note: See TracChangeset for help on using the changeset viewer.