- Timestamp:
- 02/14/17 21:39:12 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Employment.pm
r1949 r1950 343 343 my $res = $self->SUPER::set_fields(%data); 344 344 345 $self->applyToUser or return;346 return $res;347 }348 349 =head2 applyToUser()350 351 Set user's attributes if need from this employement.352 353 =cut354 355 sub applyToUser {356 my ($self) = @_;357 358 345 my $user = $self->base->get_object('user', $self->get_attributes('user')) or do { 359 346 $self->base->log(LA_ERR, "Cannot fetch user %s to apply employment", $self->get_attributes('user')); … … 361 348 }; 362 349 363 $user->base->log(LA_DEBUG, "Applying Employement %s to user %s", $self->id, $user->id); 364 365 my $currentemployment = $user->get_attributes('currentEmployment') || ''; 366 367 if (!$currentemployment) { 368 return $user->_resetEmployment 369 } elsif ($currentemployment eq $self->id) { 370 # No sync to do if this employment is not currently applied 371 return $user->applyCurrentEmployment; 372 } else { 373 return $user->computeEmploymentDate; 374 } 350 $user->applyCurrentEmployment; 351 352 return $res; 375 353 } 376 354
Note: See TracChangeset
for help on using the changeset viewer.