- Timestamp:
- 12/30/15 13:56:55 (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
r1551 r1566 282 282 my $expire = str2time($user->get_attributes('expire') || '1970-01-01T00:00:00'); 283 283 284 my %changes; 285 foreach (qw( endEmployment endStrictEmployment endCurrentEmployment endLastEmployment )) { 286 my $old = $user->_get_attributes($_) || ''; 287 my $new = $user->_get_attributes("_$_") || ''; 288 if ($old ne $new) { 289 $changes{$_} = $new; 290 } 291 } 292 284 293 # If there is no current employment we try to find any to not let expire 285 294 # unset 286 295 my $endemploy = $currentemployment 287 ? $user-> get_attributes('endEmployment')288 : $user-> get_attributes('endLastEmployment');296 ? $user->_get_attributes('_endEmployment') 297 : $user->_get_attributes('_endLastEmployment'); 289 298 my $nextexpire = str2time($endemploy || '1970-01-01T00:00:00'); 290 299 291 300 if ($expire != $nextexpire) { 292 $user->set_fields(expire => $endemploy); 293 $user->ReportChange('Update', 'Expire update to %s to match employment', ($endemploy || '(none)')); 301 $changes{expire} = $endemploy; 302 } 303 304 if (keys %changes) { 305 $user->ReportChange('Update', 'Update %s to match employment', join(', ', sort keys %changes)); 306 $user->ReportChange('Update', 'Expire update to %s to match employment', ($endemploy || '(none)')) 307 if (exists($changes{expire})); 308 $user->set_fields(%changes); 294 309 } 295 310 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1559 r1566 214 214 label => l('End of entrance'), 215 215 }, 216 endEmployment => {216 _endEmployment => { 217 217 formtype => 'DATETIME', 218 218 managed => 1, 219 219 ro => 1, 220 hide => 1, 220 221 get => sub { 221 222 my ($attr) = @_; … … 225 226 label => l('End of employment'), 226 227 }, 227 endStrictEmployment => { 228 endEmployment => { 229 formtype => 'DATETIME', 230 ro => 1, 231 label => l('End of employment'), 232 }, 233 _endStrictEmployment => { 228 234 formtype => 'DATETIME', 229 235 managed => 1, 230 236 ro => 1, 237 hide => 1, 231 238 get => sub { 232 239 my ($attr) = @_; … … 235 242 }, 236 243 }, 237 endCurrentEmployment => { 244 endStrictEmployment => { 245 formtype => 'DATETIME', 246 ro => 1, 247 }, 248 _endCurrentEmployment => { 238 249 formtype => 'DATETIME', 239 250 managed => 1, 240 251 ro => 1, 252 hide => 1, 241 253 get => sub { 242 254 my ($attr) = @_; … … 268 280 }, 269 281 }, 270 endLastEmployment => { 282 endCurrentEmployment => { 283 formtype => 'DATETIME', 284 ro => 1, 285 }, 286 _endLastEmployment => { 271 287 formtype => 'DATETIME', 272 288 managed => 1, 273 289 ro => 1, 290 hide => 1, 274 291 get => sub { 275 292 my ($attr) = @_; … … 291 308 return $end ? $end->iso8601 : undef 292 309 }, 310 label => l('End of any employment'), 311 }, 312 endLastEmployment => { 313 formtype => 'DATETIME', 314 ro => 1, 293 315 label => l('End of any employment'), 294 316 }, … … 1076 1098 }, 1077 1099 appliedEmployement => { 1078 hid den=> 1,1100 hide => 1, 1079 1101 reference => 'employment', 1080 1102 },
Note: See TracChangeset
for help on using the changeset viewer.