Changeset 1504 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Timestamp:
- 12/18/15 18:35:40 (9 years ago)
- 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
r1502 r1504 135 135 }; 136 136 137 my $currentemployment = $user->get_attributes('currentEmployment') || ''; 138 137 139 my $expire = str2time($user->get_attributes('expire') || '1970-01-01T00:00:00'); 138 140 my $endemploy = $user->get_attributes('endEmployment'); … … 143 145 } 144 146 145 if (($user->get_attributes('currentEmployment') || '') ne $self->id) { 147 if ($currentemployment ne $self->id) { 148 # No sync to do if this employment is not currently applied 146 149 return; 147 150 } -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1500 r1504 215 215 if (!$res->{lastday}) { 216 216 # Ultimate employment. 217 $ end = undef;218 last217 $list_empl->finish; 218 return undef; 219 219 } 220 220 if ($end) { … … 229 229 } 230 230 $list_empl->finish; 231 232 if (!$end) { 233 my $listold = $self->base->db->prepare_cached(q{ 234 SELECT max(lastday) as lastday FROM employment WHERE "user" = ? and 235 lastday IS NOT NULL and lastday <= now() - '1 days'::interval 236 }); 237 $listold->execute($self->id); 238 my $res = $listold->fetchrow_hashref; 239 $listold->finish; 240 if ($res) { 241 $end = DateTime->from_epoch(epoch => str2time($res->{lastday})); 242 $end->set_time_zone( DateTime::TimeZone->new( name => 'local' ) ); 243 $end->add(hours => 23, minutes => 59, seconds => 59); 244 } 245 } 231 246 return $end ? $end->iso8601 : undef 232 247 },
Note: See TracChangeset
for help on using the changeset viewer.