Changeset 1751


Ignore:
Timestamp:
04/14/16 11:21:43 (8 years ago)
Author:
nanardon
Message:

Fix date computation, always return next departure if any

File:
1 edited

Legend:

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

    r1750 r1751  
    15161516        $nstart = DateTime->from_epoch(epoch => str2time($onext->_get_attributes('firstday'))); 
    15171517        $nstart->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 
    1518         $nstart->subtract(days => $delay + 1); 
    15191518    } 
    15201519 
     
    15361535                last; 
    15371536            } 
    1538         } elsif (!$res->{current}) { 
     1537        } elsif ((!$res->{current}) && (!$any)) { 
    15391538            last; 
    15401539        } 
     
    15611560        $pend = DateTime->from_epoch(epoch => str2time($oprev->_get_attributes('lastday'))); 
    15621561        $pend->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 
    1563         $pend->add(days => $delay + 1); 
     1562        $pend->add(hours => 23, minutes => 59, seconds => 59); 
    15641563    } 
    15651564 
     
    15781577        } 
    15791578        if ($res->{current}) { 
    1580         } elsif ($pend) { 
     1579        } elsif ($end) { 
    15811580            my $nextstart = DateTime->from_epoch(epoch => str2time($res->{firstday})); 
    15821581            $nextstart->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 
    1583             my $tend = $pend->clone; 
     1582            my $tend = $end->clone; 
    15841583            $tend->add(days => $delay + 1); 
    15851584            if ($tend->ymd lt $nextstart->ymd) { 
     
    15891588            last; 
    15901589        } 
    1591         $pend = DateTime->from_epoch(epoch => str2time($res->{lastday})); 
    1592         $pend->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 
    1593         $pend->add(hours => 23, minutes => 59, seconds => 59); 
    1594         $end = $pend->clone; 
     1590        $end = DateTime->from_epoch(epoch => str2time($res->{lastday})); 
     1591        $end->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 
     1592        $end->add(hours => 23, minutes => 59, seconds => 59); 
    15951593    } 
    15961594    $list_empl->finish; 
Note: See TracChangeset for help on using the changeset viewer.