Ignore:
Timestamp:
04/01/19 16:57:40 (5 years ago)
Author:
nanardon
Message:

Don't maintains attributes list in SQL table anymore

This patch remove the attributes_list table which contain the list of
allowed attributes on object.
The list of attributes is now only in the application side.

File:
1 edited

Legend:

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

    r2234 r2236  
    1818our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
    1919 
    20 sub SCHEMA_VERSION { 30 }; 
     20sub SCHEMA_VERSION { 31 }; 
    2121 
    2222=head1 NAME 
     
    104104                    $self->rollback; 
    105105                    return; 
    106                 } 
    107             } 
    108         } 
    109  
    110         foreach my $otype ($self->list_supported_objects) { 
    111             my %attrlist = map { $_ => 1 } $self->list_registered_attributes($otype); 
    112             foreach my $attribute ($self->list_canonical_fields($otype, 'a')) { 
    113                 my $attr = $self->attribute($otype, $attribute); 
    114                 $attr->{inline} and next; 
    115                 $attr->{managed} and next; 
    116  
    117                 if ($attrlist{$attribute}) { 
    118                 } else { 
    119                     if($self->register_attribute($otype, $attribute, $attr->{comment})) { 
    120                         $self->log(LA_NOTICE, "Attr. $attribute for object type $otype registred"); 
    121                     } else { 
    122                         $self->log(LA_ERR, "Can't register attribute $attribute"); 
    123                         $self->{_db}->rollback; 
    124                         return; 
    125                     } 
    126106                } 
    127107            } 
     
    967947} 
    968948 
    969 =head2 register_attribute ($otype, $attribute, $comment) 
    970  
    971 Register a new attribute in base 
    972  
    973 =cut 
    974  
    975 sub register_attribute { 
    976     my ($self, $otype, $attribute, $comment) = @_; 
    977     my $pclass = $self->_load_obj_class($otype) or return; 
    978     $pclass->register_attribute($self, $attribute, $comment); 
    979 } 
    980  
    981 =head2 is_registered_attribute ($otype, $attribute) 
    982  
    983 Return true is attribute already exists 
    984  
    985 =cut 
    986  
    987 sub is_registered_attribute { 
    988     my ($self, $otype, $attribute) = @_; 
    989     my $pclass = $self->_load_obj_class($otype) or return; 
    990     $pclass->is_registered_attribute($self, $attribute); 
    991 } 
    992  
    993 =head2 list_registered_attributes ($otype) 
    994  
    995 List all regiestered attribute 
    996  
    997 =cut 
    998  
    999 sub list_registered_attributes { 
    1000     my ($self, $otype) = @_; 
    1001     my $pclass = $self->_load_obj_class($otype) or return; 
    1002     if ($pclass->_has_extended_attributes) { 
    1003         return $pclass->list_registered_attributes($self); 
    1004     } else { 
    1005         return (); 
    1006     } 
    1007 } 
    1008  
    1009 =head2 get_attribute_comment ($otype, $attribute) 
    1010  
    1011 Return the comment associated to attribute 
    1012  
    1013 =cut 
    1014  
    1015 sub get_attribute_comment { 
    1016     my ($self, $otype, $attribute) = @_; 
    1017     my $pclass = $self->_load_obj_class($otype) or return; 
    1018     $pclass->get_attribute_comment($self, $attribute); 
    1019 } 
    1020  
    1021 =head2 set_attribute_comment ($otype, $attribute, $comment) 
    1022  
    1023 Set comment to attribute 
    1024  
    1025 =cut 
    1026  
    1027 sub set_attribute_comment { 
    1028     my ($self, $otype, $attribute, $comment) = @_; 
    1029     my $pclass = $self->_load_obj_class($otype) or return; 
    1030     $pclass->set_attribute_comment($self, $attribute, $comment); 
    1031 } 
    1032  
    1033949=head2 getEmploymentRange 
    1034950 
Note: See TracChangeset for help on using the changeset viewer.