Ignore:
Timestamp:
01/21/16 02:33:44 (8 years ago)
Author:
nanardon
Message:

Fix expiration computation, don't return negative duration

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql
Files:
2 edited

Legend:

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

    r1646 r1647  
    100100                } 
    101101                my $firstday = $self->object->get_attributes('firstday'); 
     102 
     103                return if ($firstday gt $lastday); 
    102104 
    103105                my @fd = split('-', $firstday) or return; 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r1646 r1647  
    14251425    $expireOn ||= 'endEmployment'; 
    14261426 
     1427    # We check if matching start exists to know if using end* for expiration is 
     1428    # safe, even undef 
     1429    my %end2start = ( 
     1430        endEmployment        => 'startEmployment', 
     1431        endStrictEmployment  => 'startStrictEmployment', 
     1432        endCurrentEmployment => 'startCurrentEmployment', 
     1433        endLastEmployment    => 'startFirstEmployment', 
     1434    ); 
     1435 
    14271436    if ($expireOn ne 'never') { 
    1428         my $endemploy = $self->_get_attributes("_$expireOn") || 
    1429             (($self->base->config('unemployed_expire') ||'') eq 'no' 
     1437        my $endemploy = $self->_get_attributes("_$end2start{$expireOn}") 
     1438            ? $self->_get_attributes("_$expireOn") 
     1439            : (($self->base->config('unemployed_expire') ||'') eq 'no' 
    14301440                ? undef 
    14311441                : $self->_get_attributes('create')); 
Note: See TracChangeset for help on using the changeset viewer.