Changeset 2414


Ignore:
Timestamp:
06/24/20 22:12:43 (4 years ago)
Author:
nanardon
Message:

Fix: attribute not compute after employment changes

Location:
trunk/LATMOS-Accounts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/Changes

    r2413 r2414  
    1616    - add groupOfnames object support for LDAP 
    1717    - always try to create missing object in destination (regardless recent changes) 
    18     - Fix: dynamics attributes not properly compute after object creation 
     18    - Fix: dynamics attributes not properly compute after object creation and employment changes 
    1919    - add support objects (hardare support contact) 
    2020 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r2403 r2414  
    17461746        # If an employement apply we set the value to the user object 
    17471747 
    1748         $self->_computeEmploymentDate; 
     1748        my $res = $self->_computeEmploymentDate; 
    17491749 
    17501750        my %attrsets = ( 
     
    17701770 
    17711771        if (keys %attrsets) { 
    1772             if (my $res = $self->set_fields(%attrsets)) { 
     1772            if (my $cres = $self->set_fields(%attrsets)) { 
     1773                $res += $cres; 
    17731774                $self->ReportChange('Update', 'Attr %s updated to match Employment %s', join(', ', sort keys %attrsets), $currentemployment->id); 
    1774                 $self->PostSetAttribute(); 
    1775                 return $res; 
    17761775            } 
    1777         } else { 
    1778             return 1; 
    1779         } 
     1776        } 
     1777 
     1778        $self->PostSetAttribute() if ($res); 
    17801779    } else { 
    17811780        # No current employment, resetting values: 
     
    17831782        return $self->resetEmployment; 
    17841783    } 
    1785  
    17861784} 
    17871785 
     
    17951793    my ($self) = @_; 
    17961794 
    1797     $self->_computeEmploymentDate; 
     1795    my $res = $self->_computeEmploymentDate; 
    17981796 
    17991797    my %changes = ( 
     
    18361834 
    18371835    if (%changes) { 
    1838         if ($self->set_fields(%changes)) { 
     1836        if (my $cres += $self->set_fields(%changes)) { 
     1837            $res += $cres; 
    18391838            $self->base->log(LA_NOTICE, "Updating user %s to match unemployment", $self->id); 
    18401839            $self->ReportChange('Update', 'Update %s to match unemployment', join(', ', sort keys %changes)); 
    1841             $self->PostSetAttribute(); 
    1842             return 1; 
    1843         } else { 
    1844             return 0; 
    1845         } 
    1846     } else { 
    1847         return 1; 
    1848     } 
    1849  
     1840        } 
     1841    } 
     1842    $self->PostSetAttribute() if ($res); 
     1843 
     1844    return $res; 
    18501845} 
    18511846 
     
    19181913    } 
    19191914 
     1915    my $res = 0; 
    19201916    if (keys %changes) { 
    19211917        $self->base->log(LA_DEBUG, 'Applying employment state to user %s for field %s', $self->id, join(', ', keys %changes)); 
     
    19251921            $self->base->log(LA_DEBUG, 'New expiration is %s for user %s', ($changes{expire} || '(none)'), $self->id); 
    19261922        } 
    1927         $self->set_fields(%changes); 
     1923        $res += $self->set_fields(%changes); 
    19281924    } else { 
    19291925        $self->base->log(LA_DEBUG, 'No employment change for user %s', $self->id); 
     
    19321928    $self->_computeEmploymentHistory(); 
    19331929 
    1934     return 1; 
     1930    return $res; 
    19351931} 
    19361932 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm

    r2410 r2414  
    839839    my %data; 
    840840 
     841    $self->base->log(LA_DEBUG, "Running PostSetAttribute for %s/%s", $self->type, $self->id); 
     842 
    841843    my %AttrToCompute; 
    842844    foreach my $attr ($self->base->list_canonical_fields($self->type, 'r')) { 
Note: See TracChangeset for help on using the changeset viewer.