- Timestamp:
- 01/04/17 12:16:26 (7 years ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r1910 r1911 98 98 $self->log(LA_DEBUG, 'New connection to DB'); 99 99 100 100 101 foreach my $otype ($self->list_supported_objects) { 102 my %attrlist = map { $_ => 1 } $self->list_registered_attributes($otype); 101 103 foreach my $attribute ($self->list_canonical_fields($otype, 'r')) { 102 104 my $attr = $self->attribute($otype, $attribute); … … 104 106 $attr->{managed} and next; 105 107 106 if ($ self->is_registered_attribute($otype, $attribute)) {108 if ($attrlist{$attribute}) { 107 109 } else { 108 110 if($self->register_attribute($otype, $attribute, $attr->{comment})) { … … 778 780 } 779 781 782 =head2 list_registered_attributes ($otype) 783 784 List all regiestered attribute 785 786 =cut 787 788 sub list_registered_attributes { 789 my ($self, $otype) = @_; 790 my $pclass = $self->_load_obj_class($otype) or return; 791 if ($pclass->_has_extended_attributes) { 792 return $pclass->list_registered_attributes($self); 793 } else { 794 return (); 795 } 796 } 797 780 798 =head2 get_attribute_comment ($otype, $attribute) 781 799 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1910 r1911 1224 1224 } 1225 1225 1226 =head2 list_registered_attributes 1227 1228 Return the list for all registered attribute 1229 1230 =cut 1231 1232 sub list_registered_attributes { 1233 my ($class, $base) = @_; 1234 1235 my $sth = $base->db->prepare( 1236 sprintf(q{ 1237 select canonical from %s 1238 }, $class->_attributes_table 1239 ) 1240 ); 1241 $sth->execute(); 1242 my @attrs = (); 1243 1244 while (my $res = $sth->fetchrow_hashref) { 1245 push(@attrs, $res->{canonical}); 1246 } 1247 return @attrs; 1248 } 1249 1250 1226 1251 =head2 get_attribute_comment $base, $attribute) 1227 1252
Note: See TracChangeset
for help on using the changeset viewer.