Changeset 2028 for trunk/LATMOS-Accounts/lib
- Timestamp:
- 05/09/17 15:13:29 (7 years ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1992 r2028 1300 1300 my $self = $attr->object; 1301 1301 1302 my $now = DateTime->now()->iso8610 . 'Z'; 1303 1302 1304 my $sth = $self->base->db->prepare_cached( 1303 1305 q{ 1304 select name from employment where firstday <= now()and1305 (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" = ? 1306 1308 limit 1 1307 1309 } 1308 1310 ); 1309 $sth->execute($ self->id);1311 $sth->execute($now, $now, $self->id); 1310 1312 my $res = $sth->fetchrow_hashref; 1311 1313 $sth->finish; … … 1325 1327 my $self = $attr->object; 1326 1328 1329 my $now = DateTime->now()->iso8610 . 'Z'; 1330 1327 1331 my $sth = $self->base->db->prepare_cached( 1328 1332 q{ 1329 select name from employment where firstday > now()and "user" = ?1333 select name from employment where firstday > ? and "user" = ? 1330 1334 order by firstday asc 1331 1335 limit 1 1332 1336 } 1333 1337 ); 1334 $sth->execute($ self->id);1338 $sth->execute($now, $self->id); 1335 1339 my $res = $sth->fetchrow_hashref; 1336 1340 $sth->finish; … … 1350 1354 my $self = $attr->object; 1351 1355 1356 my $now = DateTime->now()->iso8610 . 'Z'; 1357 1352 1358 my $sth = $self->base->db->prepare_cached( 1353 1359 q{ 1354 1360 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" = ? 1356 1362 order by firstday desc 1357 1363 limit 1 1358 1364 } 1359 1365 ); 1360 $sth->execute($ self->id);1366 $sth->execute($now, $self->id); 1361 1367 my $res = $sth->fetchrow_hashref; 1362 1368 $sth->finish; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Employment.pm
r1964 r2028 8 8 use LATMOS::Accounts::Utils; 9 9 use LATMOS::Accounts::Bases::Sql::Employment; 10 use DateTime; 11 use DateTime::TimeZone; 10 12 11 13 =head1 NAME … … 44 46 } 45 47 48 my $now = DateTime->now()->iso8601 . 'Z'; 49 46 50 my $listempl = $self->{_base}->db->prepare_cached(q{ 47 SELECT * FROM employment where firstday <= now() and (lastday is null or lastday >= now()- '1 days'::interval)51 SELECT * FROM employment where firstday <= ?::timestamp and (lastday is null or lastday >= ?::timestamp - '1 days'::interval) 48 52 and exported = true 49 53 order by lastday, firstday 50 54 }); 51 $listempl->execute( );55 $listempl->execute($now, $now); 52 56 my %new = (); 53 57 while (my $res = $listempl->fetchrow_hashref) {
Note: See TracChangeset
for help on using the changeset viewer.