- Timestamp:
- 12/31/15 14:31:45 (9 years ago)
- Location:
- trunk/LATMOS-Accounts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Employment.pm
r1566 r1576 44 44 45 45 sub _has_extended_attributes { 1 } 46 47 sub _reported_atributes { qw(company contratType department endcircuit) } 46 48 47 49 sub _get_attr_schema { … … 317 319 appliedEmployement => $self->id, 318 320 ); 319 foreach my $attr ( qw(company contratType department managerContact endcircuit)) {321 foreach my $attr (_reported_atributes(), 'managerContact') { 320 322 my $uval = $user->get_attributes($attr) || ''; 321 323 my $cval = $self->get_attributes($attr) || ''; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Employment.pm
r1500 r1576 7 7 use LATMOS::Accounts::Log; 8 8 use LATMOS::Accounts::Utils; 9 use LATMOS::Accounts::Bases::Sql::Employment; 9 10 10 11 =head1 NAME … … 58 59 $self->{_base}->commit; 59 60 } 61 delete($users{$user}); 62 } 63 64 # Change has old employment => nothing 65 # if user is still active, expired account remains untouched 66 foreach my $user ($self->{_base}->search_objects('user', 'active=1')) { 67 if ($users{$user}) { 68 my $ouser = $self->{_base}->get_object('user', $user); 69 my %changes = ( 70 appliedEmployement => undef, 71 ); 72 foreach my $attr (LATMOS::Accounts::Bases::Sql::Employment::_reported_atributes) { 73 my $default = $self->{_base}->config("unemployment.$attr") || ''; 74 my $old = $ouser->_get_attributes($attr) || ''; 75 if ($old ne $default) { 76 $changes{$attr} = $default || undef; 77 } 78 } 79 if ($ouser->set_fields(%changes)) { 80 $self->{_base}->log(LA_NOTICE, "Updating user $user to match unemployment"); 81 $ouser->ReportChange('Update', 'Update %s to match unemployment', join(', ', sort keys %changes)); 82 $self->{_base}->commit; 83 } else { 84 $self->{_base}->rollback; 85 } 86 } 60 87 } 61 88 -
trunk/LATMOS-Accounts/man/man8/latmos-accounts-base-sql.pod
r1528 r1576 113 113 =back 114 114 115 When active users become out of any employment all managed attribute are unset 116 (except the expire attribute). 117 118 A default value for each of this attribute can be set in configuration using 119 parameter in form C<unemployment.ATTRIBUTE>. For example 120 C<unemployment.contratType=external> will set any C<contratType> to C<external> 121 when no employment apply to user anymore. 122 123 Only active accounts are modified in this way. 124 115 125 =head3 User endEmployment 116 126
Note: See TracChangeset
for help on using the changeset viewer.