Ignore:
Timestamp:
05/09/17 15:13:29 (7 years ago)
Author:
nanardon
Message:

Trying to fix local time in employment managment

File:
1 edited

Legend:

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

    r1992 r2028  
    13001300                    my $self = $attr->object; 
    13011301 
     1302                    my $now = DateTime->now()->iso8610 . 'Z'; 
     1303 
    13021304                    my $sth = $self->base->db->prepare_cached( 
    13031305                        q{ 
    1304                         select name from employment where firstday <= now() and 
    1305                         (lastday is null or lastday >= now() - '1 days'::interval) and "user" = ? 
     1306                        select name from employment where firstday <= ?::timestamp and 
     1307                        (lastday is null or lastday >= ?::timestamp - '1 days'::interval) and "user" = ? 
    13061308                        limit 1 
    13071309                        } 
    13081310                    ); 
    1309                     $sth->execute($self->id); 
     1311                    $sth->execute($now, $now, $self->id); 
    13101312                    my $res = $sth->fetchrow_hashref; 
    13111313                    $sth->finish; 
     
    13251327                    my $self = $attr->object; 
    13261328 
     1329                    my $now = DateTime->now()->iso8610 . 'Z'; 
     1330 
    13271331                    my $sth = $self->base->db->prepare_cached( 
    13281332                        q{ 
    1329                         select name from employment where firstday > now() and "user" = ? 
     1333                        select name from employment where firstday > ? and "user" = ? 
    13301334                        order by firstday asc 
    13311335                        limit 1 
    13321336                        } 
    13331337                    ); 
    1334                     $sth->execute($self->id); 
     1338                    $sth->execute($now, $self->id); 
    13351339                    my $res = $sth->fetchrow_hashref; 
    13361340                    $sth->finish; 
     
    13501354                    my $self = $attr->object; 
    13511355 
     1356                    my $now = DateTime->now()->iso8610 . 'Z'; 
     1357 
    13521358                    my $sth = $self->base->db->prepare_cached( 
    13531359                        q{ 
    13541360                        select name from employment where 
    1355                         (lastday is not null and lastday <= now() - '1 days'::interval) and "user" = ? 
     1361                        (lastday is not null and lastday <= ? - '1 days'::interval) and "user" = ? 
    13561362                        order by firstday desc 
    13571363                        limit 1 
    13581364                        } 
    13591365                    ); 
    1360                     $sth->execute($self->id); 
     1366                    $sth->execute($now, $self->id); 
    13611367                    my $res = $sth->fetchrow_hashref; 
    13621368                    $sth->finish; 
Note: See TracChangeset for help on using the changeset viewer.