Changeset 1489 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Timestamp:
- 12/01/15 09:25:35 (9 years ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1470 r1489 857 857 ro => 1, 858 858 }, 859 currentEmployment => { 860 managed => 1, 861 ro => 1, 862 reference => 'employment', 863 get => sub { 864 my ($attr) = @_; 865 my $self = $attr->object; 866 867 my $sth = $self->base->db->prepare_cached( 868 q{ 869 select name from employment where firstday <= now() and 870 (lastday is null or lastday >= now()) and "user" = ? 871 limit 1 872 } 873 ); 874 $sth->execute($self->id); 875 if (my $res = $sth->fetchrow_hashref) { 876 return $res->{name} 877 } else { 878 return; 879 } 880 } 881 }, 859 882 } 860 883 )
Note: See TracChangeset
for help on using the changeset viewer.