Changeset 1854 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Timestamp:
- 11/20/16 23:41:54 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1847 r1854 1318 1318 reference => 'employment', 1319 1319 }, 1320 contratTypeHistory => { 1321 reference => 'group', 1322 can_values => sub { 1323 $base->search_objects('group', 'sutype=contrattype') 1324 }, 1325 multiple => 1, 1326 }, 1320 1327 hosted => { 1321 1328 formtype => 'CHECKBOX', … … 1358 1365 }; 1359 1366 1360 foreach (qw(contratType managerContact company endcircuit department hosted)) { 1367 foreach (qw(contratType managerContact company endcircuit department hosted 1368 contratTypeHistory)) { 1361 1369 $attrs->{$_}{ro} = $employmentro; 1362 1370 } … … 1521 1529 $self->set_fields(%changes); 1522 1530 } 1531 1532 $self->_computeEmploymentHistory(); 1523 1533 1524 1534 return 1; … … 1647 1657 } 1648 1658 1659 sub _computeEmploymentHistory { 1660 my ($self) = @_; 1661 1662 my %changes; 1663 1664 foreach my $attribute (qw(contratType)) { 1665 my $sth = $self->db->prepare_cached(q{ 1666 select employment_attributes.value from employment 1667 join employment_attributes 1668 on employment.ikey = employment_attributes.okey 1669 where "user" = ? and employment_attributes.attr = ? 1670 and employment.firstday < now() 1671 group by employment_attributes.value 1672 }); 1673 $sth->execute($self->id, $attribute); 1674 my @values; 1675 while (my $res = $sth->fetchrow_hashref) { 1676 push(@values, $res->{value}); 1677 } 1678 $changes{$attribute . "History"} = \@values; 1679 } 1680 1681 $self->set_fields(%changes); 1682 } 1683 1649 1684 =head2 storeBannedPassword($epassword) 1650 1685
Note: See TracChangeset
for help on using the changeset viewer.