Changeset 2236 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
- Timestamp:
- 04/01/19 16:57:40 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r2234 r2236 18 18 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 19 19 20 sub SCHEMA_VERSION { 3 0};20 sub SCHEMA_VERSION { 31 }; 21 21 22 22 =head1 NAME … … 104 104 $self->rollback; 105 105 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 }126 106 } 127 107 } … … 967 947 } 968 948 969 =head2 register_attribute ($otype, $attribute, $comment)970 971 Register a new attribute in base972 973 =cut974 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 exists984 985 =cut986 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 attribute996 997 =cut998 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 attribute1012 1013 =cut1014 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 attribute1024 1025 =cut1026 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 1033 949 =head2 getEmploymentRange 1034 950
Note: See TracChangeset
for help on using the changeset viewer.