Changeset 2324


Ignore:
Timestamp:
12/16/19 14:20:13 (4 years ago)
Author:
nanardon
Message:

Recompute cached attribute on employment change

File:
1 edited

Legend:

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

    r2314 r2324  
    17461746        # If an employement apply we set the value to the user object 
    17471747 
    1748         $self->computeEmploymentDate; 
     1748        $self->_computeEmploymentDate; 
    17491749 
    17501750        my %attrsets = ( 
     
    17721772            if (my $res = $self->set_fields(%attrsets)) { 
    17731773                $self->ReportChange('Update', 'Attr %s updated to match Employment %s', join(', ', sort keys %attrsets), $currentemployment->id); 
     1774                $self->PostSetAttribute(); 
    17741775                return $res; 
    17751776            } 
     
    17801781        # No current employment, resetting values: 
    17811782 
    1782         return $self->_resetEmployment; 
     1783        return $self->resetEmployment; 
    17831784    } 
    17841785 
    17851786} 
    17861787 
    1787 # Reset attribute value set by employment 
    1788 # except managerContact and expire 
    1789  
    1790 sub _resetEmployment { 
     1788=head2 resetEmployment 
     1789 
     1790Reset attribute value set by employment except managerContact and expire 
     1791 
     1792=cut 
     1793 
     1794sub resetEmployment { 
    17911795    my ($self) = @_; 
    17921796 
    1793     $self->computeEmploymentDate; 
     1797    $self->_computeEmploymentDate; 
    17941798 
    17951799    my %changes = ( 
     
    18351839            $self->base->log(LA_NOTICE, "Updating user %s to match unemployment", $self->id); 
    18361840            $self->ReportChange('Update', 'Update %s to match unemployment', join(', ', sort keys %changes)); 
     1841            $self->PostSetAttribute(); 
    18371842            return 1; 
    18381843        } else { 
     
    18451850} 
    18461851 
    1847 =head2 computeEmploymentDate 
     1852=head2 _computeEmploymentDate 
    18481853 
    18491854Compute and copy to user start and end employment date 
     
    18511856=cut 
    18521857 
    1853 sub computeEmploymentDate { 
     1858sub _computeEmploymentDate { 
    18541859    my ($self) = @_; 
    18551860 
Note: See TracChangeset for help on using the changeset viewer.